X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/9d046ee0503d4c8cbfcb200c88986de876f6cae7..a63600a1fc28dbc7ae7ce9f996829c49a25fb33c:/print-ip6opts.c diff --git a/print-ip6opts.c b/print-ip6opts.c index 3ac8addc..a78c76da 100644 --- a/print-ip6opts.c +++ b/print-ip6opts.c @@ -150,12 +150,19 @@ ip6_opt_process(netdissect_options *ndo, const u_char *bp, int len, 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) @@ -216,7 +223,6 @@ hbhopt_process(netdissect_options *ndo, const u_char *bp, int *found_jumbo, u_int hbhlen = 0; ndo->ndo_protocol = "hbhopt"; - ND_TCHECK_1(dp->ip6h_len); hbhlen = (GET_U_1(dp->ip6h_len) + 1) << 3; ND_TCHECK_LEN(dp, hbhlen); ND_PRINT("HBH "); @@ -235,22 +241,19 @@ dstopt_process(netdissect_options *ndo, const u_char *bp) { 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 "); 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; }