diff options
author | Guy Harris <guy@alum.mit.edu> | 2019-05-02 20:01:08 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2019-05-02 20:01:08 -0700 |
commit | db7a7633e65ea66dacb40450d375c00d3f305408 (patch) | |
tree | 6d8da3ecab6410b63fe0df8bc1975fa190d46854 /netdissect.c | |
parent | 809b5408d0f38679fe5a5cd43c2e3ad26401d293 (diff) | |
download | tcpdump-db7a7633e65ea66dacb40450d375c00d3f305408.tar.gz |
Handle the IPv6 Jumbo Payload option.
If we see one when processing the hop-by-hop extension header, use it to
set the payload length.
In UDP, if we have a zero length field in the UDP header, and the length
of the data handed to us is > 65535, treat that as a Jumbo Payload
packet.
Diffstat (limited to 'netdissect.c')
-rw-r--r-- | netdissect.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/netdissect.c b/netdissect.c index 15594de8..4d4a4a59 100644 --- a/netdissect.c +++ b/netdissect.c @@ -193,6 +193,27 @@ nd_push_snapend(netdissect_options *ndo, const u_char *new_snapend) return (1); /* success */ } +/* + * Change an already-pushed snapshot end. This may increase the + * snapshot end, as it may be used, for example, for a Jumbo Payload + * option in IPv6. It must not increase it past the snapshot length + * atop which the current one was pushed, however. + */ +void +nd_change_snapend(netdissect_options *ndo, const u_char *new_snapend) +{ + struct netdissect_saved_packet_info *ndspi; + + ndspi = ndo->ndo_packet_info_stack; + if (ndspi->ndspi_prev != NULL) { + if (new_snapend <= ndspi->ndspi_prev->ndspi_snapend) + ndo->ndo_snapend = new_snapend; + } else { + if (new_snapend < ndo->ndo_snapend) + ndo->ndo_snapend = new_snapend; + } +} + void nd_pop_packet_info(netdissect_options *ndo) { |