]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-icmp6.c
CI: Add warning exemptions for Sun C (suncc-5.14) on Solaris 10
[tcpdump] / print-icmp6.c
index 021d21461e68f8d06f6861ccdcff294985cbbd7a..66cfcb633ee031a57c405c3e4a883db51298972a 100644 (file)
@@ -21,9 +21,7 @@
 
 /* \summary: IPv6 Internet Control Message Protocol (ICMPv6) printer */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include "netdissect-stdinc.h"
 
 
 #include "ip6.h"
 #include "ipproto.h"
+#include "icmp.h"
 
 #include "udp.h"
 #include "ah.h"
 
-/*     NetBSD: icmp6.h,v 1.13 2000/08/03 16:30:37 itojun Exp   */
+/*     NetBSD: icmp6.h,v 1.13 2000/08/03 16:30:37 itojun Exp   */
 /*     $KAME: icmp6.h,v 1.22 2000/08/03 15:25:16 jinmei Exp $  */
 
 /*
@@ -94,6 +93,8 @@ struct icmp6_hdr {
 #define icmp6_id       icmp6_data16[0]         /* echo request/reply */
 #define icmp6_seq      icmp6_data16[1]         /* echo request/reply */
 #define icmp6_maxdelay icmp6_data16[0]         /* mcast group membership */
+#define icmp6_xseq     icmp6_data8[2]          /* extended echo request/reply */
+#define icmp6_xinfo    icmp6_data8[3]          /* extended echo request/reply */
 
 #define ICMP6_DST_UNREACH              1       /* dest unreachable, codes: */
 #define ICMP6_PACKET_TOO_BIG           2       /* packet too big */
