From: ishaangandhi Date: Tue, 24 Nov 2020 16:49:44 +0000 (-0500) Subject: Rename MPLS Extension to Multipart Extension X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/572f2e7cdf0e4bdf1592a5ca887c389d8d7c155d?ds=sidebyside Rename MPLS Extension to Multipart Extension --- diff --git a/print-icmp.c b/print-icmp.c index b0e13f4c..fe90aff0 100644 --- a/print-icmp.c +++ b/print-icmp.c @@ -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: diff --git a/tests/icmp-cksum-oobr-1.out b/tests/icmp-cksum-oobr-1.out index 94cdc77c..4e2b1c97 100644 --- a/tests/icmp-cksum-oobr-1.out +++ b/tests/icmp-cksum-oobr-1.out @@ -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 diff --git a/tests/icmp-cksum-oobr-2.out b/tests/icmp-cksum-oobr-2.out index bd271da0..ce5fc141 100644 --- a/tests/icmp-cksum-oobr-2.out +++ b/tests/icmp-cksum-oobr-2.out @@ -2,10 +2,10 @@ 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 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 0x0030: 6861 742d 7765 2d61 7265 2d6c 6f6f 6b69 0x0040: 6e67 2d66 6f72 2d5b 3a2d 295d [|icmp] + ICMP Multi-Part extension v2 + Interface Identification Object (2), Class-Type: 14, length 80 diff --git a/tests/icmp-cksum-oobr-3.out b/tests/icmp-cksum-oobr-3.out index 20377667..309afdbd 100644 --- a/tests/icmp-cksum-oobr-3.out +++ b/tests/icmp-cksum-oobr-3.out @@ -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 diff --git a/tests/icmp-cksum-oobr-4.out b/tests/icmp-cksum-oobr-4.out index d6ba8890..7c263c26 100644 --- a/tests/icmp-cksum-oobr-4.out +++ b/tests/icmp-cksum-oobr-4.out @@ -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] diff --git a/tests/mpls-traceroute-v.out b/tests/mpls-traceroute-v.out index d92fa5a6..d6f09ba5 100644 --- a/tests/mpls-traceroute-v.out +++ b/tests/mpls-traceroute-v.out @@ -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)