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.

drivers: net: drop ipv6_stub usage and use direct function calls

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

Convert all drivers currently utilizing ipv6_stub to make 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>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Antonio Quartulli <antonio@openvpn.net>
Reviewed-by: Edward Cree <ecree.xilinx@gmail.com>
Link: https://patch.msgid.link/20260325120928.15848-7-fmancera@suse.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Fernando Fernandez Mancera and committed by
Jakub Kicinski
29ae61b2 4b70b202

+40 -53
+1 -2
drivers/infiniband/core/addr.c
··· 41 41 #include <net/neighbour.h> 42 42 #include <net/route.h> 43 43 #include <net/netevent.h> 44 - #include <net/ipv6_stubs.h> 45 44 #include <net/ip6_route.h> 46 45 #include <rdma/ib_addr.h> 47 46 #include <rdma/ib_cache.h> ··· 410 411 fl6.saddr = src_in->sin6_addr; 411 412 fl6.flowi6_oif = addr->bound_dev_if; 412 413 413 - dst = ipv6_stub->ipv6_dst_lookup_flow(addr->net, NULL, &fl6, NULL); 414 + dst = ip6_dst_lookup_flow(addr->net, NULL, &fl6, NULL); 414 415 if (IS_ERR(dst)) 415 416 return PTR_ERR(dst); 416 417
+3 -3
drivers/infiniband/sw/rxe/rxe_net.c
··· 138 138 memcpy(&fl6.daddr, daddr, sizeof(*daddr)); 139 139 fl6.flowi6_proto = IPPROTO_UDP; 140 140 141 - ndst = ipv6_stub->ipv6_dst_lookup_flow(sock_net(recv_sockets.sk6->sk), 142 - recv_sockets.sk6->sk, &fl6, 143 - NULL); 141 + ndst = ip6_dst_lookup_flow(sock_net(recv_sockets.sk6->sk), 142 + recv_sockets.sk6->sk, &fl6, 143 + NULL); 144 144 if (IS_ERR(ndst)) { 145 145 rxe_dbg_qp(qp, "no route to %pI6\n", daddr); 146 146 return NULL;
+5 -4
drivers/net/ethernet/mellanox/mlx5/core/en/rep/neigh.c
··· 10 10 #include <linux/notifier.h> 11 11 #include <net/netevent.h> 12 12 #include <net/arp.h> 13 + #include <net/ndisc.h> 13 14 #include "neigh.h" 14 15 #include "tc.h" 15 16 #include "en_rep.h" ··· 19 18 20 19 static unsigned long mlx5e_rep_ipv6_interval(void) 21 20 { 22 - if (IS_ENABLED(CONFIG_IPV6) && ipv6_stub->nd_tbl) 23 - return NEIGH_VAR(&ipv6_stub->nd_tbl->parms, DELAY_PROBE_TIME); 21 + if (IS_ENABLED(CONFIG_IPV6) && ipv6_mod_enabled()) 22 + return NEIGH_VAR(&nd_tbl.parms, DELAY_PROBE_TIME); 24 23 25 24 return ~0UL; 26 25 } ··· 218 217 case NETEVENT_NEIGH_UPDATE: 219 218 n = ptr; 220 219 #if IS_ENABLED(CONFIG_IPV6) 221 - if (n->tbl != ipv6_stub->nd_tbl && n->tbl != &arp_tbl) 220 + if (n->tbl != &nd_tbl && n->tbl != &arp_tbl) 222 221 #else 223 222 if (n->tbl != &arp_tbl) 224 223 #endif ··· 239 238 * done per device delay prob time parameter. 240 239 */ 241 240 #if IS_ENABLED(CONFIG_IPV6) 242 - if (!p->dev || (p->tbl != ipv6_stub->nd_tbl && p->tbl != &arp_tbl)) 241 + if (!p->dev || (p->tbl != &nd_tbl && p->tbl != &arp_tbl)) 243 242 #else 244 243 if (!p->dev || p->tbl != &arp_tbl) 245 244 #endif
+1 -2
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
··· 453 453 454 454 if (tunnel && tunnel->get_remote_ifindex) 455 455 attr->fl.fl6.flowi6_oif = tunnel->get_remote_ifindex(dev); 456 - dst = ipv6_stub->ipv6_dst_lookup_flow(dev_net(dev), NULL, &attr->fl.fl6, 457 - NULL); 456 + dst = ip6_dst_lookup_flow(dev_net(dev), NULL, &attr->fl.fl6, NULL); 458 457 if (IS_ERR(dst)) 459 458 return PTR_ERR(dst); 460 459
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c
··· 402 402 tbl = &arp_tbl; 403 403 #if IS_ENABLED(CONFIG_IPV6) 404 404 else if (m_neigh->family == AF_INET6) 405 - tbl = ipv6_stub->nd_tbl; 405 + tbl = &nd_tbl; 406 406 #endif 407 407 else 408 408 return;
-1
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
··· 36 36 #include <linux/inetdevice.h> 37 37 #include <linux/netdevice.h> 38 38 #include <net/netevent.h> 39 - #include <net/ipv6_stubs.h> 40 39 41 40 #include "en.h" 42 41 #include "eswitch.h"
-1
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
··· 38 38 #include <net/pkt_cls.h> 39 39 #include <net/act_api.h> 40 40 #include <net/devlink.h> 41 - #include <net/ipv6_stubs.h> 42 41 43 42 #include "eswitch.h" 44 43 #include "en.h"
-1
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 41 41 #include <linux/refcount.h> 42 42 #include <linux/completion.h> 43 43 #include <net/arp.h> 44 - #include <net/ipv6_stubs.h> 45 44 #include <net/bareudp.h> 46 45 #include <net/bonding.h> 47 46 #include <net/dst_metadata.h>
+1 -1
drivers/net/ethernet/netronome/nfp/flower/action.c
··· 470 470 471 471 flow.daddr = ip_tun->key.u.ipv6.dst; 472 472 flow.flowi4_proto = IPPROTO_UDP; 473 - dst = ipv6_stub->ipv6_dst_lookup_flow(net, NULL, &flow, NULL); 473 + dst = ip6_dst_lookup_flow(net, NULL, &flow, NULL); 474 474 if (!IS_ERR(dst)) { 475 475 set_tun->ttl = ip6_dst_hoplimit(dst); 476 476 dst_release(dst);
+3 -4
drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
··· 650 650 flow6.daddr = *(struct in6_addr *)n->primary_key; 651 651 if (!neigh_invalid) { 652 652 struct dst_entry *dst; 653 - /* Use ipv6_dst_lookup_flow to populate flow6->saddr 653 + /* Use ip6_dst_lookup_flow to populate flow6->saddr 654 654 * and other fields. This information is only needed 655 655 * for new entries, lookup can be skipped when an entry 656 656 * gets invalidated - as only the daddr is needed for ··· 730 730 return NOTIFY_DONE; 731 731 } 732 732 #if IS_ENABLED(CONFIG_IPV6) 733 - if (n->tbl != ipv6_stub->nd_tbl && n->tbl != &arp_tbl) 733 + if (n->tbl != &nd_tbl && n->tbl != &arp_tbl) 734 734 #else 735 735 if (n->tbl != &arp_tbl) 736 736 #endif ··· 815 815 flow.flowi6_proto = IPPROTO_UDP; 816 816 817 817 #if IS_ENABLED(CONFIG_INET) && IS_ENABLED(CONFIG_IPV6) 818 - dst = ipv6_stub->ipv6_dst_lookup_flow(dev_net(netdev), NULL, &flow, 819 - NULL); 818 + dst = ip6_dst_lookup_flow(dev_net(netdev), NULL, &flow, NULL); 820 819 if (IS_ERR(dst)) 821 820 goto fail_rcu_unlock; 822 821 #else
+1 -1
drivers/net/ethernet/sfc/tc_counters.c
··· 112 112 encap->neigh->egdev); 113 113 else 114 114 #if IS_ENABLED(CONFIG_IPV6) 115 - n = neigh_lookup(ipv6_stub->nd_tbl, 115 + n = neigh_lookup(&nd_tbl, 116 116 &encap->neigh->dst_ip6, 117 117 encap->neigh->egdev); 118 118 #else
+2 -3
drivers/net/ethernet/sfc/tc_encap_actions.c
··· 149 149 #if IS_ENABLED(CONFIG_IPV6) 150 150 struct dst_entry *dst; 151 151 152 - dst = ipv6_stub->ipv6_dst_lookup_flow(net, NULL, &flow6, 153 - NULL); 152 + dst = ip6_dst_lookup_flow(net, NULL, &flow6, NULL); 154 153 rc = PTR_ERR_OR_ZERO(dst); 155 154 if (rc) { 156 155 NL_SET_ERR_MSG_MOD(extack, "Failed to lookup route for IPv6 encap"); ··· 530 531 if (n->tbl == &arp_tbl) { 531 532 keysize = sizeof(keys.dst_ip); 532 533 #if IS_ENABLED(CONFIG_IPV6) 533 - } else if (n->tbl == ipv6_stub->nd_tbl) { 534 + } else if (n->tbl == &nd_tbl) { 534 535 ipv6 = true; 535 536 keysize = sizeof(keys.dst_ip6); 536 537 #endif
-1
drivers/net/geneve.c
··· 12 12 #include <linux/module.h> 13 13 #include <linux/etherdevice.h> 14 14 #include <linux/hash.h> 15 - #include <net/ipv6_stubs.h> 16 15 #include <net/dst_metadata.h> 17 16 #include <net/gro_cells.h> 18 17 #include <net/rtnetlink.h>
+1 -1
drivers/net/gtp.c
··· 374 374 fl6->saddr = *saddr; 375 375 fl6->flowi6_proto = sk->sk_protocol; 376 376 377 - dst = ipv6_stub->ipv6_dst_lookup_flow(net, sk, fl6, NULL); 377 + dst = ip6_dst_lookup_flow(net, sk, fl6, NULL); 378 378 if (IS_ERR(dst)) 379 379 return ERR_PTR(-ENETUNREACH); 380 380
+1 -2
drivers/net/ovpn/peer.c
··· 827 827 .daddr = dest, 828 828 }; 829 829 830 - entry = ipv6_stub->ipv6_dst_lookup_flow(dev_net(ovpn->dev), NULL, &fl, 831 - NULL); 830 + entry = ip6_dst_lookup_flow(dev_net(ovpn->dev), NULL, &fl, NULL); 832 831 if (IS_ERR(entry)) { 833 832 net_dbg_ratelimited("%s: no route to host %pI6c\n", 834 833 netdev_name(ovpn->dev), &dest);
+1 -2
drivers/net/ovpn/udp.c
··· 14 14 #include <net/addrconf.h> 15 15 #include <net/dst_cache.h> 16 16 #include <net/route.h> 17 - #include <net/ipv6_stubs.h> 18 17 #include <net/transp_v6.h> 19 18 #include <net/udp.h> 20 19 #include <net/udp_tunnel.h> ··· 250 251 dst_cache_reset(cache); 251 252 } 252 253 253 - dst = ipv6_stub->ipv6_dst_lookup_flow(sock_net(sk), sk, &fl, NULL); 254 + dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl, NULL); 254 255 if (IS_ERR(dst)) { 255 256 ret = PTR_ERR(dst); 256 257 net_dbg_ratelimited("%s: no route to host %pISpc: %d\n",
+9 -8
drivers/net/usb/cdc_mbim.c
··· 20 20 #include <linux/usb/cdc_ncm.h> 21 21 #include <net/ipv6.h> 22 22 #include <net/addrconf.h> 23 - #include <net/ipv6_stubs.h> 24 23 #include <net/ndisc.h> 25 24 26 25 /* alternative VLAN for IP session 0 if not untagged */ ··· 301 302 return NULL; 302 303 } 303 304 305 + #if IS_ENABLED(CONFIG_IPV6) 304 306 /* Some devices are known to send Neighbor Solicitation messages and 305 307 * require Neighbor Advertisement replies. The IPv6 core will not 306 308 * respond since IFF_NOARP is set, so we must handle them ourselves. ··· 342 342 is_router = !!READ_ONCE(in6_dev->cnf.forwarding); 343 343 in6_dev_put(in6_dev); 344 344 345 - /* ipv6_stub != NULL if in6_dev_get returned an inet6_dev */ 346 - ipv6_stub->ndisc_send_na(netdev, &iph->saddr, &msg->target, 347 - is_router /* router */, 348 - true /* solicited */, 349 - false /* override */, 350 - true /* inc_opt */); 345 + ndisc_send_na(netdev, &iph->saddr, &msg->target, 346 + is_router /* router */, 347 + true /* solicited */, 348 + false /* override */, 349 + true /* inc_opt */); 351 350 out: 352 351 dev_put(netdev); 353 352 } ··· 361 362 msg->icmph.icmp6_code == 0 && 362 363 msg->icmph.icmp6_type == NDISC_NEIGHBOUR_SOLICITATION); 363 364 } 364 - 365 + #endif /* IPV6 */ 365 366 366 367 static struct sk_buff *cdc_mbim_process_dgram(struct usbnet *dev, u8 *buf, size_t len, u16 tci) 367 368 { ··· 377 378 proto = htons(ETH_P_IP); 378 379 break; 379 380 case 0x60: 381 + #if IS_ENABLED(CONFIG_IPV6) 380 382 if (is_neigh_solicit(buf, len)) 381 383 do_neigh_solicit(dev, buf, tci); 384 + #endif 382 385 proto = htons(ETH_P_IPV6); 383 386 break; 384 387 default:
+5 -6
drivers/net/vxlan/vxlan_core.c
··· 19 19 #include <net/arp.h> 20 20 #include <net/ndisc.h> 21 21 #include <net/gro.h> 22 - #include <net/ipv6_stubs.h> 23 22 #include <net/ip.h> 24 23 #include <net/icmp.h> 25 24 #include <net/rtnetlink.h> ··· 2044 2045 ipv6_addr_is_multicast(&msg->target)) 2045 2046 goto out; 2046 2047 2047 - n = neigh_lookup(ipv6_stub->nd_tbl, &msg->target, dev); 2048 + n = neigh_lookup(&nd_tbl, &msg->target, dev); 2048 2049 2049 2050 if (n) { 2050 2051 struct vxlan_rdst *rdst = NULL; ··· 2129 2130 { 2130 2131 struct ipv6hdr *pip6; 2131 2132 2132 - /* check if nd_tbl is not initiliazed due to 2133 - * ipv6.disable=1 set during boot 2133 + /* check if ipv6.disable=1 set during boot was set 2134 + * during booting so nd_tbl is not initialized 2134 2135 */ 2135 - if (!ipv6_stub->nd_tbl) 2136 + if (!ipv6_mod_enabled()) 2136 2137 return false; 2137 2138 if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) 2138 2139 return false; 2139 2140 pip6 = ipv6_hdr(skb); 2140 - n = neigh_lookup(ipv6_stub->nd_tbl, &pip6->daddr, dev); 2141 + n = neigh_lookup(&nd_tbl, &pip6->daddr, dev); 2141 2142 if (!n && (vxlan->cfg.flags & VXLAN_F_L3MISS)) { 2142 2143 union vxlan_addr ipa = { 2143 2144 .sin6.sin6_addr = pip6->daddr,
+2 -4
drivers/net/vxlan/vxlan_multicast.c
··· 39 39 40 40 sk = sock6->sock->sk; 41 41 lock_sock(sk); 42 - ret = ipv6_stub->ipv6_sock_mc_join(sk, ifindex, 43 - &ip->sin6.sin6_addr); 42 + ret = ipv6_sock_mc_join(sk, ifindex, &ip->sin6.sin6_addr); 44 43 release_sock(sk); 45 44 #endif 46 45 } ··· 72 73 73 74 sk = sock6->sock->sk; 74 75 lock_sock(sk); 75 - ret = ipv6_stub->ipv6_sock_mc_drop(sk, ifindex, 76 - &ip->sin6.sin6_addr); 76 + ret = ipv6_sock_mc_drop(sk, ifindex, &ip->sin6.sin6_addr); 77 77 release_sock(sk); 78 78 #endif 79 79 }
+1 -2
drivers/net/wireguard/socket.c
··· 136 136 if (cache) 137 137 dst_cache_reset(cache); 138 138 } 139 - dst = ipv6_stub->ipv6_dst_lookup_flow(sock_net(sock), sock, &fl, 140 - NULL); 139 + dst = ip6_dst_lookup_flow(sock_net(sock), sock, &fl, NULL); 141 140 if (IS_ERR(dst)) { 142 141 ret = PTR_ERR(dst); 143 142 net_dbg_ratelimited("%s: No route to %pISpfsc, error %d\n",
+1 -1
drivers/net/wireless/intel/ipw2x00/ipw2100.c
··· 4838 4838 4839 4839 /* If IPv6 is configured in the kernel then we don't want to filter out all 4840 4840 * of the multicast packets as IPv6 needs some. */ 4841 - #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 4841 + #if !defined(CONFIG_IPV6) 4842 4842 cmd.host_command = ADD_MULTICAST; 4843 4843 cmd.host_command_sequence = 0; 4844 4844 cmd.host_command_length = 0;
+1 -2
net/bridge/br_arp_nd_proxy.c
··· 17 17 #include <linux/if_vlan.h> 18 18 #include <linux/inetdevice.h> 19 19 #include <net/addrconf.h> 20 - #include <net/ipv6_stubs.h> 21 20 #if IS_ENABLED(CONFIG_IPV6) 22 21 #include <net/ip6_checksum.h> 23 22 #endif ··· 454 455 return; 455 456 } 456 457 457 - n = neigh_lookup(ipv6_stub->nd_tbl, &msg->target, vlandev); 458 + n = neigh_lookup(&nd_tbl, &msg->target, vlandev); 458 459 if (n) { 459 460 struct net_bridge_fdb_entry *f; 460 461