@@ -102,11 +103,8 @@ struct icmp6_hdr {
 
 #define ICMP6_ECHO_REQUEST             128     /* echo service */
 #define ICMP6_ECHO_REPLY               129     /* echo reply */
-#define ICMP6_MEMBERSHIP_QUERY         130     /* group membership query */
-#define MLD6_LISTENER_QUERY            130     /* multicast listener query */
-#define ICMP6_MEMBERSHIP_REPORT                131     /* group membership report */
+#define MLD6_LISTENER_QUERY            130     /* multicast listener query */
 #define MLD6_LISTENER_REPORT           131     /* multicast listener report */
-#define ICMP6_MEMBERSHIP_REDUCTION     132     /* group membership termination */
 #define MLD6_LISTENER_DONE             132     /* multicast listener done */
 
 #define ND_ROUTER_SOLICIT              133     /* router solicitation */
@@ -117,11 +115,7 @@ struct icmp6_hdr {
 
 #define ICMP6_ROUTER_RENUMBERING       138     /* router renumbering */
 
-#define ICMP6_WRUREQUEST               139     /* who are you request */
-#define ICMP6_WRUREPLY                 140     /* who are you reply */
-#define ICMP6_FQDN_QUERY               139     /* FQDN query */
-#define ICMP6_FQDN_REPLY               140     /* FQDN reply */
-#define ICMP6_NI_QUERY                 139     /* node information request - RFC 4620 */
+#define ICMP6_NI_QUERY                 139     /* node information query - RFC 4620 */
 #define ICMP6_NI_REPLY                 140     /* node information reply - RFC 4620 */
 #define IND_SOLICIT                    141     /* inverse neighbor solicitation */
 #define IND_ADVERT                     142     /* inverse neighbor advertisement */
@@ -132,6 +126,8 @@ struct icmp6_hdr {
 #define ICMP6_HADISCOV_REPLY           145
 #define ICMP6_MOBILEPREFIX_SOLICIT     146
 #define ICMP6_MOBILEPREFIX_ADVERT      147
+#define        ICMP6_EXTENDED_ECHO_REQUEST     160     /* extended echo request */
+#define        ICMP6_EXTENDED_ECHO_REPLY       161     /* extended echo reply */
 
 #define MLD6_MTRACE_RESP               200     /* mtrace response(to sender) */
 #define MLD6_MTRACE                    201     /* mtrace messages */
@@ -145,10 +141,10 @@ struct icmp6_hdr {
 #define ICMP6_DST_UNREACH_ADDR         3       /* address unreachable */
 #define ICMP6_DST_UNREACH_NOPORT       4       /* port unreachable */
 
-#define ICMP6_TIME_EXCEED_TRANSIT      0       /* ttl==0 in transit */
+#define ICMP6_TIME_EXCEED_TRANSIT      0       /* ttl==0 in transit */
 #define ICMP6_TIME_EXCEED_REASSEMBLY   1       /* ttl==0 in reass */
 
-#define ICMP6_PARAMPROB_HEADER                 0       /* erroneous header field */
+#define ICMP6_PARAMPROB_HEADER         0       /* erroneous header field */
 #define ICMP6_PARAMPROB_NEXTHEADER     1       /* unrecognized next header */
 #define ICMP6_PARAMPROB_OPTION         2       /* unrecognized option */
 #define ICMP6_PARAMPROB_FRAGHDRCHAIN   3       /* incomplete header chain */
@@ -193,7 +189,7 @@ struct mld6_hdr {
  */
 
 struct nd_router_solicit {     /* router solicitation */
-       struct icmp6_hdr        nd_rs_hdr;
+       struct icmp6_hdr        nd_rs_hdr;
        /* could be followed by options */
 };
 
@@ -283,9 +279,11 @@ struct nd_opt_hdr {                /* Neighbor discovery option header */
 #define ND_OPT_MTU                     5
 #define ND_OPT_ADVINTERVAL             7
 #define ND_OPT_HOMEAGENT_INFO          8
+#define ND_OPT_NONCE                   14
 #define ND_OPT_ROUTE_INFO              24      /* RFC4191 */
 #define ND_OPT_RDNSS                   25
 #define ND_OPT_DNSSL                   31
+#define ND_OPT_PREF64_INFORMATION      38      /* RFC8781 */
 
 struct nd_opt_prefix_info {    /* prefix information */
        nd_uint8_t      nd_opt_pi_type;
@@ -357,6 +355,13 @@ struct nd_opt_route_info { /* route info */
        /* prefix follows */
 };
 
+struct nd_opt_pref64 {         /* PREF64 option */
+       nd_uint8_t      nd_opt_pref64_type;
+       nd_uint8_t      nd_opt_pref64_len;
+       nd_uint16_t     nd_opt_pref64_slplc; /* 13bit lft + 3bit PLC */
+       nd_uint32_t     nd_opt_pref64_words[3]; /* highest 96 bits of prefix */
+};
+
 /*
  * icmp6 namelookup
  */
@@ -387,25 +392,34 @@ struct icmp6_nodeinfo {
 #define ni_qtype       icmp6_ni_hdr.icmp6_data16[0]
 #define ni_flags       icmp6_ni_hdr.icmp6_data16[1]
 
-#define NI_QTYPE_NOOP          0 /* NOOP  */
-#define NI_QTYPE_SUPTYPES      1 /* Supported Qtypes (drafts up to 09) */
-#define NI_QTYPE_FQDN          2 /* FQDN (draft 04) */
-#define NI_QTYPE_DNSNAME       2 /* DNS Name */
+#define NI_QTYPE_NOOP          0 /* NOOP */
+#define NI_QTYPE_SUPTYPES      1 /* Supported Qtypes (Obsolete) */
+#define NI_QTYPE_NODENAME      2 /* Node Name */
 #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))
+#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
+
+static const struct tok ni_nodeaddr_flag_values[] = {
+        { NI_NODEADDR_FLAG_TRUNCATE, "T" },
+        { NI_NODEADDR_FLAG_ALL, "A" },
+        { NI_NODEADDR_FLAG_COMPAT, "C" },
+        { NI_NODEADDR_FLAG_LINKLOCAL, "L" },
+        { NI_NODEADDR_FLAG_SITELOCAL, "S" },
+        { NI_NODEADDR_FLAG_GLOBAL, "G" },
+        { 0, NULL }
+};
 
-/* 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 */
+static const struct tok ni_ipv4addr_flag_values[] = {
+        { NI_NODEADDR_FLAG_TRUNCATE, "T" },
+        { NI_NODEADDR_FLAG_ALL, "A" },
+        { 0, NULL }
+};
 
 struct ni_reply_fqdn {
        nd_uint32_t ni_fqdn_ttl;        /* TTL */
@@ -429,10 +443,19 @@ struct icmp6_router_renum {       /* router renumbering header */
 #define ICMP6_RR_FLAGS_SPECSITE                0x10
 #define ICMP6_RR_FLAGS_PREVDONE                0x08
 
+static const struct tok router_renum_flag_values[] = {
+       { ICMP6_RR_FLAGS_TEST, "T" },
+       { ICMP6_RR_FLAGS_REQRESULT, "R" },
+       { ICMP6_RR_FLAGS_FORCEAPPLY, "A" },
+       { ICMP6_RR_FLAGS_SPECSITE, "S" },
+       { ICMP6_RR_FLAGS_PREVDONE, "P" },
+       { 0, NULL },
+};
+
 #define rr_type                rr_hdr.icmp6_type
 #define rr_code                rr_hdr.icmp6_code
 #define rr_cksum       rr_hdr.icmp6_cksum
-#define rr_seqnum      rr_hdr.icmp6_data32[0]
+#define rr_seqnum      rr_hdr.icmp6_data32[0]
 
 struct rr_pco_match {          /* match prefix part */
        nd_uint8_t              rpm_code;
@@ -480,6 +503,7 @@ struct rr_result {          /* router renumbering result message */
 
 static const char *get_rtpref(u_int);
 static const char *get_lifetime(uint32_t);
+static const char *get_pref64_len_repr(uint16_t);
 static void print_lladdr(netdissect_options *ndo, const u_char *, size_t);
 static int icmp6_opt_print(netdissect_options *ndo, const u_char *, int);
 static void mld6_print(netdissect_options *ndo, const u_char *);
@@ -490,10 +514,6 @@ static void dnsname_print(netdissect_options *ndo, const u_char *, const u_char
 static void icmp6_nodeinfo_print(netdissect_options *ndo, u_int, const u_char *, const u_char *);
 static void icmp6_rrenum_print(netdissect_options *ndo, const u_char *, const u_char *);
 
-#ifndef abs
-#define abs(a) ((0 < (a)) ? (a) : -(a))
-#endif
-
 /*
  * DIO: Updated to RFC6550, as published in 2012: section 6. (page 30)
  */
@@ -535,7 +555,7 @@ struct nd_rpl_security {
 #endif
 };
 
-/* section 6.2.1, DODAG Information Solication (DIS_IS) */
+/* section 6.2.1, DODAG Information Solicitation (DIS_IS) */
 struct nd_rpl_dis_is {
     nd_uint8_t rpl_dis_flags;
     nd_uint8_t rpl_dis_reserved;
@@ -670,13 +690,13 @@ static const struct tok icmp6_type_values[] = {
     { ICMP6_HADISCOV_REPLY, "ha discovery reply"},
     { ICMP6_MOBILEPREFIX_SOLICIT, "mobile router solicitation"},
     { ICMP6_MOBILEPREFIX_ADVERT, "mobile router advertisement"},
-    { ICMP6_WRUREQUEST, "who-are-you request"},
-    { ICMP6_WRUREPLY, "who-are-you reply"},
     { ICMP6_NI_QUERY, "node information query"},
     { ICMP6_NI_REPLY, "node information reply"},
     { MLD6_MTRACE, "mtrace message"},
     { MLD6_MTRACE_RESP, "mtrace response"},
     { ND_RPL_MESSAGE,   "RPL"},
+    { ICMP6_EXTENDED_ECHO_REQUEST, "extended echo request"},
+    { ICMP6_EXTENDED_ECHO_REPLY, "extended echo reply"},
     { 0,       NULL }
 };
 
@@ -711,7 +731,6 @@ static const struct tok icmp6_nd_na_flag_values[] = {
     { 0,       NULL }
 };
 
-
 static const struct tok icmp6_opt_values[] = {
    { ND_OPT_SOURCE_LINKADDR, "source link-address"},
    { ND_OPT_TARGET_LINKADDR, "destination link-address"},
@@ -722,7 +741,9 @@ static const struct tok icmp6_opt_values[] = {
    { ND_OPT_DNSSL, "dnssl"},
    { ND_OPT_ADVINTERVAL, "advertisement interval"},
    { ND_OPT_HOMEAGENT_INFO, "homeagent information"},
+   { ND_OPT_NONCE, "nonce"},
    { ND_OPT_ROUTE_INFO, "route info"},
+   { ND_OPT_PREF64_INFORMATION, "pref64"},
    { 0,        NULL }
 };
 
@@ -763,6 +784,20 @@ get_lifetime(uint32_t v)
        }
 }
 
+static const char *
+get_pref64_len_repr(uint16_t v)
+{
+       static const char *prefixlen_str[] = {
+               "96", "64", "56", "48", "40", "32"
+       };
+
+       v = v & 0x0007;
+       if (v < 6)
+               return prefixlen_str[v];
+       else
+               return "??";
+}
+
 static void
 print_lladdr(netdissect_options *ndo, const uint8_t *p, size_t l)
 {
@@ -821,15 +856,15 @@ rpl_printopts(netdissect_options *ndo, const uint8_t *opts, u_int length)
                         optlen = 1;
                         ND_PRINT(" opt:pad1");
                 } else {
-                       if (length < RPL_GENOPTION_LEN)
-                               goto trunc;
+                       if (length < RPL_GENOPTION_LEN)
+                               goto trunc;
                        optlen = GET_U_1(opt->rpl_dio_len)+RPL_GENOPTION_LEN;
                         ND_PRINT(" opt:%s len:%u ",
                                   tok2str(rpl_subopt_values, "subopt:%u", dio_type),
                                   optlen);
                         ND_TCHECK_LEN(opt, optlen);
                         if (length < optlen)
-                               goto trunc;
+                               goto trunc;
                         if (ndo->ndo_vflag > 2) {
                                 hex_print(ndo,
                                           " ",
@@ -997,7 +1032,6 @@ trunc:
 
 }
 
-
 void
 icmp6_print(netdissect_options *ndo,
             const u_char *bp, u_int length, const u_char *bp2, int fragmented)
@@ -1147,7 +1181,7 @@ icmp6_print(netdissect_options *ndo,
                 ND_PRINT(", id %u, seq %u", GET_BE_U_2(dp->icmp6_id),
                         GET_BE_U_2(dp->icmp6_seq));
                break;
-       case ICMP6_MEMBERSHIP_QUERY:
+       case MLD6_LISTENER_QUERY:
                if (length == MLD_MINLEN) {
                        mld6_print(ndo, (const u_char *)dp);
                } else if (length >= MLDV2_MINLEN) {
@@ -1157,10 +1191,10 @@ icmp6_print(netdissect_options *ndo,
                         ND_PRINT(" unknown-version (len %u) ", length);
                }
                break;
-       case ICMP6_MEMBERSHIP_REPORT:
+       case MLD6_LISTENER_REPORT:
                mld6_print(ndo, (const u_char *)dp);
                break;
-       case ICMP6_MEMBERSHIP_REDUCTION:
+       case MLD6_LISTENER_DONE:
                mld6_print(ndo, (const u_char *)dp);
                break;
        case ND_ROUTER_SOLICIT:
@@ -1264,7 +1298,8 @@ icmp6_print(netdissect_options *ndo,
 
                        ND_PRINT(", id 0x%04x",
                                 GET_BE_U_2(dp->icmp6_data16[0]));
-                       cp = (const u_char *)dp + length;
+                       cp = (const u_char *)dp +
+                               ND_MIN(length, ND_BYTES_AVAILABLE_AFTER(dp));
                        p = (const u_char *)(dp + 1);
                        while (p < cp) {
                                ND_PRINT(", %s", GET_IP6ADDR_STRING(p));
@@ -1295,6 +1330,17 @@ icmp6_print(netdissect_options *ndo,
                 /* plus 4, because struct icmp6_hdr contains 4 bytes of icmp payload */
                 rpl_print(ndo, icmp6_code, dp->icmp6_data, length-sizeof(struct icmp6_hdr)+4);
                 break;
+       case ICMP6_EXTENDED_ECHO_REQUEST:
+       case ICMP6_EXTENDED_ECHO_REPLY:
+               ND_PRINT(", id %u, seq %u", GET_BE_U_2(dp->icmp6_id),
+                       GET_U_1(dp->icmp6_xseq));
+               // The content of the message is the same as ICMP, so use the
+               // function defined in print-icmp.c
+               if (ndo->ndo_vflag) {
+                       uint8_t xinfo = GET_U_1(dp->icmp6_xinfo);
+                       print_icmp_rfc8335(ndo, xinfo, icmp6_type == ICMP6_EXTENDED_ECHO_REQUEST, icmp6_code, dp->icmp6_data + 4);
+               }
+               break;
        default:
                 ND_PRINT(", length %u", length);
                 if (ndo->ndo_vflag <= 1)
@@ -1339,8 +1385,7 @@ get_upperlayer(netdissect_options *ndo, const u_char *bp, u_int *prot)
                        if (ND_TTEST_2(uh->uh_dport)) {
                                *prot = nh;
                                return(uh);
-                       }
-                       else
+                       } else
                                return(NULL);
                        /* NOTREACHED */
 
@@ -1395,10 +1440,12 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
        const struct nd_opt_advinterval *opa;
        const struct nd_opt_homeagent_info *oph;
        const struct nd_opt_route_info *opri;
+       const struct nd_opt_pref64 *op64;
        const u_char *cp, *ep, *domp;
        nd_ipv6 in6;
        size_t l;
        u_int i;
+       uint16_t w;
 
        cp = bp;
        /* 'ep' points to the end of available data. */
@@ -1468,8 +1515,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
                        ND_PRINT(" lifetime %us, domain(s):",
                                   GET_BE_U_4(opds->nd_opt_dnssl_lifetime));
                        domp = cp + 8; /* domain names, variable-sized, RFC1035-encoded */
-                       while (domp < cp + (opt_len << 3) && GET_U_1(domp) != '\0')
-                       {
+                       while (domp < cp + (opt_len << 3) && GET_U_1(domp) != '\0') {
                                ND_PRINT(" ");
                                if ((domp = fqdn_print(ndo, domp, bp)) == NULL)
                                        goto trunc;
@@ -1486,6 +1532,10 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
                                   GET_BE_U_2(oph->nd_opt_hai_preference),
                                   GET_BE_U_2(oph->nd_opt_hai_lifetime));
                        break;
+               case ND_OPT_NONCE:
+                       l = (opt_len << 3) - 2;
+                       nd_print_bytes_hex(ndo, cp + 2, l);
+                       break;
                case ND_OPT_ROUTE_INFO:
                        opri = (const struct nd_opt_route_info *)op;
                        ND_TCHECK_4(opri->nd_opt_rti_lifetime);
@@ -1502,13 +1552,27 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
                        default:
                                goto trunc;
                        }
-                       ND_PRINT(" %s/%u", ip6addr_string(ndo, (const u_char *)&in6),
+                       ND_PRINT(" %s/%u", ip6addr_string(ndo, (const u_char *)&in6), /* local buffer, not packet data; don't use GET_IP6ADDR_STRING() */
                                   GET_U_1(opri->nd_opt_rti_prefixlen));
                        ND_PRINT(", pref=%s",
                                 get_rtpref(GET_U_1(opri->nd_opt_rti_flags)));
                        ND_PRINT(", lifetime=%s",
                                   get_lifetime(GET_BE_U_4(opri->nd_opt_rti_lifetime)));
                        break;
+               case ND_OPT_PREF64_INFORMATION:
+                       op64 = (const struct nd_opt_pref64 *)op;
+                       if (opt_len != 2)
+                               ND_PRINT("%s", "bad option length! ");
+                       w = GET_BE_U_2(op64->nd_opt_pref64_slplc);
+                       memset(&in6, 0, sizeof(in6));
+                       GET_CPY_BYTES(&in6, op64->nd_opt_pref64_words,
+                                      sizeof(op64->nd_opt_pref64_words));
+                       ND_PRINT("%s/%s (plc %u), lifetime %us",
+                                 ip6addr_string(ndo, (const u_char *)&in6),
+                                 get_pref64_len_repr(w),
+                                 w & 0x0007,
+                                 w & 0xfff8);
+                       break;
                default:
                         if (ndo->ndo_vflag <= 1) {
                                 print_unknown_data(ndo,cp+2,"\n\t  ", (opt_len << 3) - 2); /* skip option header */
@@ -1696,6 +1760,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
        const struct icmp6_hdr *dp;
        const u_char *cp;
        size_t siz, i;
+       uint16_t flags;
        int needcomma;
 
        if (ep < bp)
@@ -1711,7 +1776,6 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
                        ND_PRINT(" who-are-you request");
                        break;
                }
-               ND_PRINT(" node information query");
 
                ND_TCHECK_LEN(dp, sizeof(*ni6));
                ni6 = (const struct icmp6_nodeinfo *)dp;
@@ -1720,36 +1784,35 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
                case NI_QTYPE_NOOP:
                        ND_PRINT("noop");
                        break;
-               case NI_QTYPE_SUPTYPES:
-                       ND_PRINT("supported qtypes");
-                       i = GET_BE_U_2(ni6->ni_flags);
-                       if (i)
-                               ND_PRINT(" [%s]", (i & 0x01) ? "C" : "");
-                       break;
-               case NI_QTYPE_FQDN:
-                       ND_PRINT("DNS name");
+               case NI_QTYPE_NODENAME:
+                       ND_PRINT("node name");
                        break;
                case NI_QTYPE_NODEADDR:
                        ND_PRINT("node addresses");
-                       i = GET_BE_U_2(ni6->ni_flags);
-                       if (!i)
-                               break;
-                       /* NI_NODEADDR_FLAG_TRUNCATE undefined for query */
-                       ND_PRINT(" [%s%s%s%s%s%s]",
-                           (i & NI_NODEADDR_FLAG_ANYCAST) ? "a" : "",
-                           (i & NI_NODEADDR_FLAG_GLOBAL) ? "G" : "",
-                           (i & NI_NODEADDR_FLAG_SITELOCAL) ? "S" : "",
-                           (i & NI_NODEADDR_FLAG_LINKLOCAL) ? "L" : "",
-                           (i & NI_NODEADDR_FLAG_COMPAT) ? "C" : "",
-                           (i & NI_NODEADDR_FLAG_ALL) ? "A" : "");
+                       flags = GET_BE_U_2(ni6->ni_flags);
+                       if (flags)
+                               ND_PRINT(" [%s]",
+                                        bittok2str_nosep(ni_nodeaddr_flag_values,
+                                        "none", flags));
+                       if (flags & NI_NODEADDR_FLAG_TRUNCATE)
+                               ND_PRINT(" [invalid flag Truncate present]");
+                       break;
+               case NI_QTYPE_IPV4ADDR:
+                       ND_PRINT("ipv4 addresses");
+                       flags = GET_BE_U_2(ni6->ni_flags);
+                       if (flags)
+                               ND_PRINT(" [%s]",
+                                        bittok2str_nosep(ni_ipv4addr_flag_values,
+                                        "none", flags));
+                       if (flags & NI_NODEADDR_FLAG_TRUNCATE)
+                               ND_PRINT(" [invalid flag Truncate present]");
                        break;
                default:
                        ND_PRINT("unknown");
                        break;
                }
 
-               if (GET_BE_U_2(ni6->ni_qtype) == NI_QTYPE_NOOP ||
-                   GET_BE_U_2(ni6->ni_qtype) == NI_QTYPE_SUPTYPES) {
+               if (GET_BE_U_2(ni6->ni_qtype) == NI_QTYPE_NOOP) {
                        if (siz != sizeof(*ni6))
                                if (ndo->ndo_vflag)
                                        ND_PRINT(", invalid len");
@@ -1758,15 +1821,6 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
                        break;
                }
 
-
-               /* XXX backward compat, icmp-name-lookup-03 */
-               if (siz == sizeof(*ni6)) {
-                       ND_PRINT(", 03 draft");
-                       /*(*/
-                       ND_PRINT(")");
-                       break;
-               }
-
                cp = (const u_char *)(ni6 + 1);
                switch (GET_U_1(ni6->ni_code)) {
                case ICMP6_NI_SUBJ_IPV6:
@@ -1782,19 +1836,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
                        break;
                case ICMP6_NI_SUBJ_FQDN:
                        ND_PRINT(", subject=DNS name");
-                       if (GET_U_1(cp) == ep - cp - 1) {
-                               /* icmp-name-lookup-03, pascal string */
-                               if (ndo->ndo_vflag)
-                                       ND_PRINT(", 03 draft");
-                               cp++;
-                               ND_PRINT(", \"");
-                               while (cp < ep) {
-                                       fn_print_char(ndo, GET_U_1(cp));
-                                       cp++;
-                               }
-                               ND_PRINT("\"");
-                       } else
-                               dnsname_print(ndo, cp, ep);
+                       dnsname_print(ndo, cp, ep);
                        break;
                case ICMP6_NI_SUBJ_IPV4:
                        if (!ND_TTEST_LEN(dp, sizeof(*ni6) + sizeof(nd_ipv4)))
@@ -1824,7 +1866,6 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
 
                ND_TCHECK_LEN(dp, sizeof(*ni6));
                ni6 = (const struct icmp6_nodeinfo *)dp;
-               ND_PRINT(" node information reply");
                ND_PRINT(" ("); /*)*/
                switch (GET_U_1(ni6->ni_code)) {
                case ICMP6_NI_SUCCESS:
@@ -1864,32 +1905,12 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
                                if (ndo->ndo_vflag)
                                        ND_PRINT(", invalid length");
                        break;
-               case NI_QTYPE_SUPTYPES:
-                       if (needcomma)
-                               ND_PRINT(", ");
-                       ND_PRINT("supported qtypes");
-                       i = GET_BE_U_2(ni6->ni_flags);
-                       if (i)
-                               ND_PRINT(" [%s]", (i & 0x01) ? "C" : "");
-                       break;
-               case NI_QTYPE_FQDN:
+               case NI_QTYPE_NODENAME:
                        if (needcomma)
                                ND_PRINT(", ");
-                       ND_PRINT("DNS name");
+                       ND_PRINT("node name");
                        cp = (const u_char *)(ni6 + 1) + 4;
-                       if (GET_U_1(cp) == ep - cp - 1) {
-                               /* icmp-name-lookup-03, pascal string */
-                               if (ndo->ndo_vflag)
-                                       ND_PRINT(", 03 draft");
-                               cp++;
-                               ND_PRINT(", \"");
-                               while (cp < ep) {
-                                       fn_print_char(ndo, GET_U_1(cp));
-                                       cp++;
-                               }
-                               ND_PRINT("\"");
-                       } else
-                               dnsname_print(ndo, cp, ep);
+                       dnsname_print(ndo, cp, ep);
                        if ((GET_BE_U_2(ni6->ni_flags) & 0x01) != 0)
                                ND_PRINT(" [TTL=%u]", GET_BE_U_4(ni6 + 1));
                        break;
@@ -1897,6 +1918,11 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
                        if (needcomma)
                                ND_PRINT(", ");
                        ND_PRINT("node addresses");
+                       flags = GET_BE_U_2(ni6->ni_flags);
+                       if (flags)
+                               ND_PRINT(" [%s]",
+                                        bittok2str_nosep(ni_nodeaddr_flag_values,
+                                        "none", flags));
                        i = sizeof(*ni6);
                        while (i < siz) {
                                if (i + sizeof(uint32_t) + sizeof(nd_ipv6) > siz)
@@ -1906,17 +1932,25 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
                                    GET_BE_U_4(bp + i));
                                i += sizeof(uint32_t) + sizeof(nd_ipv6);
                        }
-                       i = GET_BE_U_2(ni6->ni_flags);
-                       if (!i)
-                               break;
-                       ND_PRINT(" [%s%s%s%s%s%s%s]",
-                                  (i & NI_NODEADDR_FLAG_ANYCAST) ? "a" : "",
-                                  (i & NI_NODEADDR_FLAG_GLOBAL) ? "G" : "",
-                                  (i & NI_NODEADDR_FLAG_SITELOCAL) ? "S" : "",
-                                  (i & NI_NODEADDR_FLAG_LINKLOCAL) ? "L" : "",
-                                  (i & NI_NODEADDR_FLAG_COMPAT) ? "C" : "",
-                                  (i & NI_NODEADDR_FLAG_ALL) ? "A" : "",
-                                  (i & NI_NODEADDR_FLAG_TRUNCATE) ? "T" : "");
+                       break;
+               case NI_QTYPE_IPV4ADDR:
+                       if (needcomma)
+                               ND_PRINT(", ");
+                       ND_PRINT("ipv4 addresses");
+                       flags = GET_BE_U_2(ni6->ni_flags);
+                       if (flags)
+                               ND_PRINT(" [%s]",
+                                        bittok2str_nosep(ni_nodeaddr_flag_values,
+                                        "none", flags));
+                       cp = (const u_char *)(ni6 + 1);
+                       while (cp < ep) {
+                               uint32_t ttl;
+
+                               ttl = GET_BE_U_4(cp);
+                               cp += 4;
+                               ND_PRINT(" %s(%u)", GET_IPADDR_STRING(cp), ttl);
+                               cp += 4;
+                       }
                        break;
                default:
                        if (needcomma)
@@ -1953,16 +1987,16 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep)
        ND_TCHECK_4(rr6->rr_reserved);
        switch (GET_U_1(rr6->rr_code)) {
        case ICMP6_ROUTER_RENUMBERING_COMMAND:
-               ND_PRINT("router renum: command");
+               ND_PRINT(", command");
                break;
        case ICMP6_ROUTER_RENUMBERING_RESULT:
-               ND_PRINT("router renum: result");
+               ND_PRINT(", result");
                break;
        case ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET:
-               ND_PRINT("router renum: sequence number reset");
+               ND_PRINT(", sequence number reset");
                break;
        default:
-               ND_PRINT("router renum: code-#%u", GET_U_1(rr6->rr_code));
+               ND_PRINT(", code-#%u", GET_U_1(rr6->rr_code));
                break;
        }
 
@@ -1970,14 +2004,11 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep)
 
        if (ndo->ndo_vflag) {
                uint8_t rr_flags = GET_U_1(rr6->rr_flags);
-#define F(x, y)        (rr_flags & (x) ? (y) : "")
                ND_PRINT("[");  /*]*/
                if (rr_flags) {
-                       ND_PRINT("%s%s%s%s%s,", F(ICMP6_RR_FLAGS_TEST, "T"),
-                                  F(ICMP6_RR_FLAGS_REQRESULT, "R"),
-                                  F(ICMP6_RR_FLAGS_FORCEAPPLY, "A"),
-                                  F(ICMP6_RR_FLAGS_SPECSITE, "S"),
-                                  F(ICMP6_RR_FLAGS_PREVDONE, "P"));
+                       ND_PRINT("%s,",
+                                bittok2str_nosep(router_renum_flag_values,
+                                "none", rr_flags));
                }
                 ND_PRINT("seg=%u,", GET_U_1(rr6->rr_segnum));
                 ND_PRINT("maxdelay=%u", GET_BE_U_2(rr6->rr_maxdelay));
@@ -1985,7 +2016,6 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep)
                        ND_PRINT("rsvd=0x%x", GET_BE_U_4(rr6->rr_reserved));
                /*[*/
                ND_PRINT("]");
-#undef F
        }
 
        if (GET_U_1(rr6->rr_code) == ICMP6_ROUTER_RENUMBERING_COMMAND) {