bpf: test_run: Remove ipv6_bpf_stub usage
Subsystems (3)
Martin KaFai Lau
reviewerPATCH 1/1 bpf: test_run: Remove ipv6_bpf_stub usage
From: Martin KaFai Lau <[email protected]>
bpf_prog_test_run_skb() uses net->ipv6.ip6_null_entry for BPF_PROG_TYPE_LWT_XMIT test runs.
It currently checks ipv6_bpf_stub before using ip6_null_entry. ipv6_bpf_stub will be removed by the CONFIG_IPV6=m support removal series posted at [1], so switch this check to ipv6_mod_enabled() instead.
This change depends on that series [1]. Without it, CONFIG_IPV6=m is still possible, and net->ipv6.ip6_null_entry remains NULL until the IPv6 module is loaded.
[1] https://lore.kernel.org/netdev/[email protected]/
--- net/bpf/test_run.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
net/bpf/test_run.c +2 -5
@@ -1157,15 +1157,12 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr, }if (prog->type ==BPF_PROG_TYPE_LWT_XMIT ) { -if (!ipv6_bpf_stub) { -pr_warn_once ("Please test this program with the IPv6 module loaded\n" ); +if (!ipv6_mod_enabled ()) { +pr_warn_once ("Please test this program with IPv6 enabled kernel\n" ); ret = -EOPNOTSUPP ; goto out; }#if IS_ENABLED (CONFIG_IPV6 ) -/* For CONFIG_IPV6=n, ipv6_bpf_stub is NULL which is -* handled by the above if statement. -*/ dst_hold (&net->ipv6.ip6_null_entry->dst);skb_dst_set (skb, &net->ipv6.ip6_null_entry->dst);#endif
Signature · 1 line
2.52.0
Quoted 47 lines · Martin KaFai Lau
From: Martin KaFai Lau <[email protected]>
bpf_prog_test_run_skb()usesnet->ipv6.ip6_null_entryforBPF_PROG_TYPE_LWT_XMITtest runs.It currently checks
ipv6_bpf_stubbefore usingip6_null_entry.ipv6_bpf_stubwill be removed by theCONFIG_IPV6=msupport removal series posted at [1], so switch this check toipv6_mod_enabled()instead.This change depends on that series [1]. Without it,
CONFIG_IPV6=mis still possible, andnet->ipv6.ip6_null_entryremains NULL until the IPv6 module is loaded.[1] https://lore.kernel.org/netdev/[email protected]/
Cc Jakub Kicinski <[email protected]>Cc Fernando Fernandez Mancera <[email protected]>Signed-off-by Martin KaFai Lau <[email protected]>--- net/bpf/test_run.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)net/bpf/test_run.c +2
-6@@ -1157,15 +1157,12 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr, }if (prog->type ==BPF_PROG_TYPE_LWT_XMIT ) { -if (!ipv6_bpf_stub) { -pr_warn_once ("Please test this program with the IPv6 module loaded\n" ); +if (!ipv6_mod_enabled ()) { +pr_warn_once ("Please test this program with IPv6 enabled kernel\n" ); ret = -EOPNOTSUPP ; goto out; }#if IS_ENABLED (CONFIG_IPV6 ) -/* For CONFIG_IPV6=n, ipv6_bpf_stub is NULL which is -* handled by the above if statement. -*/ dst_hold (&net->ipv6.ip6_null_entry->dst);skb_dst_set (skb, &net->ipv6.ip6_null_entry->dst);#endif --
Quoted 3 lines
2.52.0
Since the CONFIG_IPV6=m removal series also removes the stubs, switching the check to ipv6_mod_enabled() makes sense.
Quoted 14 lines · Martin KaFai Lau
From: Martin KaFai Lau <[email protected]>
bpf_prog_test_run_skb()usesnet->ipv6.ip6_null_entryforBPF_PROG_TYPE_LWT_XMITtest runs.It currently checks
ipv6_bpf_stubbefore usingip6_null_entry.ipv6_bpf_stubwill be removed by theCONFIG_IPV6=msupport removal series posted at [1], so switch this check toipv6_mod_enabled()instead.This change depends on that series [1]. Without it,
CONFIG_IPV6=mis still possible, andnet->ipv6.ip6_null_entryremains NULL until the IPv6 module is loaded.
Quoted 6 lines
[1] https://lore.kernel.org/netdev/[email protected]/
Cc Jakub Kicinski <[email protected]>Cc Fernando Fernandez Mancera <[email protected]>Signed-off-by Martin KaFai Lau <[email protected]>---
LGTM!
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Quoted 11 lines · On Mon, 23 Mar 2026 15:52:50 -0700 you wrote:
From: Martin KaFai Lau <[email protected]>
bpf_prog_test_run_skb()usesnet->ipv6.ip6_null_entryforBPF_PROG_TYPE_LWT_XMITtest runs.It currently checks
ipv6_bpf_stubbefore usingip6_null_entry.ipv6_bpf_stubwill be removed by theCONFIG_IPV6=msupport removal series posted at [1], so switch this check toipv6_mod_enabled()instead.[...]
Here is the summary with links:
- [bpf-next] bpf: test_run: Remove ipv6_bpf_stub usage
https://git.kernel.org/bpf/bpf-next/c/280de43e88c0
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html