Skip to content

Commit 05831fa

Browse files
committed
ipv6: Support new BIG TCP without HBH
Currently, BIG TCP IPv6 inserts a hop-by-hop extension header with a jumbo payload option to reflect the real length of the packet bigger than 65535 bytes. New kernels will drop this extension header and just calculate the packet length from skb->len, like it's currently done for BIG TCP IPv4. Reflect the future kernel change in tcpdump and support parsing such packets. BIG TCP only sets payload_len = 0 when the actual payload length is 65536 or more. Check that explicitly, so that smaller packets with payload_len = 0 are still considered invalid, like in the test called icmpv6-length-zero. Do not check the transport protocol, though, because TCP may be inner in an encapsulated packet, e.g., in UDP-based tunnels, such as VXLAN and GENEVE. Signed-off-by: Maxim Mikityanskiy <maxim@isovalent.com>
1 parent f9f27bf commit 05831fa

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

print-ip6.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -466,14 +466,23 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
466466

467467
/*
468468
* OK, we didn't see any extension
469-
* header, but that means we have
470-
* no payload, so set the length
471-
* to the IPv6 header length,
469+
* header - presume BIG TCP without
470+
* a Jumbo Payload option, but only
471+
* if it's actually >64k. Otherwise,
472+
* we have no payload, so set the
473+
* length to the IPv6 header length,
472474
* and change the snapshot length
473475
* accordingly.
474476
*/
475-
len = sizeof(struct ip6_hdr);
476-
nd_change_snaplen(ndo, bp, len);
477+
if (length > 65535) {
478+
len = length;
479+
if (ndo->ndo_vflag)
480+
ND_PRINT("[real length %u, presumed BIG TCP] ",
481+
len);
482+
} else {
483+
len = sizeof(struct ip6_hdr);
484+
nd_change_snaplen(ndo, bp, len);
485+
}
477486

478487
/*
479488
* Now subtract the length of

0 commit comments

Comments
 (0)