Re: [PATCH 00/11 net-next v4] Convert CONFIG_IPV6 to built-in and remove stubs
From: Fernando Fernandez Mancera <hidden>
Date: 2026-03-23 12:20:04
Also in:
lkml
On 3/22/26 6:27 PM, Ido Schimmel wrote:
On Fri, Mar 20, 2026 at 07:55:52PM +0100, Fernando Fernandez Mancera wrote:quoted
Changes: v4: Patch 2: new patch introduced on this revision Patch 3: drop some IS_BUILTIN(IPV6) on files compiled only when IPV6=y Patch 5: introduce ipv6_mod_enabled() checks on fib6_nh_init(), ip6_dst_lookup_flow() and ip6_fragment() to avoid crash when ipv6.disable=1 during boot Patch 6: use &nd_tbl on code guarded by IS_ENABLED(CONFIG_IPV6)The IPv6 code is still using ipv6_get_nd_tbl() for some reason. If you remove it from there (it's not needed), then we are only left with handful of users that can be converted to use '&nd_tbl' when IPv6 is enabled. Something like the patch below.
Hi Ido, the main reason why ipv6_get_nd_tbl() is used on IPv6 code is due to inlined functions. __ipv6_neigh_lookup_noref() is used in several places not guarded by IS_ENABLED(CONFIG_IPV6) preprocessor directive. That leads to undefined references when compiling with CONFIG_IPV6=n. ld: vmlinux.o: in function `bpf_ipv4_fib_lookup': filter.c:(.text+0x322b9dc): undefined reference to `nd_tbl' ld: filter.c:(.text+0x322b9fb): undefined reference to `nd_tbl' ld: filter.c:(.text+0x322ce1a): undefined reference to `nd_tbl' ld: vmlinux.o: in function `ipv4_confirm_neigh': route.c:(.text+0x345ade7): undefined reference to `nd_tbl' ld: route.c:(.text+0x345ae06): undefined reference to `nd_tbl' ld: vmlinux.o:route.c:(.text+0x345b74f): more undefined references to `nd_tbl' follow I think that using ipv6_get_nd_tbl() is cleaner than guarding the usage of nd_tbl inside the function itself. In addition, I do not think we need to guard every __ipv6_neigh_lookup_noref_stub() instance we are dropping/replacing because that code should never be reached with ipv6.disabled=1 or CONFIG_IPV6=n, otherwise it would crash. That means it should be safe to use ipv6_get_nd_tbl() there. What do you think Ido? I can still drop ipv6_get_nd_tbl() but it will require some IS_ENABLED(IPV6) preprocessor checks. Thanks, Fernando