extern int nd_printn(netdissect_options *, const u_char *, u_int, const u_char *);
extern void nd_printjn(netdissect_options *, const u_char *, u_int);
extern void nd_printjnp(netdissect_options *, const u_char *, u_int);
+extern void nd_print_bytes_hex(netdissect_options *, const u_char *, u_int);
/*
* Flags for txtproto_print().
#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
{ 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"},
{ 0, NULL }
};
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);
icmpv6_nodeinfo_replyipv4 icmpv6_nodeinfo_replyipv4.pcap icmpv6_nodeinfo_replyipv4.out -v
icmpv6_nodeinfo_queryipv6 icmpv6_nodeinfo_queryipv6.pcap icmpv6_nodeinfo_queryipv6.out -v
icmpv6_nodeinfo_replyipv6 icmpv6_nodeinfo_replyipv6.pcap icmpv6_nodeinfo_replyipv6.out -v
+icmpv6-ns-nonce-v0 icmpv6-ns-nonce.pcap icmpv6-ns-nonce-v0.out
+icmpv6-ns-nonce-v1 icmpv6-ns-nonce.pcap icmpv6-ns-nonce-v1.out -v
+icmpv6-ns-nonce-v2 icmpv6-ns-nonce.pcap icmpv6-ns-nonce-v2.out -vv
# SPB tests
spb spb.pcap spb.out
--- /dev/null
+ 1 2023-12-04 11:07:31.663323 IP6 :: > ff02::1:ffe1:f: ICMP6, neighbor solicitation, who has fe80::546f:f7ff:fee1:f, length 32
--- /dev/null
+ 1 2023-12-04 11:07:31.663323 IP6 (hlim 255, next-header ICMPv6 (58), payload length 32) :: > ff02::1:ffe1:f: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has fe80::546f:f7ff:fee1:f
+ nonce option (14), length 8 (1): 60 69 60 4c 0a aa
--- /dev/null
+ 1 2023-12-04 11:07:31.663323 IP6 (hlim 255, next-header ICMPv6 (58), payload length 32) :: > ff02::1:ffe1:f: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has fe80::546f:f7ff:fee1:f
+ nonce option (14), length 8 (1): 60 69 60 4c 0a aa
+ 0x0000: 6069 604c 0aaa
ND_PRINT(" (invalid)");
}
+/*
+ * Print a sequence of bytes, separated by a single space.
+ * Stop if truncated (via GET_U_1/longjmp) or after n bytes,
+ * whichever is first.
+ */
+void
+nd_print_bytes_hex(netdissect_options *ndo, const u_char *cp, u_int n)
+{
+ while (n > 0) {
+ ND_PRINT("%02x", GET_U_1(cp));
+ n--;
+ cp++;
+ if (n > 0)
+ ND_PRINT(" ");
+ }
+}
+
/*
* this is a generic routine for printing unknown data;
* we pass on the linefeed plus indentation string to