]> The Tcpdump Group git mirrors - tcpdump/commit
ICMP: Fix printing the Interface Name Sub-Object
authorFrancois-Xavier Le Bail <[email protected]>
Mon, 7 Feb 2022 14:51:36 +0000 (15:51 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Mon, 7 Feb 2022 18:02:48 +0000 (19:02 +0100)
commitf30baa4292317ec709c02b787945d86fce17fa7e
treefaa9934192fcdc6775d47548819f365fa4de506c
parent598981696ff740246cdd95025b595b62c8095d9f
ICMP: Fix printing the Interface Name Sub-Object

RFC 5837 - 4.3.  Interface Name Sub-Object
"The Interface Name Sub-Object MUST have a length that is a multiple
 of 4 octets and MUST NOT exceed 64 octets.

 The Length field represents the length of the Interface Name Sub-
 Object, including the length and the interface name in octets."

The length of the interface name to print is: (Length field) - 1.
The offset is only: Length field

Add sanity checks: Multiple of 4 octets, <= 64 octets.

Fix the icmp-rfc5837.pcap test.
The interface name length in octets is 63, thus the length field must be 64.
Update also the ICMP Multi-Part Extensions checksum.

Keep an invalid length field in icmp-cksum-oobr-2.pcap.

Update the output of two tests accordingly.
print-icmp.c
tests/icmp-cksum-oobr-2.out
tests/icmp-rfc5837.out
tests/icmp-rfc5837.pcap