From 04623ac947118f7466fde7a7d399ce495608d5af Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Tue, 24 Nov 2026 02:09:04 +0100 Subject: tap: Don't drop all packets with extension headers in ipv6_l4hdr() The loop in ipv6_l4hdr() was intended to skip extension headers (which we can't forward), but as we exit that function without dropping the last one we find (if any), we'll actually discard packets because the last extension header is used as Layer-4 header, which is later handled as having an unknown protocol number. This is in contrast with the recommendation from RFC 7045, which says that any forwarding node should forward packets regardless of any extension header. Notably, that RFC, and no current normative standards for that matter, doesn't introduce any particular requirement regarding the forwarding of extension headers themselves, so it's probably fine that we drop them (we have no choice anyway). Drop the last extension header we find, before leaving ipv6_l4hdr(). Fixing this carries the unintendend consequence that IPv6 fragments would be forwarded (not as fragments though), but, just like we do for IPv4, we want to drop them instead. The next patch will take care of that. Signed-off-by: Stefano Brivio --- tap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tap.c b/tap.c index 8386dbf..03cd886 100644 --- a/tap.c +++ b/tap.c @@ -935,9 +935,9 @@ static bool ipv6_l4hdr(struct iov_tail *data, uint8_t *proto, size_t *dlen) nh = o->nexthdr; hdrlen = (o->hdrlen + 1) * 8; - if (IPV6_NH_OPT(nh)) - iov_drop_header(data, hdrlen); - else + iov_drop_header(data, hdrlen); + + if (!IPV6_NH_OPT(nh)) goto found; } -- cgit v1.2.3