The current implementation of the Ipv4Header has the field payload_length that does not exist in the real IPv4 header. The real IPv4 header has a field total_length that also contains the length of the header itself, while payload_length only describes the length of the payload of the IPv4 packet.
This sometimes leads to confusion what was actually present on the wire & also leads to some not-so-nice corner cases that can trigger error return values when writing & decoding headers (e.g. when the payload_len + header_len is bigger then u16::MAX).
Replace payload_len with total_len so the header mirrors the data of the actual on the wire header.
The current implementation of the
Ipv4Header
has the fieldpayload_length
that does not exist in the real IPv4 header. The real IPv4 header has a fieldtotal_length
that also contains the length of the header itself, whilepayload_length
only describes the length of the payload of the IPv4 packet.This sometimes leads to confusion what was actually present on the wire & also leads to some not-so-nice corner cases that can trigger error return values when writing & decoding headers (e.g. when the payload_len + header_len is bigger then
u16::MAX
).Replace
payload_len
withtotal_len
so the header mirrors the data of the actual on the wire header.