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.

ipv6: remove ipv6_stub infrastructure completely

As IPv6 is built-in only and there are no more users of ipv6_stub, the
ipv6_stub is now entirely obsolete.

Remove all the code related to the definition, initialization and usage.

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-11-fmancera@suse.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Fernando Fernandez Mancera and committed by
Jakub Kicinski
964870b4 ad84b1ee

+3 -246
-1
include/net/ip6_fib.h
··· 621 621 { 622 622 } 623 623 #endif 624 - void fib6_update_sernum_stub(struct net *net, struct fib6_info *f6i); 625 624 626 625 void fib6_metric_set(struct fib6_info *f6i, int metric, u32 val); 627 626 static inline bool fib6_metric_locked(struct fib6_info *f6i, int metric)
-80
include/net/ipv6_stubs.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _IPV6_STUBS_H 3 - #define _IPV6_STUBS_H 4 - 5 - #include <linux/in6.h> 6 - #include <linux/netdevice.h> 7 - #include <linux/skbuff.h> 8 - #include <net/dst.h> 9 - #include <net/flow.h> 10 - #include <net/neighbour.h> 11 - #include <net/sock.h> 12 - #include <net/ipv6.h> 13 - 14 - /* structs from net/ip6_fib.h */ 15 - struct fib6_info; 16 - struct fib6_nh; 17 - struct fib6_config; 18 - struct fib6_result; 19 - 20 - /* This is ugly, ideally these symbols should be built 21 - * into the core kernel. 22 - */ 23 - struct ipv6_stub { 24 - int (*ipv6_sock_mc_join)(struct sock *sk, int ifindex, 25 - const struct in6_addr *addr); 26 - int (*ipv6_sock_mc_drop)(struct sock *sk, int ifindex, 27 - const struct in6_addr *addr); 28 - struct dst_entry *(*ipv6_dst_lookup_flow)(struct net *net, 29 - const struct sock *sk, 30 - struct flowi6 *fl6, 31 - const struct in6_addr *final_dst); 32 - int (*ipv6_route_input)(struct sk_buff *skb); 33 - 34 - struct fib6_table *(*fib6_get_table)(struct net *net, u32 id); 35 - int (*fib6_lookup)(struct net *net, int oif, struct flowi6 *fl6, 36 - struct fib6_result *res, int flags); 37 - int (*fib6_table_lookup)(struct net *net, struct fib6_table *table, 38 - int oif, struct flowi6 *fl6, 39 - struct fib6_result *res, int flags); 40 - void (*fib6_select_path)(const struct net *net, struct fib6_result *res, 41 - struct flowi6 *fl6, int oif, bool oif_match, 42 - const struct sk_buff *skb, int strict); 43 - u32 (*ip6_mtu_from_fib6)(const struct fib6_result *res, 44 - const struct in6_addr *daddr, 45 - const struct in6_addr *saddr); 46 - 47 - int (*fib6_nh_init)(struct net *net, struct fib6_nh *fib6_nh, 48 - struct fib6_config *cfg, gfp_t gfp_flags, 49 - struct netlink_ext_ack *extack); 50 - void (*fib6_nh_release)(struct fib6_nh *fib6_nh); 51 - void (*fib6_nh_release_dsts)(struct fib6_nh *fib6_nh); 52 - void (*fib6_update_sernum)(struct net *net, struct fib6_info *rt); 53 - int (*ip6_del_rt)(struct net *net, struct fib6_info *rt, bool skip_notify); 54 - void (*fib6_rt_update)(struct net *net, struct fib6_info *rt, 55 - struct nl_info *info); 56 - 57 - void (*udpv6_encap_enable)(void); 58 - void (*ndisc_send_na)(struct net_device *dev, const struct in6_addr *daddr, 59 - const struct in6_addr *solicited_addr, 60 - bool router, bool solicited, bool override, bool inc_opt); 61 - #if IS_ENABLED(CONFIG_XFRM) 62 - void (*xfrm6_local_rxpmtu)(struct sk_buff *skb, u32 mtu); 63 - int (*xfrm6_udp_encap_rcv)(struct sock *sk, struct sk_buff *skb); 64 - struct sk_buff *(*xfrm6_gro_udp_encap_rcv)(struct sock *sk, 65 - struct list_head *head, 66 - struct sk_buff *skb); 67 - int (*xfrm6_rcv_encap)(struct sk_buff *skb, int nexthdr, __be32 spi, 68 - int encap_type); 69 - #endif 70 - struct neigh_table *nd_tbl; 71 - 72 - int (*ipv6_fragment)(struct net *net, struct sock *sk, struct sk_buff *skb, 73 - int (*output)(struct net *, struct sock *, struct sk_buff *)); 74 - struct net_device *(*ipv6_dev_find)(struct net *net, const struct in6_addr *addr, 75 - struct net_device *dev); 76 - int (*ip6_xmit)(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6, 77 - __u32 mark, struct ipv6_txoptions *opt, int tclass, u32 priority); 78 - }; 79 - extern const struct ipv6_stub *ipv6_stub __read_mostly; 80 - #endif
+2 -23
include/net/ndisc.h
··· 2 2 #ifndef _NDISC_H 3 3 #define _NDISC_H 4 4 5 - #include <net/ipv6_stubs.h> 6 - 7 5 /* 8 6 * ICMP codes for neighbour discovery messages 9 7 */ ··· 357 359 return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, ndisc_hashfn, pkey, dev); 358 360 } 359 361 360 - static inline 361 - struct neighbour *__ipv6_neigh_lookup_noref_stub(struct net_device *dev, 362 - const void *pkey) 363 - { 364 - return ___neigh_lookup_noref(ipv6_stub->nd_tbl, neigh_key_eq128, 365 - ndisc_hashfn, pkey, dev); 366 - } 367 - 368 362 static inline struct neighbour *__ipv6_neigh_lookup(struct net_device *dev, const void *pkey) 369 363 { 370 364 struct neighbour *n; ··· 381 391 rcu_read_unlock(); 382 392 } 383 393 384 - static inline void __ipv6_confirm_neigh_stub(struct net_device *dev, 385 - const void *pkey) 386 - { 387 - struct neighbour *n; 388 - 389 - rcu_read_lock(); 390 - n = __ipv6_neigh_lookup_noref_stub(dev, pkey); 391 - neigh_confirm(n); 392 - rcu_read_unlock(); 393 - } 394 - 395 - /* uses ipv6_stub and is meant for use outside of IPv6 core */ 396 394 static inline struct neighbour *ip_neigh_gw6(struct net_device *dev, 397 395 const void *addr) 398 396 { 399 397 #if IS_ENABLED(CONFIG_IPV6) 400 398 struct neighbour *neigh; 401 399 402 - neigh = __ipv6_neigh_lookup_noref_stub(dev, addr); 400 + neigh = __ipv6_neigh_lookup_noref(dev, addr); 403 401 if (unlikely(!neigh)) 404 402 neigh = __neigh_create(&nd_tbl, addr, dev, false); 405 403 ··· 416 438 417 439 void ndisc_send_rs(struct net_device *dev, 418 440 const struct in6_addr *saddr, const struct in6_addr *daddr); 441 + 419 442 void ndisc_send_na(struct net_device *dev, const struct in6_addr *daddr, 420 443 const struct in6_addr *solicited_addr, 421 444 bool router, bool solicited, bool override, bool inc_opt);
-1
include/net/udp_tunnel.h
··· 7 7 8 8 #if IS_ENABLED(CONFIG_IPV6) 9 9 #include <net/ipv6.h> 10 - #include <net/ipv6_stubs.h> 11 10 #endif 12 11 13 12 #define UDP_TUNNEL_PARTIAL_FEATURES NETIF_F_GSO_ENCAP_ALL
-91
net/ipv6/addrconf_core.c
··· 6 6 7 7 #include <linux/export.h> 8 8 #include <net/ipv6.h> 9 - #include <net/ipv6_stubs.h> 10 9 #include <net/addrconf.h> 11 10 #include <net/ip.h> 12 11 ··· 127 128 return blocking_notifier_call_chain(&inet6addr_validator_chain, val, v); 128 129 } 129 130 EXPORT_SYMBOL(inet6addr_validator_notifier_call_chain); 130 - 131 - static struct dst_entry *eafnosupport_ipv6_dst_lookup_flow(struct net *net, 132 - const struct sock *sk, 133 - struct flowi6 *fl6, 134 - const struct in6_addr *final_dst) 135 - { 136 - return ERR_PTR(-EAFNOSUPPORT); 137 - } 138 - 139 - static int eafnosupport_ipv6_route_input(struct sk_buff *skb) 140 - { 141 - return -EAFNOSUPPORT; 142 - } 143 - 144 - static struct fib6_table *eafnosupport_fib6_get_table(struct net *net, u32 id) 145 - { 146 - return NULL; 147 - } 148 - 149 - static int 150 - eafnosupport_fib6_table_lookup(struct net *net, struct fib6_table *table, 151 - int oif, struct flowi6 *fl6, 152 - struct fib6_result *res, int flags) 153 - { 154 - return -EAFNOSUPPORT; 155 - } 156 - 157 - static int 158 - eafnosupport_fib6_lookup(struct net *net, int oif, struct flowi6 *fl6, 159 - struct fib6_result *res, int flags) 160 - { 161 - return -EAFNOSUPPORT; 162 - } 163 - 164 - static void 165 - eafnosupport_fib6_select_path(const struct net *net, struct fib6_result *res, 166 - struct flowi6 *fl6, int oif, bool have_oif_match, 167 - const struct sk_buff *skb, int strict) 168 - { 169 - } 170 - 171 - static u32 172 - eafnosupport_ip6_mtu_from_fib6(const struct fib6_result *res, 173 - const struct in6_addr *daddr, 174 - const struct in6_addr *saddr) 175 - { 176 - return 0; 177 - } 178 - 179 - static int eafnosupport_fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh, 180 - struct fib6_config *cfg, gfp_t gfp_flags, 181 - struct netlink_ext_ack *extack) 182 - { 183 - NL_SET_ERR_MSG(extack, "IPv6 support not enabled in kernel"); 184 - return -EAFNOSUPPORT; 185 - } 186 - 187 - static int eafnosupport_ip6_del_rt(struct net *net, struct fib6_info *rt, 188 - bool skip_notify) 189 - { 190 - return -EAFNOSUPPORT; 191 - } 192 - 193 - static int eafnosupport_ipv6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, 194 - int (*output)(struct net *, struct sock *, struct sk_buff *)) 195 - { 196 - kfree_skb(skb); 197 - return -EAFNOSUPPORT; 198 - } 199 - 200 - static struct net_device *eafnosupport_ipv6_dev_find(struct net *net, const struct in6_addr *addr, 201 - struct net_device *dev) 202 - { 203 - return ERR_PTR(-EAFNOSUPPORT); 204 - } 205 - 206 - const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) { 207 - .ipv6_dst_lookup_flow = eafnosupport_ipv6_dst_lookup_flow, 208 - .ipv6_route_input = eafnosupport_ipv6_route_input, 209 - .fib6_get_table = eafnosupport_fib6_get_table, 210 - .fib6_table_lookup = eafnosupport_fib6_table_lookup, 211 - .fib6_lookup = eafnosupport_fib6_lookup, 212 - .fib6_select_path = eafnosupport_fib6_select_path, 213 - .ip6_mtu_from_fib6 = eafnosupport_ip6_mtu_from_fib6, 214 - .fib6_nh_init = eafnosupport_fib6_nh_init, 215 - .ip6_del_rt = eafnosupport_ip6_del_rt, 216 - .ipv6_fragment = eafnosupport_ipv6_fragment, 217 - .ipv6_dev_find = eafnosupport_ipv6_dev_find, 218 - }; 219 - EXPORT_SYMBOL_GPL(ipv6_stub); 220 131 221 132 /* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */ 222 133 const struct in6_addr in6addr_loopback __aligned(BITS_PER_LONG/8)
-40
net/ipv6/af_inet6.c
··· 51 51 #include <net/transp_v6.h> 52 52 #include <net/ip6_route.h> 53 53 #include <net/addrconf.h> 54 - #include <net/ipv6_stubs.h> 55 54 #include <net/ndisc.h> 56 55 #ifdef CONFIG_IPV6_TUNNEL 57 56 #include <net/ip6_tunnel.h> ··· 995 996 .exit = inet6_net_exit, 996 997 }; 997 998 998 - static int ipv6_route_input(struct sk_buff *skb) 999 - { 1000 - ip6_route_input(skb); 1001 - return skb_dst(skb)->error; 1002 - } 1003 - 1004 - static const struct ipv6_stub ipv6_stub_impl = { 1005 - .ipv6_sock_mc_join = ipv6_sock_mc_join, 1006 - .ipv6_sock_mc_drop = ipv6_sock_mc_drop, 1007 - .ipv6_dst_lookup_flow = ip6_dst_lookup_flow, 1008 - .ipv6_route_input = ipv6_route_input, 1009 - .fib6_get_table = fib6_get_table, 1010 - .fib6_table_lookup = fib6_table_lookup, 1011 - .fib6_lookup = fib6_lookup, 1012 - .fib6_select_path = fib6_select_path, 1013 - .ip6_mtu_from_fib6 = ip6_mtu_from_fib6, 1014 - .fib6_nh_init = fib6_nh_init, 1015 - .fib6_nh_release = fib6_nh_release, 1016 - .fib6_nh_release_dsts = fib6_nh_release_dsts, 1017 - .fib6_update_sernum = fib6_update_sernum_stub, 1018 - .fib6_rt_update = fib6_rt_update, 1019 - .ip6_del_rt = ip6_del_rt, 1020 - .udpv6_encap_enable = udpv6_encap_enable, 1021 - .ndisc_send_na = ndisc_send_na, 1022 - #if IS_ENABLED(CONFIG_XFRM) 1023 - .xfrm6_local_rxpmtu = xfrm6_local_rxpmtu, 1024 - .xfrm6_udp_encap_rcv = xfrm6_udp_encap_rcv, 1025 - .xfrm6_gro_udp_encap_rcv = xfrm6_gro_udp_encap_rcv, 1026 - .xfrm6_rcv_encap = xfrm6_rcv_encap, 1027 - #endif 1028 - .nd_tbl = &nd_tbl, 1029 - .ipv6_fragment = ip6_fragment, 1030 - .ipv6_dev_find = ipv6_dev_find, 1031 - .ip6_xmit = ip6_xmit, 1032 - }; 1033 - 1034 999 static int __init inet6_init(void) 1035 1000 { 1036 1001 struct list_head *r; ··· 1151 1188 goto sysctl_fail; 1152 1189 #endif 1153 1190 1154 - /* ensure that ipv6 stubs are visible only after ipv6 is ready */ 1155 - wmb(); 1156 - ipv6_stub = &ipv6_stub_impl; 1157 1191 out: 1158 1192 return err; 1159 1193
-8
net/ipv6/ip6_fib.c
··· 1408 1408 __fib6_update_sernum_upto_root(rt, fib6_new_sernum(net)); 1409 1409 } 1410 1410 1411 - /* allow ipv4 to update sernum via ipv6_stub */ 1412 - void fib6_update_sernum_stub(struct net *net, struct fib6_info *f6i) 1413 - { 1414 - spin_lock_bh(&f6i->fib6_table->tb6_lock); 1415 - fib6_update_sernum_upto_root(net, f6i); 1416 - spin_unlock_bh(&f6i->fib6_table->tb6_lock); 1417 - } 1418 - 1419 1411 /* 1420 1412 * Add routing information to the routing tree. 1421 1413 * <destination addr>/<source addr>
+1 -2
net/ipv6/ip6_udp_tunnel.c
··· 162 162 fl6.fl6_dport = dport; 163 163 fl6.flowlabel = ip6_make_flowinfo(dsfield, key->label); 164 164 165 - dst = ipv6_stub->ipv6_dst_lookup_flow(net, sock->sk, &fl6, 166 - NULL); 165 + dst = ip6_dst_lookup_flow(net, sock->sk, &fl6, NULL); 167 166 if (IS_ERR(dst)) { 168 167 netdev_dbg(dev, "no route to %pI6\n", &fl6.daddr); 169 168 return ERR_PTR(-ENETUNREACH);