Re: [PATCH net-next 2/9] netfilter: flowtable: reject non-host IPv4 packets before lookup
From: netdev-bot+sashiko
Date: Tue Nov 17 2026 - 18:30:25 EST
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@xxxxxxxxxxxx>', 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@xxxxxxxxxxxx>
[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