TCP Packet Size Limitations
Posted: Fri Jan 30, 2015 3:06 am
Hi,
I have a problem with sending TCP packets out.
What I have is basically a very simple hard wired TCP stack that I have developed to test and understand the TCP communication. I already developed a hard wired server side ARP to respond to ARP resolution echo requests.
What I have right now is a very small HTTP server that receives an HTTP request and respond to it with a hard wired message. I use the e1000 virtual nic on qemu.
The following is a summary of the TCP communication sequence I have after ARP resolution:
My kernel is the server, and the client is the command line CURL program I use to initiate requests (I also tried firefox)
The above works perfectly as long as the HTTP reply packet is less than or equal to 164 bytes in total (Eth Header+IP Header+TCP header and options+ payload)., and when I change the payload for larger sizes it fails.
I expect that I calculate the checksums correctly (IP and TCP) since packets less than 165 byte go through and are accepted.
I have been trying to fix this for three days now and I cannot. My problem is that when the packet size exceeds the 164 bytes the packet does not appear on Wireshark which makes me think that it did not leave the NIC in the first place.
If anyone can think about the cause or what can be the reason behind it, it will be of great help.
Thanks,
Karim.
I have a problem with sending TCP packets out.
What I have is basically a very simple hard wired TCP stack that I have developed to test and understand the TCP communication. I already developed a hard wired server side ARP to respond to ARP resolution echo requests.
What I have right now is a very small HTTP server that receives an HTTP request and respond to it with a hard wired message. I use the e1000 virtual nic on qemu.
The following is a summary of the TCP communication sequence I have after ARP resolution:
Code: Select all
Client: SYN Payload=0 Seq=f8 4d 26 1b Ack=00 00 00 00 Seq = Rand
Server: SYN,ACK Payload=0 Seq=ed 2c cf 7b Ack=f8 4d 26 1c Seq = Rand Ack=Prev. Seq +1
Client: ACK Payload=0 Seq=f8 4d 26 1c Ack=ed 2c cf 7c Seq = Prev Ack Ack = Prev. Seq +1
Client: PSH,ACK Payload=87 Seq=f8 4d 26 1c Ack=ed 2c cf 7c Copy Prev Seq and Ack (HTTP REQUEST)
Server: Ack Payload=0 Seq=ed 2c cf 7c Ack=f8 4d 26 73 Seq = Prev Ack Ack = Prev. Seq + Prev.Payload
Server: PSH,ACK Payload=251 Seq=ed 2c cf 7c Ack=f8 4d 26 73 Copy Prev Seq and Ack (HTTP REPLY - HERE IS THE PROBLEM WHEN > 164 bytes)
Client: Ack Payload=0 Seq=f8 4d 26 73 Ack=ed 2c d0 77 Seq = Prev Ack Ack = Prev. Seq + Prev.Payload
Client: FIN,ACK Payload=0 Seq=f8 4d 26 73 Ack=ed 2c d0 77 Copy Prev Seq and Ack
Server: FIN,ACK Payload=0 Seq=ed 2c d0 77 Ack=f8 4d 26 74 Seq = Prev Ack Ack = Prev. Seq +1
Client: FIN,ACK Payload=0 Seq=f8 4d 26 74 Ack=ed 2c d0 78 Seq = Prev Ack Ack = Prev. Seq +1
The above works perfectly as long as the HTTP reply packet is less than or equal to 164 bytes in total (Eth Header+IP Header+TCP header and options+ payload)., and when I change the payload for larger sizes it fails.
I expect that I calculate the checksums correctly (IP and TCP) since packets less than 165 byte go through and are accepted.
I have been trying to fix this for three days now and I cannot. My problem is that when the packet size exceeds the 164 bytes the packet does not appear on Wireshark which makes me think that it did not leave the NIC in the first place.
If anyone can think about the cause or what can be the reason behind it, it will be of great help.
Thanks,
Karim.