/* \summary: IPv6 header option printer */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "netdissect-stdinc.h"
ND_PRINT("(jumbo: %u - already seen) ", jumbolen);
} else {
found_jumbo = 1;
- if (*payload_len != 0) {
+ if (payload_len == NULL) {
+ /* Not a hop-by-hop option - not valid */
+ if (ndo->ndo_vflag)
+ ND_PRINT("(jumbo: %u - not a hop-by-hop option) ", jumbolen);
+ } else if (*payload_len != 0) {
/* Payload length was non-zero - not valid */
if (ndo->ndo_vflag)
ND_PRINT("(jumbo: %u - payload len != 0) ", jumbolen);
} else {
- /* Payload length was zero in the IPv6 header */
+ /*
+ * This is a hop-by-hop option, and Payload length
+ * was zero in the IPv6 header.
+ */
if (jumbolen < 65536) {
/* Too short */
if (ndo->ndo_vflag)
const struct ip6_hbh *dp = (const struct ip6_hbh *)bp;
u_int hbhlen = 0;
- ndo->ndo_protocol = "hbhopt";
- ND_TCHECK_1(dp->ip6h_len);
+ ndo->ndo_protocol = "hbh";
hbhlen = (GET_U_1(dp->ip6h_len) + 1) << 3;
ND_TCHECK_LEN(dp, hbhlen);
- ND_PRINT("HBH ");
+ nd_print_protocol_caps(ndo);
+ ND_PRINT(" ");
if (ip6_opt_process(ndo, (const u_char *)dp + sizeof(*dp),
hbhlen - sizeof(*dp), found_jumbo, jumbolen) == -1)
goto trunc;
{
const struct ip6_dest *dp = (const struct ip6_dest *)bp;
u_int dstoptlen = 0;
- int found_jumbo;
- uint32_t jumbolen;
ndo->ndo_protocol = "dstopt";
- ND_TCHECK_1(dp->ip6d_len);
dstoptlen = (GET_U_1(dp->ip6d_len) + 1) << 3;
ND_TCHECK_LEN(dp, dstoptlen);
- ND_PRINT("DSTOPT ");
+ nd_print_protocol_caps(ndo);
+ ND_PRINT(" ");
if (ndo->ndo_vflag) {
/*
- * The Jumbo Payload option is a hop-by-hop option; we print,
- * but don't honor, Jumbo Payload destination options.
+ * The Jumbo Payload option is a hop-by-hop option; we don't
+ * honor Jumbo Payload destination options, reporting them
+ * as invalid.
*/
if (ip6_opt_process(ndo, (const u_char *)dp + sizeof(*dp),
- dstoptlen - sizeof(*dp), &found_jumbo,
- &jumbolen) == -1)
+ dstoptlen - sizeof(*dp), NULL, NULL) == -1)
goto trunc;
}