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.

ipv4: drop ipv6_stub usage and use direct function calls

As IPv6 is built-in only, the ipv6_stub infrastructure is no longer
necessary.

The IPv4 stack interacts with IPv6 mainly to support IPv4 routes with
IPv6 next-hops (RFC 8950). Convert all these cross-family calls from
ipv6_stub to direct function calls. The fallback functions introduced
previously will prevent linkage errors when CONFIG_IPV6 is disabled.

Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Tested-by: Ricardo B. Marlière <rbm@suse.com>
Link: https://patch.msgid.link/20260325120928.15848-8-fmancera@suse.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Fernando Fernandez Mancera and committed by
Jakub Kicinski
d98adfbd 29ae61b2

+28 -29
+8 -8
net/ipv4/fib_semantics.c
··· 585 585 586 586 if (likely(nhc->nhc_gw_family == AF_INET)) 587 587 n = neigh_lookup(&arp_tbl, &nhc->nhc_gw.ipv4, nhc->nhc_dev); 588 - else if (nhc->nhc_gw_family == AF_INET6) 589 - n = neigh_lookup(ipv6_stub->nd_tbl, &nhc->nhc_gw.ipv6, 590 - nhc->nhc_dev); 588 + else if (IS_ENABLED(CONFIG_IPV6) && nhc->nhc_gw_family == AF_INET6) 589 + n = neigh_lookup(&nd_tbl, &nhc->nhc_gw.ipv6, nhc->nhc_dev); 591 590 else 592 591 n = NULL; 593 592 ··· 1082 1083 struct fib6_nh fib6_nh = {}; 1083 1084 int err; 1084 1085 1085 - err = ipv6_stub->fib6_nh_init(net, &fib6_nh, &cfg, GFP_KERNEL, extack); 1086 + err = fib6_nh_init(net, &fib6_nh, &cfg, GFP_KERNEL, extack); 1086 1087 if (!err) { 1087 1088 nh->fib_nh_dev = fib6_nh.fib_nh_dev; 1088 1089 netdev_hold(nh->fib_nh_dev, &nh->fib_nh_dev_tracker, ··· 1090 1091 nh->fib_nh_oif = nh->fib_nh_dev->ifindex; 1091 1092 nh->fib_nh_scope = RT_SCOPE_LINK; 1092 1093 1093 - ipv6_stub->fib6_nh_release(&fib6_nh); 1094 + fib6_nh_release(&fib6_nh); 1094 1095 } 1095 1096 1096 1097 return err; ··· 2146 2147 if (likely(nh->fib_nh_gw_family == AF_INET)) 2147 2148 n = __ipv4_neigh_lookup_noref(nh->fib_nh_dev, 2148 2149 (__force u32)nh->fib_nh_gw4); 2149 - else if (nh->fib_nh_gw_family == AF_INET6) 2150 - n = __ipv6_neigh_lookup_noref_stub(nh->fib_nh_dev, 2151 - &nh->fib_nh_gw6); 2150 + else if (IS_ENABLED(CONFIG_IPV6) && 2151 + nh->fib_nh_gw_family == AF_INET6) 2152 + n = __ipv6_neigh_lookup_noref(nh->fib_nh_dev, 2153 + &nh->fib_nh_gw6); 2152 2154 else 2153 2155 n = NULL; 2154 2156 if (n)
+1 -1
net/ipv4/icmp.c
··· 1344 1344 case ICMP_AFI_IP6: 1345 1345 if (iio->ident.addr.ctype3_hdr.addrlen != sizeof(struct in6_addr)) 1346 1346 goto send_mal_query; 1347 - dev = ipv6_stub->ipv6_dev_find(net, &iio->ident.addr.ip_addr.ipv6_addr, dev); 1347 + dev = ipv6_dev_find(net, &iio->ident.addr.ip_addr.ipv6_addr, dev); 1348 1348 dev_hold(dev); 1349 1349 break; 1350 1350 #endif
+15 -13
net/ipv4/nexthop.c
··· 10 10 #include <linux/slab.h> 11 11 #include <linux/vmalloc.h> 12 12 #include <net/arp.h> 13 - #include <net/ipv6_stubs.h> 13 + #include <net/ip6_route.h> 14 14 #include <net/lwtunnel.h> 15 15 #include <net/ndisc.h> 16 16 #include <net/nexthop.h> ··· 510 510 fib_nh_release(nh->net, &nhi->fib_nh); 511 511 break; 512 512 case AF_INET6: 513 - ipv6_stub->fib6_nh_release(&nhi->fib6_nh); 513 + fib6_nh_release(&nhi->fib6_nh); 514 514 break; 515 515 } 516 516 kfree(nhi); ··· 1367 1367 1368 1368 rcu_read_lock(); 1369 1369 1370 - n = __ipv6_neigh_lookup_noref_stub(nh->fib_nh_dev, &nh->fib_nh_gw6); 1370 + n = __ipv6_neigh_lookup_noref(nh->fib_nh_dev, &nh->fib_nh_gw6); 1371 1371 if (n) 1372 1372 state = READ_ONCE(n->nud_state); 1373 1373 ··· 1401 1401 case AF_INET: 1402 1402 return ipv4_good_nh(&nhi->fib_nh); 1403 1403 case AF_INET6: 1404 - return ipv6_good_nh(&nhi->fib6_nh); 1404 + return IS_ENABLED(CONFIG_IPV6) && ipv6_good_nh(&nhi->fib6_nh); 1405 1405 } 1406 1406 1407 1407 return false; ··· 2151 2151 fib6_info_hold(f6i); 2152 2152 2153 2153 spin_unlock_bh(&nh->lock); 2154 - ipv6_stub->ip6_del_rt(net, f6i, 2155 - !READ_ONCE(net->ipv4.sysctl_nexthop_compat_mode)); 2154 + ip6_del_rt(net, f6i, 2155 + !READ_ONCE(net->ipv4.sysctl_nexthop_compat_mode)); 2156 2156 2157 2157 spin_lock_bh(&nh->lock); 2158 2158 } ··· 2208 2208 if (!list_empty(&nh->fi_list)) 2209 2209 rt_cache_flush(net); 2210 2210 2211 - list_for_each_entry(f6i, &nh->f6i_list, nh_list) 2212 - ipv6_stub->fib6_update_sernum(net, f6i); 2211 + list_for_each_entry(f6i, &nh->f6i_list, nh_list) { 2212 + spin_lock_bh(&f6i->fib6_table->tb6_lock); 2213 + fib6_update_sernum_upto_root(net, f6i); 2214 + spin_unlock_bh(&f6i->fib6_table->tb6_lock); 2215 + } 2213 2216 2214 2217 /* if an IPv6 group was replaced, we have to release all old 2215 2218 * dsts to make sure all refcounts are released ··· 2226 2223 struct nh_info *nhi = rtnl_dereference(nhge->nh->nh_info); 2227 2224 2228 2225 if (nhi->family == AF_INET6) 2229 - ipv6_stub->fib6_nh_release_dsts(&nhi->fib6_nh); 2226 + fib6_nh_release_dsts(&nhi->fib6_nh); 2230 2227 } 2231 2228 } 2232 2229 ··· 2507 2504 } 2508 2505 2509 2506 list_for_each_entry(f6i, &nh->f6i_list, nh_list) 2510 - ipv6_stub->fib6_rt_update(net, f6i, info); 2507 + fib6_rt_update(net, f6i, info); 2511 2508 } 2512 2509 2513 2510 /* send RTM_NEWROUTE with REPLACE flag set for all FIB entries ··· 2880 2877 fib6_cfg.fc_flags |= RTF_GATEWAY; 2881 2878 2882 2879 /* sets nh_dev if successful */ 2883 - err = ipv6_stub->fib6_nh_init(net, fib6_nh, &fib6_cfg, GFP_KERNEL, 2884 - extack); 2880 + err = fib6_nh_init(net, fib6_nh, &fib6_cfg, GFP_KERNEL, extack); 2885 2881 if (err) { 2886 2882 /* IPv6 is not enabled, don't call fib6_nh_release */ 2887 2883 if (err == -EAFNOSUPPORT) 2888 2884 goto out; 2889 - ipv6_stub->fib6_nh_release(fib6_nh); 2885 + fib6_nh_release(fib6_nh); 2890 2886 } else { 2891 2887 nh->nh_flags = fib6_nh->fib_nh_flags; 2892 2888 }
+2 -2
net/ipv4/route.c
··· 446 446 447 447 if (rt->rt_gw_family == AF_INET) { 448 448 pkey = (const __be32 *)&rt->rt_gw4; 449 - } else if (rt->rt_gw_family == AF_INET6) { 450 - return __ipv6_confirm_neigh_stub(dev, &rt->rt_gw6); 449 + } else if (IS_ENABLED(CONFIG_IPV6) && rt->rt_gw_family == AF_INET6) { 450 + return __ipv6_confirm_neigh(dev, &rt->rt_gw6); 451 451 } else if (!daddr || 452 452 (rt->rt_flags & 453 453 (RTCF_MULTICAST | RTCF_BROADCAST | RTCF_LOCAL))) {
+2 -5
net/ipv4/udp.c
··· 118 118 #include <net/addrconf.h> 119 119 #include <net/udp_tunnel.h> 120 120 #include <net/gro.h> 121 - #if IS_ENABLED(CONFIG_IPV6) 122 - #include <net/ipv6_stubs.h> 123 - #endif 124 121 #include <net/rps.h> 125 122 126 123 struct udp_table udp_table __read_mostly; ··· 2852 2855 2853 2856 if (udp_test_bit(GRO_ENABLED, sk) && encap_type == UDP_ENCAP_ESPINUDP) { 2854 2857 if (IS_ENABLED(CONFIG_IPV6) && family == AF_INET6) 2855 - new_gro_receive = ipv6_stub->xfrm6_gro_udp_encap_rcv; 2858 + new_gro_receive = xfrm6_gro_udp_encap_rcv; 2856 2859 else 2857 2860 new_gro_receive = xfrm4_gro_udp_encap_rcv; 2858 2861 ··· 2924 2927 #if IS_ENABLED(CONFIG_IPV6) 2925 2928 if (sk->sk_family == AF_INET6) 2926 2929 WRITE_ONCE(up->encap_rcv, 2927 - ipv6_stub->xfrm6_udp_encap_rcv); 2930 + xfrm6_udp_encap_rcv); 2928 2931 else 2929 2932 #endif 2930 2933 WRITE_ONCE(up->encap_rcv,