net: fib: avoid warn splat in flow dissector
Subsystems (3)
PATCH 1/1 net: fib: avoid warn splat in flow dissector
New skbs allocated via nf_send_reset() have skb->dev == NULL.
fib*_rules_early_flow_dissect helpers already have a 'struct net' argument but its not passed down to the flow dissector core, which will then WARN as it can't derive a net namespace to use:
WARNING: CPU: 0 PID: 0 at net/core/flow_dissector.c:1016 __skb_flow_dissect+0xa91/0x1cd0 [..] ip_route_me_harder+0x143/0x330 nf_send_reset+0x17c/0x2d0 [nf_reject_ipv4] nft_reject_inet_eval+0xa9/0xf2 [nft_reject_inet] nft_do_chain+0x198/0x5d0 [nf_tables] nft_do_chain_inet+0xa4/0x110 [nf_tables] nf_hook_slow+0x41/0xc0 ip_local_deliver+0xce/0x110 ..
--- include/net/ip6_fib.h | 5 ++++- include/net/ip_fib.h | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-)
include/net/ip6_fib.h +4 -1
@@ -642,7 +642,10 @@ static inline bool fib6_rules_early_flow_dissect(struct net *net,if (!net->ipv6.fib6_rules_require_fldissect)return false; -skb_flow_dissect_flow_keys (skb, flkeys, flag); +memset (flkeys,0 ,sizeof (*flkeys)); +__skb_flow_dissect (net, skb, &flow_keys_dissector, + flkeys,NULL ,0 ,0 ,0 , flag); + fl6->fl6_sport = flkeys->ports.src; fl6->fl6_dport = flkeys->ports.dst; fl6->flowi6_proto = flkeys->basic.ip_proto;
include/net/ip_fib.h +4 -1
@@ -418,7 +418,10 @@ static inline bool fib4_rules_early_flow_dissect(struct net *net,if (!net->ipv4.fib_rules_require_fldissect)return false; -skb_flow_dissect_flow_keys (skb, flkeys, flag); +memset (flkeys,0 ,sizeof (*flkeys)); +__skb_flow_dissect (net, skb, &flow_keys_dissector, + flkeys,NULL ,0 ,0 ,0 , flag); + fl4->fl4_sport = flkeys->ports.src; fl4->fl4_dport = flkeys->ports.dst; fl4->flowi4_proto = flkeys->basic.ip_proto;
Signature · 1 line
2.41.0
Quoted 17 lines · Florian Westphal
New skbs allocated via
nf_send_reset()haveskb->dev== NULL.fib*_rules_early_flow_dissect helpers already have a 'struct net' argument but its not passed down to the flow dissector core, which will then WARN as it can't derive a net namespace to use:
WARNING: CPU: 0 PID: 0 at net/core/flow_dissector.c:1016 __skb_flow_dissect+0xa91/0x1cd0 [..] ip_route_me_harder+0x143/0x330 nf_send_reset+0x17c/0x2d0 [nf_reject_ipv4] nft_reject_inet_eval+0xa9/0xf2 [nft_reject_inet] nft_do_chain+0x198/0x5d0 [nf_tables] nft_do_chain_inet+0xa4/0x110 [nf_tables] nf_hook_slow+0x41/0xc0 ip_local_deliver+0xce/0x110 ..
Quoted 6 lines
Cc Stanislav Fomichev <[email protected]>Cc David Ahern <[email protected]>Cc Ido Schimmel <[email protected]>Fixes 812fa71f0d96 ("netfilter: Dissect flow after packet mangling")Signed-off-by Florian Westphal <[email protected]>
Thanks!
Quoted 23 lines · Florian Westphal
New skbs allocated via
nf_send_reset()haveskb->dev== NULL.fib*_rules_early_flow_dissect helpers already have a 'struct net' argument but its not passed down to the flow dissector core, which will then WARN as it can't derive a net namespace to use:
WARNING: CPU: 0 PID: 0 at net/core/flow_dissector.c:1016 __skb_flow_dissect+0xa91/0x1cd0 [..] ip_route_me_harder+0x143/0x330 nf_send_reset+0x17c/0x2d0 [nf_reject_ipv4] nft_reject_inet_eval+0xa9/0xf2 [nft_reject_inet] nft_do_chain+0x198/0x5d0 [nf_tables] nft_do_chain_inet+0xa4/0x110 [nf_tables] nf_hook_slow+0x41/0xc0 ip_local_deliver+0xce/0x110 ..Cc Stanislav Fomichev <[email protected]>Cc David Ahern <[email protected]>Cc Ido Schimmel <[email protected]>Fixes 812fa71f0d96 ("netfilter: Dissect flow after packet mangling")Signed-off-by Florian Westphal <[email protected]>
Quoted 5 lines
--- include/net/ip6_fib.h | 5 ++++- include/net/ip_fib.h | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-)
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 17 lines · On Wed, 30 Aug 2023 13:00:37 +0200 you wrote:
New skbs allocated via
nf_send_reset()haveskb->dev== NULL.fib*_rules_early_flow_dissect helpers already have a 'struct net' argument but its not passed down to the flow dissector core, which will then WARN as it can't derive a net namespace to use:
WARNING: CPU: 0 PID: 0 at net/core/flow_dissector.c:1016 __skb_flow_dissect+0xa91/0x1cd0 [..] ip_route_me_harder+0x143/0x330 nf_send_reset+0x17c/0x2d0 [nf_reject_ipv4] nft_reject_inet_eval+0xa9/0xf2 [nft_reject_inet] nft_do_chain+0x198/0x5d0 [nf_tables] nft_do_chain_inet+0xa4/0x110 [nf_tables] nf_hook_slow+0x41/0xc0 ip_local_deliver+0xce/0x110 ..
Quoted 1 line
[...]
Here is the summary with links:
- [net] net: fib: avoid warn splat in flow dissector
https://git.kernel.org/netdev/net/c/8aae7625ff3f
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html