Closed avinassh closed 3 years ago
Oh wait, I just noticed the packet itself. It could netcat is sending to terminate the connection cleanly. Sorry 🤦
No worries!
Out of curiosit, what are you working on?
I started thinking how do VPNs actually work and learnt about TUN/TAP. Then decided to write my own really shitty version of VPN to understand how it exactly works :D
Sorry for the odd little, but I ran into the odd issue myself. I created a TUN interface and tried netcat on it. But when I close my netcat, I still see it is receiving packets. Weirdly, if I keep nc running, it doesn't receive any!
Details:
rust-tun version: 0.5.1 OS, version: Mac OS Catalina, 10.15.7 (19H2) rust: rustc 1.50.0 (cb75ad5db 2021-02-10)
My reproducible code is here - main.rs. Once this is running, it replies the TCP packet only once and then it just keeps logging whatever the data it has received. So, first packet it gets is TCP SYN, to which it responds with TCP ACK and then logs rest of the packets to console.
Steps to reproduce:
Build and run it:
Setup the links:
start netcat:
If you don't close netcat, you will see the output something like this:
If you close the netcat (Ctrl + C), then the packets start appearing!
How is it even receiving these! I also confirmed it running tshark:
and when I close netcat:
Where are the packets coming from! I am new to TUN/TAP, so it could be my understanding of these interfaces is not correct