packetnet icon indicating copy to clipboard operation
packetnet copied to clipboard

Large UDP packet: Length field get overwritten with length of first IP fragment

Open arvindpdmn opened this issue 2 years ago • 0 comments

Using iperf we send large UDP packets, say 2000 bytes. The networking stack will send the packet as two IPv4 fragments.

At the receiver we use this .NET library. When the receiver gets the first fragment, it decodes the IPv4 packet/fragment correctly. But then it also proceeds to decode the UDP header in the first fragment. Because only part of the UDP payload has come in, it updates the Length field of UDP packet to the smaller value. This is wrong. Higher layer decoding should be deferred until all IP fragments are received.

In our application, the receiver is an intermediate node. It's meant to transparently pass on IP and higher layer content.

If this library had used ReadOnlySpan<byte>, this bug could have been avoided. Library should not modify packet contents that it receives.

arvindpdmn avatar Sep 29 '23 12:09 arvindpdmn