Article View: linux.kernel.netdev
Article #18177Re: [PATCH net-next 2/9] netfilter: flowtable: reject non-host IPv4 packets before lookup
From: netdev-bot+sashiko
Date: Tue, 17 Nov 2026 23:29
Date: Tue, 17 Nov 2026 23:29
138 lines
13080 bytes
13080 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 2 · Medium: 0 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The new early return in nf_flow_offload_ip_hook()
(net/netfilter/nf_flow_table_ip.c:915) checks skb->pkt_type at netdev…
- [High] The fix only covers IPv4.
- [Low] The commit trailer reads 'Signed-off-by: FLorian Fainelli
<florian.fainelli@broadcom.com>', but the author is 'Florian Fainelli'…
--
netfilter: flowtable: reject non-host IPv4 packets before lookup
This commit makes nf_flow_offload_ip_hook() return early when pkt_type is
not PACKET_HOST. Those packets then go to the normal IPv4 stack before the
flowtable lookup. The goal is to apply the same PACKET_HOST check that the
classic IPv4 forwarding path uses.
> Fixes: 97add9f0d66d ("netfilter: flow table support for IPv4")
>
> Signed-off-by: FLorian Fainelli <florian.fainelli@broadcom.com>
[Severity: Low]
This isn't a bug, but the Signed-off-by name has a typo ("FLorian") and
does not match the author name ("Florian Fainelli"). There is also an
extra blank line between the Fixes: tag and the Signed-off-by: tag.
> diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
> index 19cafae748abe..98bade1b82994 100644
> --- a/net/netfilter/nf_flow_table_ip.c
> +++ b/net/netfilter/nf_flow_table_ip.c
> @@ -911,6 +911,10 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb,
> };
> int ret;
>
> + /* The ingress hook runs before IPv4 rejects non-host Ethernet frames. */
> + if (unlikely(skb->pkt_type != PACKET_HOST))
> + return NF_ACCEPT;
[Severity: High]
Could this turn off the software fast path for flows that pass through a
bridge or VLAN upper device?
This hook runs at netdev ingress on the lower device. At that point
pkt_type still holds what eth_type_trans() set by comparing h_dest with
the lower device's own MAC. In __netif_receive_skb_core(), nf_ingress()
runs before both places that reclassify the frame:
__netif_receive_skb_core()
nf_ingress() <- nf_flow_offload_ip_hook() runs here
vlan_do_receive()
rx_handler() <- br_handle_frame()
net/8021q/vlan_core.c:vlan_do_receive() {
...
if (unlikely(skb->pkt_type == PACKET_OTHERHOST)) {
/* ... */
if (ether_addr_equal_64bits(eth_hdr(skb)->h_dest, vlan_dev->dev_addr))
skb->pkt_type = PACKET_HOST;
}
...
}
net/bridge/br_input.c:br_handle_frame() {
...
if (ether_addr_equal(p->br->dev->dev_addr, dest))
skb->pkt_type = PACKET_HOST;
...
}
The flowtable supports DEV_PATH_BRIDGE and DEV_PATH_VLAN paths.
nft_dev_path_info() puts the upper device's dev_addr in h_source, but the
ingress ifindex is the lower port. Hosts therefore send routed traffic to
the bridge or VLAN MAC.
Two setups hit this:
- A bridge port whose MAC differs from the bridge MAC. This is common in
a multi-port bridge, because the bridge takes one port's MAC.
- A VLAN device with its own MAC.
In both cases, every packet of an offloaded flow would be PACKET_OTHERHOST
at this hook. It would return NF_ACCEPT before nf_flow_offload_lookup().
The IPv4 stack later sees PACKET_HOST and forwards these packets.
Given that, does the patch keep "the IPv4 input path's forwarding
decision", as the commit message says? Would it work better to compare
h_dest with the address the flow expects (for example after the tuple
lookup) rather than test the lower device's raw pkt_type?
> +
> if (!nf_flow_skb_encap_protocol(&ctx, skb))
> return NF_ACCEPT;
>
[Severity: High]
Is the same bypass still open for IPv6? In the same file,
nf_flow_offload_ipv6_hook() has no pkt_type check. It goes straight to the
lookup, forward and nf_flow_queue_xmit6() steps:
net/netfilter/nf_flow_table_ip.c:nf_flow_offload_ipv6_hook() {
...
if (!nf_flow_skb_encap_protocol(&ctx, skb))
return NF_ACCEPT;
if (unlikely(ctx.ether_type != htons(ETH_P_IPV6)))
return NF_ACCEPT;
tuplehash = nf_flow_offload_ipv6_lookup(&ctx, flow_table, skb);
...
}
Classic IPv6 forwarding drops these frames:
net/ipv6/ip6_output.c:ip6_forward() {
...
if (skb->pkt_type != PACKET_HOST)
goto drop;
...
}
nf_flow_offload_inet_hook() sends ETH_P_IPV6 to the unpatched hook. With
this patch, an inet flowtable would reject non-host frames for IPv4. For
IPv6 it would still forward frames sent to an unrelated unicast,
broadcast or multicast MAC, as long as the 5-tuple matches an installed
flow.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116222519.1416501-1-florian.fainelli%40broadcom.com
Technical Details
Message-ID:
<179495815781.3136.11457762484354834526@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365698-linux-kernel-netdev=dewy.ruReferences:
<20261116222519.1416501-3-florian.fainelli@broadcom.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365698-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next 2/9] netfilter: flowtable: reject non-host IPv4 packets before lookup Date: Tue, 17 Nov 2026 23:29:17 +0000 Organization: Usenet Network Message-ID: <179495815781.3136.11457762484354834526@kernel.org> References: <20261116222519.1416501-3-florian.fainelli@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2454035"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:R5Q0ggQinpMpy0nZuAosfPTQCIQ= sha256:AAJgD81Qq9LjbgsuuZKoIMrd2+l1tUvep7wpJDn9BOU= sha1:qc22P13CSzsUBT1UE5rn5I0xOzU= sha256:keCoutFjpCgzHdYt8sbmtt8WwXF5CQPemZGU8TV8cZs= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id ACAC31150F5; Wed, 18 Nov 2026 02:29:53 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BcfJUoG9dtt1; Wed, 18 Nov 2026 02:29:47 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-365698-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 44C7D1150E2; Wed, 18 Nov 2026 02:29:38 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id B81C043896; Tue, 17 Nov 2026 23:29:22 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794958160; b=FbwltQ2R+pHdZU7kQTidhjBUJv88ubYqqrDNxLR/4E7Sjo2AMtSXX/ks0jwTBR/0AEoT rlF9vlPXxF4FQveE7fshIop64P42C/VoPvOZVPq0gsgOsNWqIUklr3ALVhHtnyJjKybtK EABMw2f9JB3pQgzknEPZOaGDKQYlvv1DuO3SW7qvQZgkAvvSVhi7dXkPmmCus4F132hnH 9135yE9PJjPFI9aojMzbllUDd3EcJCsv4r2W4IWlNqbs8+zvf70udrtM8IWD7UNu1jmTc BMNFKbwC7AhZW//Sk5vSyuJbFfUb1JAVk07XxFmWA+YeRnHWY5ctq7OB/Vl1PdfZ88A== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794958160; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=xWojjaEYs7k9MdSr3s8VPLG+k+lN/V+J6jjJUIs/rZs=; b=t1LSRaD7s6rqHI+pdNFBPu6CdAfUp/tspl9O7Xf855ysRbiEM3A3prCR953+okK6G/62 Mv6v+VI0sp8hoz5ZxBTXJGH7DLun5SSHUbGA60HpFdm2q7VHPWYTb3SJKVw6/0ArejouW w+DJGsP1N7YRnGmbuqGQvOyQbFsSs4Y2DndxpMw1LqAhE7RPHKG3ERpneorWTTe4a8MB4 xfKm14bZ1gH/5HSJr8VEFinAT2sS0y8bMI0w5Qvdl2h+ZvTZFwn7VJ+Cb0SZAJPluTLlm ZKNxhWyHxyACZ1bZYa4vjCrnpFs+ZpNdrl6El9hfM792OpPlh+Q53IqcZpMWRPI5xfg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RguWY5nw; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B9F1D606A333; Tue, 17 Nov 2026 23:29:20 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RguWY5nw X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794958159; b=JjGYIz7WvK2DhvIOBbiQDca568Wk7x+bBQBhgTc5KWNAifwlYPdXcxDNKR7g1p0zDIFB r5XvajAQuAoDOX2xruSNz0uoBiDc24EOZFT60Ba57UnzcyYfmiI4/m42uVTVh/Pbsm8Qa Vg7Pt6zoEY1vdk8lg3ft+rWzransphRiSkrFWuhXsw+Bld3NYIhJ4Hl8HS9YPlZHqPNBH 4CkQdVYTzQPCkWpsGKbzqMMNysOXhusEk0Iwdzr/3c27QFQbLAOUtPM28l0MDN3blyama 9wPcxEbbcvrJdYqB5werZfIhJSjjYGPijBhl+fncKYrsn0OjDDYDpORwv/IC/FygsJQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794958159; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=xWojjaEYs7k9MdSr3s8VPLG+k+lN/V+J6jjJUIs/rZs=; b=11dsLpSBbNCc3tN+N3gbwh/X0lZ/hrDNWyElKSeTQUOfPk2URJhDbpm+MDPv1mdFgXiG d9fi2ws8RAhfm6jKBQbqD2GjbOIGchS9Hm5tJFVUbJCJnLQw+j7gMEDN/aeri7z2DIXzL Y0i49NpjQ6sj8wn61Uvr0SerOVCHGq01mVhZjLPGKb632H2TllMQ7Tn6fK6HPLdZTLu2o HiBKgAKy7uB9FtF5MFq07h/bFnekoy78x7Xs8Q28Km4/JpktaIx+xkOLyyQdZKFtiSXn2 sDPXatU3j+vTb3ogqlCHF7dFPmSj4WZl6J/Zu34wtqf3HKWXUhP+wiFOXvutVAyx+iA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RguWY5nw; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D731E606A887; Tue, 17 Nov 2026 23:29:19 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 398E11F000C4; Tue, 17 Nov 2026 23:29:18 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794958159; bh=xWojjaEYs7k9MdSr3s8VPLG+k+lN/V+J6jjJUIs/rZs=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=RguWY5nwU6o6w/MIbfNUGWqe2DvbBb2k7NjIle6kG40haaaf6BwtzeXuQNTJ0W9Yw ZVnwolLPXFeyrhdOcsjohRgC1ZuhW5Vyycxe6F9p6KXZ2ax/81gV6RRC2rhHqR3pZk OrGJnK790dM0kuLQsmZwg8O8btHuf8KTzn77tzudwgrdgL3F9p89HJ2/hdW8er84b+ THH6gpS2yk/rIb/PTQj7r1zesHsM26dUlV49g3t8BZIOeiKNOYop0RxjLVyIomgwRd eZM8PQJaWlTohyA3Z7AGjN+6jbHpdrDXzcRt2Cza2cwVP+PYL7C/zm2yWZSJGzO+6Z kewmP2g4RjUJQ== X-Cc: netdev@vger.kernel.org, rafal@milecki.pl, bcm-kernel-feedback-list@broadcom.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, horms@kernel.org, corbet@lwn.net, jonas.gorski@gmail.com, olteanv@gmail.com, pablo@netfilter.org, fw@strlen.de, phil@nwl.cc, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org X-In-Reply-To: <20261116222519.1416501-3-florian.fainelli@broadcom.com> X-sashiko-severity: High X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list