]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drivers: net: drop ipv6_stub usage and use direct function calls
authorFernando Fernandez Mancera <fmancera@suse.de>
Wed, 25 Mar 2026 12:08:47 +0000 (13:08 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sun, 29 Mar 2026 18:21:23 +0000 (11:21 -0700)
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>
22 files changed:
drivers/infiniband/core/addr.c
drivers/infiniband/sw/rxe/rxe_net.c
drivers/net/ethernet/mellanox/mlx5/core/en/rep/neigh.c
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
drivers/net/ethernet/netronome/nfp/flower/action.c
drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
drivers/net/ethernet/sfc/tc_counters.c
drivers/net/ethernet/sfc/tc_encap_actions.c
drivers/net/geneve.c
drivers/net/gtp.c
drivers/net/ovpn/peer.c
drivers/net/ovpn/udp.c
drivers/net/usb/cdc_mbim.c
drivers/net/vxlan/vxlan_core.c
drivers/net/vxlan/vxlan_multicast.c
drivers/net/wireguard/socket.c
drivers/net/wireless/intel/ipw2x00/ipw2100.c
net/bridge/br_arp_nd_proxy.c

index 866746695712aeae425100eefb231e44d52d52d4..48d4b06384ec7da82353ced9049bd8f9ab7fbf97 100644 (file)
@@ -41,7 +41,6 @@
 #include <net/neighbour.h>
 #include <net/route.h>
 #include <net/netevent.h>
-#include <net/ipv6_stubs.h>
 #include <net/ip6_route.h>
 #include <rdma/ib_addr.h>
 #include <rdma/ib_cache.h>
@@ -411,7 +410,7 @@ static int addr6_resolve(struct sockaddr *src_sock,
        fl6.saddr = src_in->sin6_addr;
        fl6.flowi6_oif = addr->bound_dev_if;
 
-       dst = ipv6_stub->ipv6_dst_lookup_flow(addr->net, NULL, &fl6, NULL);
+       dst = ip6_dst_lookup_flow(addr->net, NULL, &fl6, NULL);
        if (IS_ERR(dst))
                return PTR_ERR(dst);
 
index 0bd0902b11f734acbbb9fa521bf117bbf6a7710d..cbc646a30003559bdbf8b44f6e7103210f2d23e1 100644 (file)
@@ -138,9 +138,9 @@ static struct dst_entry *rxe_find_route6(struct rxe_qp *qp,
        memcpy(&fl6.daddr, daddr, sizeof(*daddr));
        fl6.flowi6_proto = IPPROTO_UDP;
 
-       ndst = ipv6_stub->ipv6_dst_lookup_flow(sock_net(recv_sockets.sk6->sk),
-                                              recv_sockets.sk6->sk, &fl6,
-                                              NULL);
+       ndst = ip6_dst_lookup_flow(sock_net(recv_sockets.sk6->sk),
+                                  recv_sockets.sk6->sk, &fl6,
+                                  NULL);
        if (IS_ERR(ndst)) {
                rxe_dbg_qp(qp, "no route to %pI6\n", daddr);
                return NULL;
index d220b045b33108b727fdb133ce81d6ca04c2048d..648f4521c0964409bdbfcc8813aed086e1fe411c 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/notifier.h>
 #include <net/netevent.h>
 #include <net/arp.h>
+#include <net/ndisc.h>
 #include "neigh.h"
 #include "tc.h"
 #include "en_rep.h"
@@ -18,8 +19,8 @@
 
 static unsigned long mlx5e_rep_ipv6_interval(void)
 {
-       if (IS_ENABLED(CONFIG_IPV6) && ipv6_stub->nd_tbl)
-               return NEIGH_VAR(&ipv6_stub->nd_tbl->parms, DELAY_PROBE_TIME);
+       if (IS_ENABLED(CONFIG_IPV6) && ipv6_mod_enabled())
+               return NEIGH_VAR(&nd_tbl.parms, DELAY_PROBE_TIME);
 
        return ~0UL;
 }
@@ -217,7 +218,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
        case NETEVENT_NEIGH_UPDATE:
                n = ptr;
 #if IS_ENABLED(CONFIG_IPV6)
-               if (n->tbl != ipv6_stub->nd_tbl && n->tbl != &arp_tbl)
+               if (n->tbl != &nd_tbl && n->tbl != &arp_tbl)
 #else
                if (n->tbl != &arp_tbl)
 #endif
@@ -238,7 +239,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
                 * done per device delay prob time parameter.
                 */
 #if IS_ENABLED(CONFIG_IPV6)
-               if (!p->dev || (p->tbl != ipv6_stub->nd_tbl && p->tbl != &arp_tbl))
+               if (!p->dev || (p->tbl != &nd_tbl && p->tbl != &arp_tbl))
 #else
                if (!p->dev || p->tbl != &arp_tbl)
 #endif
index a14f216048cd2dbe37d0f905c55138ab2c744a42..de74dbfe7b20c9b8c4c5a820143d2d49ae9835ae 100644 (file)
@@ -453,8 +453,7 @@ static int mlx5e_route_lookup_ipv6_get(struct mlx5e_priv *priv,
 
        if (tunnel && tunnel->get_remote_ifindex)
                attr->fl.fl6.flowi6_oif = tunnel->get_remote_ifindex(dev);
-       dst = ipv6_stub->ipv6_dst_lookup_flow(dev_net(dev), NULL, &attr->fl.fl6,
-                                             NULL);
+       dst = ip6_dst_lookup_flow(dev_net(dev), NULL, &attr->fl.fl6, NULL);
        if (IS_ERR(dst))
                return PTR_ERR(dst);
 
index bfd401bee9e87e9ce11fec1f482e3b0be022bd94..8b827201935eb81b46b3996fe5d740f32be1882c 100644 (file)
@@ -402,7 +402,7 @@ void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
                tbl = &arp_tbl;
 #if IS_ENABLED(CONFIG_IPV6)
        else if (m_neigh->family == AF_INET6)
-               tbl = ipv6_stub->nd_tbl;
+               tbl = &nd_tbl;
 #endif
        else
                return;
index 64e13747084ee6e6fef00ca50eb6c15fb6d3bbea..a52e12c3c95a280ccffbba997e3fe4e321cb3728 100644 (file)
@@ -36,7 +36,6 @@
 #include <linux/inetdevice.h>
 #include <linux/netdevice.h>
 #include <net/netevent.h>
-#include <net/ipv6_stubs.h>
 
 #include "en.h"
 #include "eswitch.h"
index 8992f0f7a870bd72fc8336f3a66a803f14a31803..ba6c0f38cc7380dd3839918b45a394e2ff62c421 100644 (file)
@@ -38,7 +38,6 @@
 #include <net/pkt_cls.h>
 #include <net/act_api.h>
 #include <net/devlink.h>
-#include <net/ipv6_stubs.h>
 
 #include "eswitch.h"
 #include "en.h"
index 397a93584fd6675f1b0f290ae5928d12a2cbc1a8..a9001d1c902ff14f44e7b71ddab873066ce47028 100644 (file)
@@ -41,7 +41,6 @@
 #include <linux/refcount.h>
 #include <linux/completion.h>
 #include <net/arp.h>
-#include <net/ipv6_stubs.h>
 #include <net/bareudp.h>
 #include <net/bonding.h>
 #include <net/dst_metadata.h>
index aca2a7417af37c52fd26278139263760a781e72b..ae2f8b31adfbbd0c271961628c334d71c47273c2 100644 (file)
@@ -470,7 +470,7 @@ nfp_fl_set_tun(struct nfp_app *app, struct nfp_fl_set_tun *set_tun,
 
                flow.daddr = ip_tun->key.u.ipv6.dst;
                flow.flowi4_proto = IPPROTO_UDP;
-               dst = ipv6_stub->ipv6_dst_lookup_flow(net, NULL, &flow, NULL);
+               dst = ip6_dst_lookup_flow(net, NULL, &flow, NULL);
                if (!IS_ERR(dst)) {
                        set_tun->ttl = ip6_dst_hoplimit(dst);
                        dst_release(dst);
index 0cef0e2b85d09de991d242dce9f6a174bc6d4457..ca30702f88780ebd0c2822f87ad270823ad5c21e 100644 (file)
@@ -650,7 +650,7 @@ static void nfp_tun_neigh_update(struct work_struct *work)
                flow6.daddr = *(struct in6_addr *)n->primary_key;
                if (!neigh_invalid) {
                        struct dst_entry *dst;
-                       /* Use ipv6_dst_lookup_flow to populate flow6->saddr
+                       /* Use ip6_dst_lookup_flow to populate flow6->saddr
                         * and other fields. This information is only needed
                         * for new entries, lookup can be skipped when an entry
                         * gets invalidated - as only the daddr is needed for
@@ -730,7 +730,7 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event,
                return NOTIFY_DONE;
        }
 #if IS_ENABLED(CONFIG_IPV6)
-       if (n->tbl != ipv6_stub->nd_tbl && n->tbl != &arp_tbl)
+       if (n->tbl != &nd_tbl && n->tbl != &arp_tbl)
 #else
        if (n->tbl != &arp_tbl)
 #endif
@@ -815,8 +815,7 @@ void nfp_tunnel_request_route_v6(struct nfp_app *app, struct sk_buff *skb)
        flow.flowi6_proto = IPPROTO_UDP;
 
 #if IS_ENABLED(CONFIG_INET) && IS_ENABLED(CONFIG_IPV6)
-       dst = ipv6_stub->ipv6_dst_lookup_flow(dev_net(netdev), NULL, &flow,
-                                             NULL);
+       dst = ip6_dst_lookup_flow(dev_net(netdev), NULL, &flow, NULL);
        if (IS_ERR(dst))
                goto fail_rcu_unlock;
 #else
index d168282f30bfd8bd33bbe550c68483d8d5fb6b65..b84235e93ffe99df0e454fc2ab9f53c51aa58a01 100644 (file)
@@ -112,7 +112,7 @@ static void efx_tc_counter_work(struct work_struct *work)
                                         encap->neigh->egdev);
                else
 #if IS_ENABLED(CONFIG_IPV6)
-                       n = neigh_lookup(ipv6_stub->nd_tbl,
+                       n = neigh_lookup(&nd_tbl,
                                         &encap->neigh->dst_ip6,
                                         encap->neigh->egdev);
 #else
index da35705cc5e19d0e2435407bdd2cf8e273e22b59..db222abef53b2aafffe762828749bd0e5c207aa0 100644 (file)
@@ -149,8 +149,7 @@ static int efx_bind_neigh(struct efx_nic *efx,
 #if IS_ENABLED(CONFIG_IPV6)
                        struct dst_entry *dst;
 
-                       dst = ipv6_stub->ipv6_dst_lookup_flow(net, NULL, &flow6,
-                                                             NULL);
+                       dst = ip6_dst_lookup_flow(net, NULL, &flow6, NULL);
                        rc = PTR_ERR_OR_ZERO(dst);
                        if (rc) {
                                NL_SET_ERR_MSG_MOD(extack, "Failed to lookup route for IPv6 encap");
@@ -531,7 +530,7 @@ static int efx_neigh_event(struct efx_nic *efx, struct neighbour *n)
        if (n->tbl == &arp_tbl) {
                keysize = sizeof(keys.dst_ip);
 #if IS_ENABLED(CONFIG_IPV6)
-       } else if (n->tbl == ipv6_stub->nd_tbl) {
+       } else if (n->tbl == &nd_tbl) {
                ipv6 = true;
                keysize = sizeof(keys.dst_ip6);
 #endif
index 01cdd06102e0db2672245fde84ccb98417ee9e85..c6563367d38266933e91929530fcd5fdd5ce8849 100644 (file)
@@ -12,7 +12,6 @@
 #include <linux/module.h>
 #include <linux/etherdevice.h>
 #include <linux/hash.h>
-#include <net/ipv6_stubs.h>
 #include <net/dst_metadata.h>
 #include <net/gro_cells.h>
 #include <net/rtnetlink.h>
index e8949f5562090513e2d95ea01f3d463356e58cfb..70b9e58b9b781256d469e72af23f97fd7a8d7ec2 100644 (file)
@@ -374,7 +374,7 @@ static struct rt6_info *ip6_route_output_gtp(struct net *net,
        fl6->saddr              = *saddr;
        fl6->flowi6_proto       = sk->sk_protocol;
 
-       dst = ipv6_stub->ipv6_dst_lookup_flow(net, sk, fl6, NULL);
+       dst = ip6_dst_lookup_flow(net, sk, fl6, NULL);
        if (IS_ERR(dst))
                return ERR_PTR(-ENETUNREACH);
 
index 26b55d813f0ee031cd08985fddc9af4ba4823a97..c02dfab51a6e6380b4ff2d1095ec1e3c55548858 100644 (file)
@@ -827,8 +827,7 @@ static struct in6_addr ovpn_nexthop_from_rt6(struct ovpn_priv *ovpn,
                .daddr = dest,
        };
 
-       entry = ipv6_stub->ipv6_dst_lookup_flow(dev_net(ovpn->dev), NULL, &fl,
-                                               NULL);
+       entry = ip6_dst_lookup_flow(dev_net(ovpn->dev), NULL, &fl, NULL);
        if (IS_ERR(entry)) {
                net_dbg_ratelimited("%s: no route to host %pI6c\n",
                                    netdev_name(ovpn->dev), &dest);
index 272b535ecaad4c75ff2aa9d4589b4cfa36a0dea9..059e896b4a2fdabe2ae5dc33adb059d841cc7b21 100644 (file)
@@ -14,7 +14,6 @@
 #include <net/addrconf.h>
 #include <net/dst_cache.h>
 #include <net/route.h>
-#include <net/ipv6_stubs.h>
 #include <net/transp_v6.h>
 #include <net/udp.h>
 #include <net/udp_tunnel.h>
@@ -251,7 +250,7 @@ static int ovpn_udp6_output(struct ovpn_peer *peer, struct ovpn_bind *bind,
                dst_cache_reset(cache);
        }
 
-       dst = ipv6_stub->ipv6_dst_lookup_flow(sock_net(sk), sk, &fl, NULL);
+       dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl, NULL);
        if (IS_ERR(dst)) {
                ret = PTR_ERR(dst);
                net_dbg_ratelimited("%s: no route to host %pISpc: %d\n",
index dbf01210b0e783ddc3c6961663ebf8d4574b6bf0..877fb0ed7d3d71c0e55fb5d29c269030b6c5b684 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/usb/cdc_ncm.h>
 #include <net/ipv6.h>
 #include <net/addrconf.h>
-#include <net/ipv6_stubs.h>
 #include <net/ndisc.h>
 
 /* alternative VLAN for IP session 0 if not untagged */
@@ -302,6 +301,7 @@ error:
        return NULL;
 }
 
+#if IS_ENABLED(CONFIG_IPV6)
 /* Some devices are known to send Neighbor Solicitation messages and
  * require Neighbor Advertisement replies.  The IPv6 core will not
  * respond since IFF_NOARP is set, so we must handle them ourselves.
@@ -342,12 +342,11 @@ static void do_neigh_solicit(struct usbnet *dev, u8 *buf, u16 tci)
        is_router = !!READ_ONCE(in6_dev->cnf.forwarding);
        in6_dev_put(in6_dev);
 
-       /* ipv6_stub != NULL if in6_dev_get returned an inet6_dev */
-       ipv6_stub->ndisc_send_na(netdev, &iph->saddr, &msg->target,
-                                is_router /* router */,
-                                true /* solicited */,
-                                false /* override */,
-                                true /* inc_opt */);
+       ndisc_send_na(netdev, &iph->saddr, &msg->target,
+                     is_router /* router */,
+                     true /* solicited */,
+                     false /* override */,
+                     true /* inc_opt */);
 out:
        dev_put(netdev);
 }
@@ -362,7 +361,7 @@ static bool is_neigh_solicit(u8 *buf, size_t len)
                msg->icmph.icmp6_code == 0 &&
                msg->icmph.icmp6_type == NDISC_NEIGHBOUR_SOLICITATION);
 }
-
+#endif /* IPV6 */
 
 static struct sk_buff *cdc_mbim_process_dgram(struct usbnet *dev, u8 *buf, size_t len, u16 tci)
 {
@@ -378,8 +377,10 @@ static struct sk_buff *cdc_mbim_process_dgram(struct usbnet *dev, u8 *buf, size_
                        proto = htons(ETH_P_IP);
                        break;
                case 0x60:
+#if IS_ENABLED(CONFIG_IPV6)
                        if (is_neigh_solicit(buf, len))
                                do_neigh_solicit(dev, buf, tci);
+#endif
                        proto = htons(ETH_P_IPV6);
                        break;
                default:
index 17c941aac32db9e8716404a5de44a8d223476e2a..b5fbd03418b6744c0ce50b99d8f878f2b77339be 100644 (file)
@@ -19,7 +19,6 @@
 #include <net/arp.h>
 #include <net/ndisc.h>
 #include <net/gro.h>
-#include <net/ipv6_stubs.h>
 #include <net/ip.h>
 #include <net/icmp.h>
 #include <net/rtnetlink.h>
@@ -2045,7 +2044,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
            ipv6_addr_is_multicast(&msg->target))
                goto out;
 
-       n = neigh_lookup(ipv6_stub->nd_tbl, &msg->target, dev);
+       n = neigh_lookup(&nd_tbl, &msg->target, dev);
 
        if (n) {
                struct vxlan_rdst *rdst = NULL;
@@ -2130,15 +2129,15 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
        {
                struct ipv6hdr *pip6;
 
-               /* check if nd_tbl is not initiliazed due to
-                * ipv6.disable=1 set during boot
+               /* check if ipv6.disable=1 set during boot was set
+                * during booting so nd_tbl is not initialized
                 */
-               if (!ipv6_stub->nd_tbl)
+               if (!ipv6_mod_enabled())
                        return false;
                if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
                        return false;
                pip6 = ipv6_hdr(skb);
-               n = neigh_lookup(ipv6_stub->nd_tbl, &pip6->daddr, dev);
+               n = neigh_lookup(&nd_tbl, &pip6->daddr, dev);
                if (!n && (vxlan->cfg.flags & VXLAN_F_L3MISS)) {
                        union vxlan_addr ipa = {
                                .sin6.sin6_addr = pip6->daddr,
index a7f2d67dc61b80197f1f2c9ec978e1b7d984e4e2..b0e80bca855cc03ada9be9a0a391595a932f109e 100644 (file)
@@ -39,8 +39,7 @@ int vxlan_igmp_join(struct vxlan_dev *vxlan, union vxlan_addr *rip,
 
                sk = sock6->sock->sk;
                lock_sock(sk);
-               ret = ipv6_stub->ipv6_sock_mc_join(sk, ifindex,
-                                                  &ip->sin6.sin6_addr);
+               ret = ipv6_sock_mc_join(sk, ifindex, &ip->sin6.sin6_addr);
                release_sock(sk);
 #endif
        }
@@ -73,8 +72,7 @@ int vxlan_igmp_leave(struct vxlan_dev *vxlan, union vxlan_addr *rip,
 
                sk = sock6->sock->sk;
                lock_sock(sk);
-               ret = ipv6_stub->ipv6_sock_mc_drop(sk, ifindex,
-                                                  &ip->sin6.sin6_addr);
+               ret = ipv6_sock_mc_drop(sk, ifindex, &ip->sin6.sin6_addr);
                release_sock(sk);
 #endif
        }
index 253488f8c00f887d68b5c592e9f09e1a1777d9cc..c362c78d908eb02ba76a41f145bce8fa5a35c0a0 100644 (file)
@@ -136,8 +136,7 @@ static int send6(struct wg_device *wg, struct sk_buff *skb,
                        if (cache)
                                dst_cache_reset(cache);
                }
-               dst = ipv6_stub->ipv6_dst_lookup_flow(sock_net(sock), sock, &fl,
-                                                     NULL);
+               dst = ip6_dst_lookup_flow(sock_net(sock), sock, &fl, NULL);
                if (IS_ERR(dst)) {
                        ret = PTR_ERR(dst);
                        net_dbg_ratelimited("%s: No route to %pISpfsc, error %d\n",
index 248a051da52d3edec1965e73ade4b2f78305cdb9..c11428485dccf5f456920b9ff057fd7d72b692cc 100644 (file)
@@ -4838,7 +4838,7 @@ static int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode)
 
 /* If IPv6 is configured in the kernel then we don't want to filter out all
  * of the multicast packets as IPv6 needs some. */
-#if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE)
+#if !defined(CONFIG_IPV6)
        cmd.host_command = ADD_MULTICAST;
        cmd.host_command_sequence = 0;
        cmd.host_command_length = 0;
index 1e2b51769eec81c78aaddd739bb6c28d91c6f0bf..c06386eda47f0bd396ffc7fe9fef372ac0228e00 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/if_vlan.h>
 #include <linux/inetdevice.h>
 #include <net/addrconf.h>
-#include <net/ipv6_stubs.h>
 #if IS_ENABLED(CONFIG_IPV6)
 #include <net/ip6_checksum.h>
 #endif
@@ -455,7 +454,7 @@ void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br,
                return;
        }
 
-       n = neigh_lookup(ipv6_stub->nd_tbl, &msg->target, vlandev);
+       n = neigh_lookup(&nd_tbl, &msg->target, vlandev);
        if (n) {
                struct net_bridge_fdb_entry *f;