-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Receiving packets even when I shouldn't be #33
Comments
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 |
zonyitoo
pushed a commit
to zonyitoo/rust-tun
that referenced
this issue
Feb 18, 2024
* detail packet_information * cargo fmt * allow deprecated annotation * Update mod.rs * Update README.md * update doc * update doc * update doc and example --------- Co-authored-by: ssrlive <30760636+ssrlive@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
$ tshark -i utun4 Capturing on 'utun4' 1 0.000000 192.168.0.10 → 192.168.0.20 TCP 68 50838 → 80 [SYN, ECN, CWR] Seq=0 Win=65535 Len=0 MSS=1460 WS=64 TSval=689213287 TSecr=0 SACK_PERM=1 2 0.000202 192.168.0.20 → 192.168.0.10 TCP 44 80 → 50838 [SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 3 0.000245 192.168.0.10 → 192.168.0.20 TCP 44 50838 → 80 [ACK] Seq=1 Ack=1 Win=65535 Len=0
and when I close netcat:
$ tshark -i utun4 Capturing on 'utun4' 1 0.000000 192.168.0.10 → 192.168.0.20 TCP 68 50838 → 80 [SYN, ECN, CWR] Seq=0 Win=65535 Len=0 MSS=1460 WS=64 TSval=689213287 TSecr=0 SACK_PERM=1 2 0.000202 192.168.0.20 → 192.168.0.10 TCP 44 80 → 50838 [SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 3 0.000245 192.168.0.10 → 192.168.0.20 TCP 44 50838 → 80 [ACK] Seq=1 Ack=1 Win=65535 Len=0 4 47.650802 192.168.0.10 → 192.168.0.20 TCP 44 50838 → 80 [FIN, ACK] Seq=1 Ack=1 Win=65535 Len=0 5 48.852183 192.168.0.10 → 192.168.0.20 TCP 44 [TCP Retransmission] 50838 → 80 [FIN, ACK] Seq=1 Ack=1 Win=65535 Len=0 6 51.053430 192.168.0.10 → 192.168.0.20 TCP 44 [TCP Retransmission] 50838 → 80 [FIN, ACK] Seq=1 Ack=1 Win=65535 Len=0 7 55.254724 192.168.0.10 → 192.168.0.20 TCP 44 [TCP Retransmission] 50838 → 80 [FIN, ACK] Seq=1 Ack=1 Win=65535 Len=0 8 63.458208 192.168.0.10 → 192.168.0.20 TCP 44 [TCP Retransmission] 50838 → 80 [FIN, ACK] Seq=1 Ack=1 Win=65535 Len=0
Where are the packets coming from! I am new to TUN/TAP, so it could be my understanding of these interfaces is not correct
The text was updated successfully, but these errors were encountered: