]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Rename MPLS Extension to Multipart Extension
authorishaangandhi <[email protected]>
Tue, 24 Nov 2020 16:49:44 +0000 (11:49 -0500)
committerGuy Harris <[email protected]>
Sun, 20 Mar 2022 05:59:01 +0000 (22:59 -0700)
(backported from commit 572f2e7cdf0e4bdf1592a5ca887c389d8d7c155d)

print-icmp.c
tests/icmp-cksum-oobr-1.out
tests/icmp-cksum-oobr-2.out
tests/icmp-cksum-oobr-3.out
tests/icmp-cksum-oobr-4.out
tests/mpls-traceroute-v.out

index b0e13f4c8239be1d410ae62be726c9804954f24b..fe90aff0f3a3f391eb235226c96017fd8d3fb55a 100644 (file)
@@ -86,7 +86,7 @@ struct icmp {
 #define        icmp_data       icmp_dun.id_data
 };
 
-#define ICMP_MPLS_EXT_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
+#define ICMP_EXT_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
 #define ICMP_MPLS_EXT_VERSION 2
 
 /*
@@ -150,7 +150,7 @@ struct icmp {
        ((type) == ICMP_UNREACH || (type) == ICMP_SOURCEQUENCH || \
        (type) == ICMP_REDIRECT || (type) == ICMP_TIMXCEED || \
        (type) == ICMP_PARAMPROB)
-#define        ICMP_MPLS_EXT_TYPE(type) \
+#define        ICMP_MULTIPART_EXT_TYPE(type) \
        ((type) == ICMP_UNREACH || \
          (type) == ICMP_TIMXCEED || \
          (type) == ICMP_PARAMPROB)
@@ -188,6 +188,11 @@ struct icmp {
 #define ICMP_UNREACH_PRECEDENCE_CUTOFF 15      /* precedence cutoff */
 #endif
 
+/* rfc4950  */
+#define MPLS_STACK_ENTRY_OBJECT_CLASS            1
+/* rfc5837 */
+#define INTERFACE_INFORMATION_OBJECT_CLASS       2
+
 /* Most of the icmp types */
 static const struct tok icmp2str[] = {
        { ICMP_ECHOREPLY,               "echo reply" },
@@ -259,15 +264,15 @@ struct icmp_ext_t {
     nd_byte     icmp_ext_data[1];
 };
 
-struct icmp_mpls_ext_object_header_t {
+struct icmp_multipart_ext_object_header_t {
     nd_uint16_t length;
     nd_uint8_t  class_num;
     nd_uint8_t  ctype;
 };
 
-static const struct tok icmp_mpls_ext_obj_values[] = {
+static const struct tok icmp_multipart_ext_obj_values[] = {
     { 1, "MPLS Stack Entry" },
-    { 2, "Extended Payload" },
+    { 2, "Interface Identification" },
     { 0, NULL}
 };
 
@@ -305,7 +310,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
        const struct udphdr *ouh;
         const uint8_t *obj_tptr;
         uint32_t raw_label;
-       const struct icmp_mpls_ext_object_header_t *icmp_mpls_ext_object_header;
+       const struct icmp_multipart_ext_object_header_t *icmp_multipart_ext_object_header;
        u_int hlen, mtu, obj_tlen, obj_class_num, obj_ctype;
        uint16_t dport;
        char buf[MAXHOSTNAMELEN + 100];
@@ -675,14 +680,14 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
        ndo->ndo_protocol = "icmp";
 
         /*
-         * Attempt to decode the MPLS extensions only for some ICMP types.
+         * Attempt to decode multi-part message extensions (rfc4884) only for some ICMP types.
          */
-        if (ndo->ndo_vflag >= 1 && plen > ICMP_EXTD_MINLEN && ICMP_MPLS_EXT_TYPE(icmp_type)) {
+        if (ndo->ndo_vflag >= 1 && plen > ICMP_EXTD_MINLEN && ICMP_MULTIPART_EXT_TYPE(icmp_type)) {
 
             ND_TCHECK_SIZE(ext_dp);
 
             /*
-             * Check first if the mpls extension header shows a non-zero length.
+             * Check first if the multi-part extension header shows a non-zero length.
              * If the length field is not set then silently verify the checksum
              * to check if an extension header is present. This is expedient,
              * however not all implementations set the length field proper.
@@ -696,13 +701,13 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
                 }
             }
 
-            ND_PRINT("\n\tMPLS extension v%u",
-                   ICMP_MPLS_EXT_EXTRACT_VERSION(*(ext_dp->icmp_ext_version_res)));
+            ND_PRINT("\n\tICMP Multi-Part extension v%u",
+                   ICMP_EXT_EXTRACT_VERSION(*(ext_dp->icmp_ext_version_res)));
 
             /*
              * Sanity checking of the header.
              */
-            if (ICMP_MPLS_EXT_EXTRACT_VERSION(*(ext_dp->icmp_ext_version_res)) !=
+            if (ICMP_EXT_EXTRACT_VERSION(*(ext_dp->icmp_ext_version_res)) !=
                 ICMP_MPLS_EXT_VERSION) {
                 ND_PRINT(" packet not supported");
                 return;
@@ -721,29 +726,29 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
             hlen -= 4; /* subtract common header size */
             obj_tptr = (const uint8_t *)ext_dp->icmp_ext_data;
 
-            while (hlen > sizeof(struct icmp_mpls_ext_object_header_t)) {
+            while (hlen > sizeof(struct icmp_multipart_ext_object_header_t)) {
 
-                icmp_mpls_ext_object_header = (const struct icmp_mpls_ext_object_header_t *)obj_tptr;
-                ND_TCHECK_SIZE(icmp_mpls_ext_object_header);
-                obj_tlen = GET_BE_U_2(icmp_mpls_ext_object_header->length);
-                obj_class_num = GET_U_1(icmp_mpls_ext_object_header->class_num);
-                obj_ctype = GET_U_1(icmp_mpls_ext_object_header->ctype);
-                obj_tptr += sizeof(struct icmp_mpls_ext_object_header_t);
+                icmp_multipart_ext_object_header = (const struct icmp_multipart_ext_object_header_t *)obj_tptr;
+                ND_TCHECK_SIZE(icmp_multipart_ext_object_header);
+                obj_tlen = GET_BE_U_2(icmp_multipart_ext_object_header->length);
+                obj_class_num = GET_U_1(icmp_multipart_ext_object_header->class_num);
+                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",
-                       tok2str(icmp_mpls_ext_obj_values,"unknown",obj_class_num),
+                       tok2str(icmp_multipart_ext_obj_values,"unknown",obj_class_num),
                        obj_class_num,
                        obj_ctype,
                        obj_tlen);
 
-                hlen-=sizeof(struct icmp_mpls_ext_object_header_t); /* length field includes tlv header */
+                hlen-=sizeof(struct icmp_multipart_ext_object_header_t); /* length field includes tlv header */
 
                 /* infinite loop protection */
                 if ((obj_class_num == 0) ||
-                    (obj_tlen < sizeof(struct icmp_mpls_ext_object_header_t))) {
+                    (obj_tlen < sizeof(struct icmp_multipart_ext_object_header_t))) {
                     return;
                 }
-                obj_tlen-=sizeof(struct icmp_mpls_ext_object_header_t);
+                obj_tlen-=sizeof(struct icmp_multipart_ext_object_header_t);
 
                 switch (obj_class_num) {
                 case 1:
index 94cdc77c9134a194dc924a9797cc763f2441fc90..4e2b1c97af4ce784c5c57f3a01a5aa4fb859f70f 100644 (file)
@@ -2,4 +2,4 @@
     62.220.31.247 > 62.225.245.115: ICMP 62.220.31.247 udp port 1027 unreachable, length 13891
        (tos 0xa0, ttl 114, id 30054, offset 0, flags [none], proto UDP (17), length 13728, bad cksum 3f1f (->a1f)!)
     62.225.245.115.9109 > 62.220.31.247.1027: [bad udp cksum 0xdfe7 -> 0xdb95!] UDP, length 132
-       MPLS extension v0 packet not supported
+       ICMP Multi-Part extension v0 packet not supported
index bd271da004744eff80e976849cec0909486435dd..aad76ac8129574563a911edefa30ae17631cfbe3 100644 (file)
@@ -2,8 +2,8 @@
     10.4.0.34 > 12.4.4.4: ICMP time exceeded in-transit, length 32988
        (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
-       MPLS extension v2
-         Extended Payload Object (2), Class-Type: 14, length 80
+       ICMP Multi-Part extension v2
+         Interface Identification Object (2), Class-Type: 14, length 80
            0x0000:  0000 000f 0001 0000 0a0a 0a0a 3f54 6869
            0x0010:  732d 6973 2d74 6865 2d6e 616d 652d 6f66
            0x0020:  2d74 6865 2d49 6e74 6572 6661 6365 2d74
index 203776673e4ddb369bcf25e656ecfe3e2f5d6846..309afdbd18de3de5b29347ef991f705b9949bcba 100644 (file)
@@ -2,4 +2,4 @@
     97.242.24.11 > 97.242.24.11: ICMP 97.242.24.11 udp port 162 unreachable, length 4399
        (tos 0x0, ttl 128, id 30661, offset 0, flags [DF], proto UDP (17), length 295)
     97.242.24.11.60377 > 97.242.24.11.162: [udp sum ok]  { SNMPv1 C="trap" { Trap(251)  .1.3.6.1.4.1.3830.1.1.2.2.1 97.242.24.11 enterpriseSpecific s=52 61498489 .1.3.6.1.4.1.3830.1.1.2.1.1.1=3 .1.3.6.1.4.1.3830.1.1.2.1.1.2=2 .1.3.6.1.4.1.3830.1.1.2.1.1.3="%SMSA-E-POLLERR, Polling the SMSC was not successful." .1.3.6.1.4.1.3830.1.1.2.1.1.4="OPCOM" .1.3.6.1.4.1.3830.1.1.2.1.1.5="28-OCT-2010 20:42:14.67" .1.3.6.1.4.1.3830.1.1.2.1.1.6="SMRL51" } } 
-       MPLS extension v0 packet not supported
+       ICMP Multi-Part extension v0 packet not supported
index d6ba88900af8ab2e6dd1e5771f28660057d2e393..7c263c26caefd157847318d12848abe9ce7a5267 100644 (file)
@@ -2,6 +2,6 @@
     10.0.12.2 > 10.0.12.1: ICMP time exceeded in-transit, length 8340
        (tos 0x0, ttl 1, id 2574, offset 0, flags [none], proto UDP (17), length 28)
     10.0.12.1.49215 > 10.255.255.4.33435: [udp sum ok] UDP, length 0
-       MPLS extension v2
+       ICMP Multi-Part extension v2
          MPLS Stack Entry Object (1), Class-Type: 1, length 8
            label 16, tc 0, [S], ttl 1 [|icmp]
index d92fa5a696d7ad167f0e4c3d92f75f452bcb065c..d6f09ba56a955e62fc989dffbbee38b5f8a441df 100644 (file)
@@ -5,7 +5,7 @@
     10.5.0.1 > 12.4.4.4: ICMP time exceeded in-transit, length 148
        IP (tos 0x0, ttl 1, id 42316, offset 0, flags [none], proto UDP (17), length 40)
     12.4.4.4.42315 > 12.1.1.1.33435: UDP, length 12
-       MPLS extension v2, checksum 0xc55f (correct), length 12
+       ICMP Multi-Part extension v2, checksum 0xc55f (correct), length 12
          MPLS Stack Entry Object (1), Class-Type: 1, length 8
            label 100704, tc 0, [S], ttl 1
     3  10:13:29.319182 MPLS (label 100704, tc 0, [S], ttl 1)
@@ -15,7 +15,7 @@
     10.5.0.1 > 12.4.4.4: ICMP time exceeded in-transit, length 148
        IP (tos 0x0, ttl 1, id 42317, offset 0, flags [none], proto UDP (17), length 40)
     12.4.4.4.42315 > 12.1.1.1.33436: UDP, length 12
-       MPLS extension v2, checksum 0xc55f (correct), length 12
+       ICMP Multi-Part extension v2, checksum 0xc55f (correct), length 12
          MPLS Stack Entry Object (1), Class-Type: 1, length 8
            label 100704, tc 0, [S], ttl 1
     5  10:13:29.326697 MPLS (label 100704, tc 0, [S], ttl 1)
@@ -25,7 +25,7 @@
     10.5.0.1 > 12.4.4.4: ICMP time exceeded in-transit, length 148
        IP (tos 0x0, ttl 1, id 42318, offset 0, flags [none], proto UDP (17), length 40)
     12.4.4.4.42315 > 12.1.1.1.33437: UDP, length 12
-       MPLS extension v2, checksum 0xc55f (correct), length 12
+       ICMP Multi-Part extension v2, checksum 0xc55f (correct), length 12
          MPLS Stack Entry Object (1), Class-Type: 1, length 8
            label 100704, tc 0, [S], ttl 1
     7  10:13:29.327769 MPLS (label 100704, tc 0, [S], ttl 2)
@@ -35,7 +35,7 @@
     10.4.0.2 > 12.4.4.4: ICMP time exceeded in-transit, length 148
        IP (tos 0x0, ttl 1, id 42319, offset 0, flags [none], proto UDP (17), length 40)
     12.4.4.4.42315 > 12.1.1.1.33438: UDP, length 12
-       MPLS extension v2, checksum 0xc4e4 (correct), length 12
+       ICMP Multi-Part extension v2, checksum 0xc4e4 (correct), length 12
          MPLS Stack Entry Object (1), Class-Type: 1, length 8
            label 102672, tc 0, [S], ttl 1
     9  10:13:29.330110 MPLS (label 100704, tc 0, [S], ttl 2)
@@ -45,7 +45,7 @@
     10.4.0.2 > 12.4.4.4: ICMP time exceeded in-transit, length 148
        IP (tos 0x0, ttl 1, id 42320, offset 0, flags [none], proto UDP (17), length 40)
     12.4.4.4.42315 > 12.1.1.1.33439: UDP, length 12
-       MPLS extension v2, checksum 0xc4e4 (correct), length 12
+       ICMP Multi-Part extension v2, checksum 0xc4e4 (correct), length 12
          MPLS Stack Entry Object (1), Class-Type: 1, length 8
            label 102672, tc 0, [S], ttl 1
    11  10:13:29.331066 MPLS (label 100704, tc 0, [S], ttl 2)
@@ -55,7 +55,7 @@
     10.4.0.2 > 12.4.4.4: ICMP time exceeded in-transit, length 148
        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
-       MPLS extension v2, checksum 0xc4e4 (correct), length 12
+       ICMP Multi-Part extension v2, checksum 0xc4e4 (correct), length 12
          MPLS Stack Entry Object (1), Class-Type: 1, length 8
            label 102672, tc 0, [S], ttl 1
    13  10:13:29.332494 MPLS (label 100704, tc 0, [S], ttl 3)