From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by passt.top (Postfix, from userid 1000) id E711E5A0274; Tue, 24 Nov 2026 03:40:42 +0100 (CET) From: Stefano Brivio 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 Message-ID: <20261124024042.549880-2-sbrivio@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261124024042.549880-1-sbrivio@redhat.com> References: <20261124024042.549880-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: VMZ2NC3JMHQY4LLOPM3APUFA5OKFJYCC X-Message-ID-Hash: VMZ2NC3JMHQY4LLOPM3APUFA5OKFJYCC X-MailFrom: sbrivio@passt.top X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 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