]> The Tcpdump Group git mirrors - tcpdump/commitdiff
ICMP: Print the length field of the Interface Name Sub-Object
authorFrancois-Xavier Le Bail <[email protected]>
Mon, 7 Feb 2022 13:25:16 +0000 (14:25 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Mon, 7 Feb 2022 18:02:48 +0000 (19:02 +0100)
Update the output of two tests accordingly.

Moreover:
Fix indentation.

print-icmp.c
tests/icmp-cksum-oobr-2.out
tests/icmp-rfc5837.out

index c77c3a4ff2d12abec35a7660443020adee60ab8f..4e66a3cff96c8928c47cfa4475720ddde70fee09 100644 (file)
@@ -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));
index c83905c46cb57807ea2c65c49f601c9b41349211..fd2a22eba514cba79751862bc7f71a016a6c15ba 100644 (file)
@@ -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]
index bc6cd087a6bc3f8e43f019785d1ab32e5c8e1b0c..e5342bc513a8688e2a0922652cab4871c01a9552 100644 (file)
@@ -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-[:-)]