From: Nicholas Reilly Date: Wed, 31 Aug 2022 21:01:08 +0000 (-0400) Subject: ICMPv6: Fix the Node Information flags X-Git-Tag: tcpdump-4.99.2~34 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/1bd725d299385b114e9f167cdf717b2f6024af17?ds=sidebyside ICMPv6: Fix the Node Information flags Don't use htons() when defining the constants because the flags field is already eventually swapped by fetching with GET_BE_U_2(). Remove unused flags NI_SUPTYPE_FLAG_COMPRESS and NI_FQDN_FLAG_VALIDTTL. Add a test file with various NI_NODEADDR_FLAG* flags. (cherry picked from commit 425359f7b8e74a0f466ce05a2c24bddaee5c15a1) --- diff --git a/print-icmp6.c b/print-icmp6.c index 11c8677b..47690f5a 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -394,18 +394,13 @@ struct icmp6_nodeinfo { #define NI_QTYPE_NODEADDR 3 /* Node Addresses */ #define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */ -/* network endian */ -#define NI_SUPTYPE_FLAG_COMPRESS ((uint16_t)htons(0x1)) -#define NI_FQDN_FLAG_VALIDTTL ((uint16_t)htons(0x1)) - -/* network endian */ -#define NI_NODEADDR_FLAG_TRUNCATE ((uint16_t)htons(0x1)) -#define NI_NODEADDR_FLAG_ALL ((uint16_t)htons(0x2)) -#define NI_NODEADDR_FLAG_COMPAT ((uint16_t)htons(0x4)) -#define NI_NODEADDR_FLAG_LINKLOCAL ((uint16_t)htons(0x8)) -#define NI_NODEADDR_FLAG_SITELOCAL ((uint16_t)htons(0x10)) -#define NI_NODEADDR_FLAG_GLOBAL ((uint16_t)htons(0x20)) -#define NI_NODEADDR_FLAG_ANYCAST ((uint16_t)htons(0x40)) /* just experimental. not in spec */ +#define NI_NODEADDR_FLAG_TRUNCATE 0x0001 +#define NI_NODEADDR_FLAG_ALL 0x0002 +#define NI_NODEADDR_FLAG_COMPAT 0x0004 +#define NI_NODEADDR_FLAG_LINKLOCAL 0x0008 +#define NI_NODEADDR_FLAG_SITELOCAL 0x0010 +#define NI_NODEADDR_FLAG_GLOBAL 0x0020 +#define NI_NODEADDR_FLAG_ANYCAST 0x0040 /* just experimental. not in spec */ struct ni_reply_fqdn { nd_uint32_t ni_fqdn_ttl; /* TTL */ diff --git a/tests/TESTLIST b/tests/TESTLIST index 8090583b..2b009ef2 100644 --- a/tests/TESTLIST +++ b/tests/TESTLIST @@ -177,6 +177,7 @@ icmpv6-length-zero icmpv6-length-zero.pcapng icmpv6-length-zero.out icmpv6-rfc7112 icmpv6-rfc7112.pcap icmpv6-rfc7112.out icmpv6-RFC2894-RR icmpv6-RFC2894-RR.pcap icmpv6-RFC2894-RR.out icmpv6-RFC2894-RR-v icmpv6-RFC2894-RR.pcap icmpv6-RFC2894-RR-v.out -v +icmpv6-ni-flags icmpv6-ni-flags.pcap icmpv6-ni-flags.out # SPB tests spb spb.pcap spb.out diff --git a/tests/icmpv6-ni-flags.out b/tests/icmpv6-ni-flags.out new file mode 100644 index 00000000..f1c18baf --- /dev/null +++ b/tests/icmpv6-ni-flags.out @@ -0,0 +1,5 @@ + 1 13:56:00.443595 IP6 fe80::5054:ff:fe43:2ca8 > fe80::5054:ff:fe2c:3629: ICMP6, who-are-you request node information query (node addresses [A], subject=fe80::5054:ff:fe2c:3629), length 32 + 2 13:56:46.614177 IP6 fe80::5054:ff:fe43:2ca8 > fe80::5054:ff:fe2c:3629: ICMP6, who-are-you request node information query (node addresses [C], subject=fe80::5054:ff:fe2c:3629), length 32 + 3 13:57:14.854456 IP6 fe80::5054:ff:fe43:2ca8 > fe80::5054:ff:fe2c:3629: ICMP6, who-are-you request node information query (node addresses [L], subject=fe80::5054:ff:fe2c:3629), length 32 + 4 13:57:22.010951 IP6 fe80::5054:ff:fe43:2ca8 > fe80::5054:ff:fe2c:3629: ICMP6, who-are-you request node information query (node addresses [S], subject=fe80::5054:ff:fe2c:3629), length 32 + 5 13:57:41.727114 IP6 fe80::5054:ff:fe43:2ca8 > fe80::5054:ff:fe2c:3629: ICMP6, who-are-you request node information query (node addresses [G], subject=fe80::5054:ff:fe2c:3629), length 32 diff --git a/tests/icmpv6-ni-flags.pcap b/tests/icmpv6-ni-flags.pcap new file mode 100644 index 00000000..19615d57 Binary files /dev/null and b/tests/icmpv6-ni-flags.pcap differ