]> The Tcpdump Group git mirrors - tcpdump/commitdiff
ICMP: Fix Interface Information Object printing
authorFrancois-Xavier Le Bail <[email protected]>
Tue, 19 Dec 2023 13:03:48 +0000 (14:03 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 19 Dec 2023 14:32:12 +0000 (15:32 +0100)
s/Interface Identification Object/Interface Information Object/
(Reference: RFC5837. Interface Identification Object is in RFC8335.)
Also in some variable names.
Use IANA name for the 'ICMP Extension Object Classes' value 2.
This implies updates to avoid printing 'Object' twice.
Use texts from RFC '7. IANA Considerations' for Interface Roles.
Fix indentations in output.

Update some test outputs accordingly.

This is a follow-up to dbf0433fef377d3739e94b881cdd540c5f988a98.

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

index 5d492080f553c464b8a7e86008f94febb4493e5c..3d458a5eaebabd21de7a09c18563cfc46241bec0 100644 (file)
@@ -294,17 +294,17 @@ struct icmp_multipart_ext_object_header_t {
 };
 
 static const struct tok icmp_multipart_ext_obj_values[] = {
-    { 1, "MPLS Stack Entry" },
-    { 2, "Interface Identification" },
+    { 1, "MPLS Stack Entry Object" },
+    { 2, "Interface Information Object" },
     { 0, NULL}
 };
 
 /* rfc5837 */
-static const struct tok icmp_interface_identification_role_values[] = {
-    { 0, "the IP interface upon which a datagram arrived"},
-    { 1, "the sub-IP component of an IP interface upon which a datagram arrived"},
-    { 2, "the IP interface through which the datagram would have been forwarded had it been forwardable"},
-    { 3, "the IP next hop to which the datagram would have been forwarded"},
+static const struct tok icmp_interface_information_role_values[] = {
+    { 0, "Incoming IP Interface"},
+    { 1, "Sub-IP Component of Incoming IP Interface"},
+    { 2, "Outgoing IP Interface"},
+    { 3, "IP Next hop"},
     { 0, NULL }
 };
 
@@ -316,7 +316,7 @@ Interface IP Address Sub-Object
 +-------+-------+-------+-------+
 |         IP Address   ....
 */
-struct icmp_interface_identification_ipaddr_subobject_t {
+struct icmp_interface_information_ipaddr_subobject_t {
     nd_uint16_t  afi;
     nd_uint16_t  reserved;
     nd_uint32_t  ip_addr;
@@ -329,7 +329,7 @@ octet    0        1                                   63
         | length |   interface name octets 1-63               |
         +--------+-----------................-----------------+
 */
-struct icmp_interface_identification_ifname_subobject_t {
+struct icmp_interface_information_ifname_subobject_t {
     nd_uint8_t  length;
     nd_byte     if_name[63];
 };
@@ -791,7 +791,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen,
                 obj_ctype = GET_U_1(icmp_multipart_ext_object_header->ctype);
                 obj_tptr += sizeof(struct icmp_multipart_ext_object_header_t);
 
-                ND_PRINT("\n\t  %s Object (%u), Class-Type: %u, length %u",
+                ND_PRINT("\n\t  %s (%u), Class-Type: %u, length %u",
                        tok2str(icmp_multipart_ext_obj_values,"unknown",obj_class_num),
                        obj_class_num,
                        obj_ctype,
@@ -844,21 +844,21 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen,
                     name_flag      = (obj_ctype & 0x2) >> 1;
                     mtu_flag       = (obj_ctype & 0x1);
 
-                    ND_PRINT("\n\t\t This object describes %s",
-                             tok2str(icmp_interface_identification_role_values,
+                    ND_PRINT("\n\t    Interface Role: %s",
+                             tok2str(icmp_interface_information_role_values,
                              "an unknown interface role",interface_role));
 
                     offset = obj_tptr;
 
                     if (if_index_flag) {
-                        ND_PRINT("\n\t\t Interface Index: %u", GET_BE_U_4(offset));
+                        ND_PRINT("\n\t    Interface Index: %u", GET_BE_U_4(offset));
                         offset += 4;
                     }
                     if (ipaddr_flag) {
-                        const struct icmp_interface_identification_ipaddr_subobject_t *ipaddr_subobj;
+                        const struct icmp_interface_information_ipaddr_subobject_t *ipaddr_subobj;
 
-                        ND_PRINT("\n\t\t IP Address sub-object: ");
-                        ipaddr_subobj = (const struct icmp_interface_identification_ipaddr_subobject_t *) offset;
+                        ND_PRINT("\n\t    IP Address sub-object: ");
+                        ipaddr_subobj = (const struct icmp_interface_information_ipaddr_subobject_t *) offset;
                         switch (GET_BE_U_2(ipaddr_subobj->afi)) {
                             case 1:
                                 ND_PRINT("%s", GET_IPADDR_STRING(ipaddr_subobj->ip_addr));
@@ -876,11 +876,11 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen,
                     }
                     if (name_flag) {
                         uint8_t inft_name_length_field;
-                        const struct icmp_interface_identification_ifname_subobject_t *ifname_subobj;
+                        const struct icmp_interface_information_ifname_subobject_t *ifname_subobj;
 
-                        ifname_subobj = (const struct icmp_interface_identification_ifname_subobject_t *) offset;
+                        ifname_subobj = (const struct icmp_interface_information_ifname_subobject_t *) offset;
                         inft_name_length_field = GET_U_1(ifname_subobj->length);
-                        ND_PRINT("\n\t\t Interface Name");
+                        ND_PRINT("\n\t    Interface Name");
                         if (inft_name_length_field == 0) {
                             ND_PRINT(" [length %u]", inft_name_length_field);
                             nd_print_invalid(ndo);
@@ -904,7 +904,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen,
                         offset += inft_name_length_field;
                     }
                     if (mtu_flag) {
-                        ND_PRINT("\n\t\t MTU: %u", GET_BE_U_4(offset));
+                        ND_PRINT("\n\t    MTU: %u", GET_BE_U_4(offset));
                         offset += 4;
                     }
                     break;
index 2c66f3d0f16436d41357d5d2e7478cd2321c62d5..5520eea25a2cb47a858a9ce2cd24f42ca6fe0b50 100644 (file)
@@ -3,8 +3,8 @@
        (tos 0x0, ttl 1, id 42321, offset 0, flags [none], proto UDP (17), length 40)
     12.4.4.4.42315 > 12.1.1.1.33440: [bad udp cksum 0x1000 -> 0xbad0!] UDP, length 12
        ICMP Multi-Part extension v2
-         Interface Identification Object (2), Class-Type: 14, length 80
-                This object describes the IP interface upon which a datagram arrived
-                Interface Index: 15
-                IP Address sub-object: 10.10.10.10
-                Interface Name [length 63 != N x 4] (invalid) [|icmp]
+         Interface Information Object (2), Class-Type: 14, length 80
+           Interface Role: Incoming IP Interface
+           Interface Index: 15
+           IP Address sub-object: 10.10.10.10
+           Interface Name [length 63 != N x 4] (invalid) [|icmp]
index a65f3b7bc2f775db04d0934c96adf033def1e8cc..4f5404df86e02da1fadd4341fc1618b6692ad70b 100644 (file)
@@ -3,8 +3,8 @@
        IP (tos 0x0, ttl 1, id 42321, offset 0, flags [none], proto UDP (17), length 40)
     12.4.4.4.42315 > 12.1.1.1.33440: UDP, length 12
        ICMP Multi-Part extension v2, checksum 0x246c (correct), length 84
-         Interface Identification Object (2), Class-Type: 14, length 80
-                This object describes the IP interface upon which a datagram arrived
-                Interface Index: 15
-                IP Address sub-object: 10.10.10.10
-                Interface Name, length 64: This-is-the-name-of-the-Interface-that-we-are-looking-for-[:-)]
+         Interface Information Object (2), Class-Type: 14, length 80
+           Interface Role: Incoming IP Interface
+           Interface Index: 15
+           IP Address sub-object: 10.10.10.10
+           Interface Name, length 64: This-is-the-name-of-the-Interface-that-we-are-looking-for-[:-)]
index 3e16a4df0fa2e4018fd601206768f1d88f71acf4..02ab01cdf5f3c41b5c2fd35d7822accadb3dc25f 100644 (file)
@@ -3,6 +3,6 @@
        IP (tos 0x0, ttl 1, id 42321, offset 0, flags [none], proto UDP (17), length 40, bad cksum f76a (->db81)!)
     8.15.4.4.42315 > 12.223.32.1.33440: UDP, length 12
        ICMP Multi-Part extension v2
-         Interface Identification Object (2), Class-Type: 2, length 8016
-                This object describes the IP interface upon which a datagram arrived
-                Interface Name [length 0] (invalid) [|icmp]
+         Interface Information Object (2), Class-Type: 2, length 8016
+           Interface Role: Incoming IP Interface
+           Interface Name [length 0] (invalid) [|icmp]