google / netstack

IPv4 and IPv6 userland network stack
Apache License 2.0
3.08k stars 278 forks source link

Question: Receiving Packets as different segments #17

Open arun1587 opened 5 years ago

arun1587 commented 5 years ago

Hi, Whenever I send (ipv6) packets of size > 56Bytes (well within tunnel MTU of 1500 Bytes) to tun_echo example, I receive the contents echo'ed back in 2 or more packets. ep.Read() returns data of size not more than 56Bytes per call. Any settings/configuration on endpoint that can give me the entire TCP payload in a single call to Read() ?

running it on Ubuntu 16.04 thanks,

amscanne commented 5 years ago

Can you include a packet trace? When you say send packets, I assume you mean you're using ep.Write? (I'm just wondering if maybe there's a new connection and you're looking at the end of the handshake?)

arun1587 commented 5 years ago
    2   0.000496 192.168.11.11 → 192.168.11.1 TCP 76 8234 → 46002 [SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1460 TSval=3759675041 TSecr=23667304 WS=32
    3   0.000587 192.168.11.1 → 192.168.11.11 TCP 68 46002 → 8234 [ACK] Seq=1 Ack=1 Win=29696 Len=0 TSval=23667304 TSecr=3759675041
    4  30.746827 192.168.11.1 → 192.168.11.11 TCP 574 46002 → 8234 [PSH, ACK] Seq=1 Ack=1 Win=29696 **Len=506** TSval=23674991 TSecr=3759675041
    5  30.747139 192.168.11.11 → 192.168.11.1 TCP 68 8234 → 46002 [ACK] Seq=1 Ack=507 Win=1048064 Len=0 TSval=3759705787 TSecr=23674991
    6  30.747345 192.168.11.11 → 192.168.11.1 TCP 144 8234 → 46002 [PSH, ACK] Seq=1 Ack=507 Win=1048128 **Len=76** TSval=3759705788 TSecr=23674991
    7  30.747405 192.168.11.1 → 192.168.11.11 TCP 68 46002 → 8234 [ACK] Seq=507 Ack=77 Win=29696 Len=0 TSval=23674991 TSecr=3759705788
    8  30.747486 192.168.11.11 → 192.168.11.1 TCP 324 8234 → 46002 [PSH, ACK] Seq=77 Ack=507 Win=1048384 **Len=256** TSval=3759705788 TSecr=23674991
    9  30.747526 192.168.11.1 → 192.168.11.11 TCP 68 46002 → 8234 [ACK] Seq=507 Ack=333 Win=30720 Len=0 TSval=23674991 TSecr=3759705788
   10  30.747585 192.168.11.11 → 192.168.11.1 TCP 242 8234 → 46002 [PSH, ACK] Seq=333 Ack=507 Win=1048576 **Len=174** TSval=3759705788 TSecr=23674991
   11  30.747629 192.168.11.1 → 192.168.11.11 TCP 68 46002 → 8234 [ACK] Seq=507 Ack=507 Win=31744 Len=0 TSval=23674991 TSecr=3759705788

the payload of length 506 (packet #4) that is sent from 192.168.11.1 -> 192.168.11.11 is being echo'ed back in three different packets of sizes 76 (packet #6), 256 (packet #8), 174 (packet #10). I use netcat to send messages to the echo example in netstack.