public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Subject: [PATCH 1/2] tap: Don't drop all packets with extension headers in ipv6_l4hdr()
Date: Tue, 24 Nov 2026 03:40:41 +0100	[thread overview]
Message-ID: <20261124024042.549880-2-sbrivio@redhat.com> (raw)
In-Reply-To: <20261124024042.549880-1-sbrivio@redhat.com>

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 <sbrivio@redhat.com>
---
 tap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tap.c b/tap.c
index 13b31b1..bfb2532 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;
 	}
 
-- 
2.43.0


  reply	other threads:[~2026-11-24  2:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  2:40 [PATCH 0/2] Only drop IPv6 fragments, not all packets with extension headers Stefano Brivio
2026-11-24  2:40 ` Stefano Brivio [this message]
2026-11-24  2:40 ` [PATCH 2/2] tap: Explicitly drop outbound IPv6 fragments, warn about them Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261124024042.549880-2-sbrivio@redhat.com \
    --to=sbrivio@redhat.com \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).