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.
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.