Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bpf: Remove ipv6_bpf_stub usage in test_run

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/20260320185649.5411-1-fmancera@suse.de/

Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Reviewed-by: Sun Jian <sun.jian.kdev@gmail.com>
Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
Link: https://lore.kernel.org/r/20260323225250.1623542-1-martin.lau@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Martin KaFai Lau and committed by
Alexei Starovoitov
280de43e 03b7b389

+2 -5
+2 -5
net/bpf/test_run.c
··· 1157 1157 } 1158 1158 1159 1159 if (prog->type == BPF_PROG_TYPE_LWT_XMIT) { 1160 - if (!ipv6_bpf_stub) { 1161 - pr_warn_once("Please test this program with the IPv6 module loaded\n"); 1160 + if (!ipv6_mod_enabled()) { 1161 + pr_warn_once("Please test this program with IPv6 enabled kernel\n"); 1162 1162 ret = -EOPNOTSUPP; 1163 1163 goto out; 1164 1164 } 1165 1165 #if IS_ENABLED(CONFIG_IPV6) 1166 - /* For CONFIG_IPV6=n, ipv6_bpf_stub is NULL which is 1167 - * handled by the above if statement. 1168 - */ 1169 1166 dst_hold(&net->ipv6.ip6_null_entry->dst); 1170 1167 skb_dst_set(skb, &net->ipv6.ip6_null_entry->dst); 1171 1168 #endif