From: Francois-Xavier Le Bail Date: Mon, 7 Feb 2022 13:25:16 +0000 (+0100) Subject: ICMP: Print the length field of the Interface Name Sub-Object X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/598981696ff740246cdd95025b595b62c8095d9f ICMP: Print the length field of the Interface Name Sub-Object Update the output of two tests accordingly. Moreover: Fix indentation. --- diff --git a/print-icmp.c b/print-icmp.c index c77c3a4f..4e66a3cf 100644 --- a/print-icmp.c +++ b/print-icmp.c @@ -849,11 +849,15 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * offset += 4; } if (name_flag) { + uint8_t inft_name_length_field; + ifname_subobj = (const struct icmp_interface_identification_ifname_subobject_t *) offset; - ND_PRINT("\n\t\t Interface Name: %.*s", - GET_U_1(ifname_subobj->length), - ifname_subobj->if_name); - offset += 1 + GET_U_1(ifname_subobj->length); + inft_name_length_field = GET_U_1(ifname_subobj->length); + ND_PRINT("\n\t\t Interface Name, length %u: %.*s", + inft_name_length_field, + inft_name_length_field, + ifname_subobj->if_name); + offset += 1 + inft_name_length_field; } if (mtu_flag) { ND_PRINT("\n\t\t MTU: %u", GET_BE_U_4(offset)); diff --git a/tests/icmp-cksum-oobr-2.out b/tests/icmp-cksum-oobr-2.out index c83905c4..fd2a22eb 100644 --- a/tests/icmp-cksum-oobr-2.out +++ b/tests/icmp-cksum-oobr-2.out @@ -7,4 +7,4 @@ This object describes the IP interface upon which a datagram arrived Interface Index: 15 IP Address sub-object: 10.10.10.10 - Interface Name: This-is-the-name-of-the-Interface-that-we-are-looking-for-[:-)] [|icmp] + Interface Name, length 63: This-is-the-name-of-the-Interface-that-we-are-looking-for-[:-)] [|icmp] diff --git a/tests/icmp-rfc5837.out b/tests/icmp-rfc5837.out index bc6cd087..e5342bc5 100644 --- a/tests/icmp-rfc5837.out +++ b/tests/icmp-rfc5837.out @@ -7,4 +7,4 @@ This object describes the IP interface upon which a datagram arrived Interface Index: 15 IP Address sub-object: 10.10.10.10 - Interface Name: This-is-the-name-of-the-Interface-that-we-are-looking-for-[:-)] + Interface Name, length 63: This-is-the-name-of-the-Interface-that-we-are-looking-for-[:-)]