Convert CONFIG_IPV6 to built-in and remove stubs
Subsystems (40)
v2 cover Convert CONFIG_IPV6 to built-in and remove stubs
Historically, the Linux kernel has supported compiling the IPv6 stack as a loadable module. While this made sense in the early days of IPv6 adoption, modern deployments and distributions overwhelmingly either build IPv6 directly into the kernel (CONFIG_IPV6=y) or disable it entirely (CONFIG_IPV6=n). The modular IPv6 use-case offers image size and memory savings for specific setups, this benefit is outweighed by the architectural burden it imposes on the subsystems on implementation and maintenance.
To allow core networking, BPF, Netfilter, and various device drivers to safely interact with a potentially unloaded IPv6 module, the kernel relies on indirect call structures like ipv6_stub, ipv6_bpf_stub, and nf_ipv6_ops, along with dynamic RCU registrations for things like ICMPv6 senders.
This patch series addresses this by changing CONFIG_IPV6 from a tristate to a boolean, enforcing that IPv6 is either built-in or disabled. This allows us to completely rip out the stub infrastructures and safely replace them with direct function calls.
The bloat-o-meter report the following results for m68k, arm64, x86_64 defconfig.
m68k (keep on mind that CONFIG_IPV6 is disabled now):
add/remove: 65/938 grow/shrink: 36/254 up/down: 3022/-49692 (-46670)
arm64:
add/remove: 1251/265 grow/shrink: 81/46 up/down: 448740/-71519 (377221)
x86_64:
add/remove: 62/98 grow/shrink: 10/39 up/down: 2497/-4357 (-1860)
All the patches has been independently build tested. With allmodconfig and allmodconfig + CONFIG_IPV6=n. In addition, net selftest has been run against them on virtme-ng.
The series applied as a whole as been tested with allyesconfig and also allyesconfig + CONFIG_IPV6=n but not all patches has been independently tested this way.
This will like need to wait for [1] and [2] to be applied to avoid conflicts from net tree and rebased in top of them.
[1] https://lore.kernel.org/netdev/[email protected]/
[2] https://lore.kernel.org/netdev/[email protected]/
Fernando Fernandez Mancera (10):
ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs
ipv6: replace IS_BUILTIN(CONFIG_IPV6) with IS_ENABLED(CONFIG_IPV6)
ipv6: remove dynamic ICMPv6 sender registration infrastructure
ipv6: prepare headers for ipv6_stub removal
drivers: net: drop ipv6_stub usage and use direct function calls
ipv4: drop ipv6_stub usage and use direct function calls
net: convert remaining ipv6_stub users to direct function calls
bpf: remove ipv6_bpf_stub completely and use direct function calls
ipv6: remove ipv6_stub infrastructure completely
netfilter: remove nf_ipv6_ops and use direct function calls
arch/arm64/configs/defconfig | 2 +- arch/m68k/configs/amiga_defconfig | 45 +------- arch/m68k/configs/apollo_defconfig | 46 +------- arch/m68k/configs/atari_defconfig | 45 +------- arch/m68k/configs/bvme6000_defconfig | 45 +------- arch/m68k/configs/hp300_defconfig | 47 +------- arch/m68k/configs/mac_defconfig | 45 +------- arch/m68k/configs/multi_defconfig | 45 +------- arch/m68k/configs/mvme147_defconfig | 45 +------- arch/m68k/configs/mvme16x_defconfig | 45 +------- arch/m68k/configs/q40_defconfig | 45 +------- arch/m68k/configs/sun3_defconfig | 45 +------- arch/m68k/configs/sun3x_defconfig | 45 +------- drivers/infiniband/Kconfig | 1 - drivers/infiniband/core/addr.c | 3 +- drivers/infiniband/hw/ocrdma/Kconfig | 2 +- drivers/infiniband/sw/rxe/rxe_net.c | 6 +- drivers/infiniband/ulp/ipoib/Kconfig | 2 +- drivers/net/Kconfig | 9 -- drivers/net/ethernet/broadcom/Kconfig | 2 +- drivers/net/ethernet/chelsio/Kconfig | 2 +- .../mellanox/mlx5/core/en/rep/neigh.c | 12 ++- .../ethernet/mellanox/mlx5/core/en/tc_tun.c | 3 +- .../mellanox/mlx5/core/en/tc_tun_encap.c | 2 +- .../mellanox/mlx5/core/en_accel/ipsec.c | 1 - .../net/ethernet/mellanox/mlx5/core/en_rep.c | 1 - .../net/ethernet/mellanox/mlx5/core/en_tc.c | 1 - drivers/net/ethernet/mellanox/mlxsw/Kconfig | 1 - .../ethernet/mellanox/mlxsw/spectrum_router.c | 9 +- .../ethernet/mellanox/mlxsw/spectrum_span.c | 3 +- drivers/net/ethernet/netronome/Kconfig | 1 - .../ethernet/netronome/nfp/flower/action.c | 2 +- .../netronome/nfp/flower/tunnel_conf.c | 9 +- drivers/net/ethernet/sfc/tc_counters.c | 2 +- drivers/net/ethernet/sfc/tc_encap_actions.c | 5 +- drivers/net/geneve.c | 1 - drivers/net/gtp.c | 2 +- drivers/net/ovpn/peer.c | 3 +- drivers/net/ovpn/udp.c | 3 +- drivers/net/usb/cdc_mbim.c | 17 +-- drivers/net/vrf.c | 3 +- drivers/net/vxlan/vxlan_core.c | 11 +- drivers/net/vxlan/vxlan_multicast.c | 6 +- drivers/net/wireguard/socket.c | 3 +- drivers/net/wireless/intel/ipw2x00/ipw2100.c | 2 +- drivers/scsi/bnx2fc/Kconfig | 1 - drivers/scsi/bnx2i/Kconfig | 1 - drivers/scsi/cxgbi/cxgb3i/Kconfig | 2 +- drivers/scsi/cxgbi/cxgb4i/Kconfig | 2 +- fs/dlm/Kconfig | 2 +- fs/gfs2/Kconfig | 2 +- include/linux/icmpv6.h | 26 +---- include/linux/indirect_call_wrapper.h | 2 +- include/linux/netfilter_ipv6.h | 102 ++---------------- include/net/ip.h | 5 - include/net/ip6_fib.h | 34 +++++- include/net/ip6_route.h | 26 +++++ include/net/ipv6.h | 12 +++ include/net/ipv6_stubs.h | 102 ------------------ include/net/ndisc.h | 38 +++---- include/net/udp_tunnel.h | 3 +- net/bridge/Kconfig | 1 - net/bridge/br_arp_nd_proxy.c | 3 +- net/bridge/br_netfilter_hooks.c | 12 +-- net/bridge/br_netfilter_ipv6.c | 7 +- net/core/filter.c | 70 ++++++------ net/core/lwt_bpf.c | 10 +- net/ieee802154/6lowpan/tx.c | 2 +- net/ipv4/Kconfig | 9 +- net/ipv4/fib_semantics.c | 11 +- net/ipv4/icmp.c | 2 +- net/ipv4/nexthop.c | 21 ++-- net/ipv4/route.c | 2 +- net/ipv4/udp.c | 7 +- net/ipv6/Kconfig | 6 +- net/ipv6/addrconf.c | 10 +- net/ipv6/addrconf_core.c | 91 ---------------- net/ipv6/af_inet6.c | 69 ++---------- net/ipv6/icmp.c | 6 -- net/ipv6/ip6_fib.c | 10 +- net/ipv6/ip6_icmp.c | 46 +------- net/ipv6/ip6_offload.c | 4 +- net/ipv6/ip6_output.c | 5 +- net/ipv6/ip6_udp_tunnel.c | 3 +- net/ipv6/ndisc.c | 35 +++--- net/ipv6/netfilter.c | 48 --------- net/ipv6/route.c | 13 +-- net/l2tp/Kconfig | 1 - net/mpls/af_mpls.c | 3 +- net/netfilter/Kconfig | 8 -- net/netfilter/core.c | 3 - net/netfilter/nf_nat_masquerade.c | 21 +--- net/netfilter/nfnetlink_queue.c | 22 +++- net/netfilter/utils.c | 1 - net/openvswitch/actions.c | 3 +- net/rxrpc/Kconfig | 2 +- net/sched/sch_frag.c | 4 +- net/sctp/Kconfig | 1 - net/tipc/Kconfig | 1 - net/tipc/udp_media.c | 9 +- net/xfrm/espintcp.c | 5 +- net/xfrm/xfrm_nat_keepalive.c | 4 +- net/xfrm/xfrm_output.c | 3 +- 103 files changed, 328 insertions(+), 1301 deletions(-) delete mode 100644 include/net/ipv6_stubs.h
Signature · 1 line
2.53.0
PATCH v2 1/10 ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs
Maintaining a modular IPv6 stack offers image size and memory savings for specific setups, this benefit is outweighed by the architectural burden it imposes on the subsystems on implementation and maintenance. Therefore, drop it.
Change CONFIG_IPV6 from tristate to bool. Remove all Kconfig dependencies across the tree that explicitly checked for IPV6=m. In addition, remove MODULE_DESCRIPTION(), MODULE_ALIAS(), MODULE_AUTHOR() and MODULE_LICENSE().
This is also replacing module_init() by device_initcall(). It is not possible to use fs_initcall() as IPv4 does because that creates a race condition on IPv6 addrconf.
Finally, modify the default configs from CONFIG_IPV6=m to CONFIG_IPV6=y except for m68k as according to the bloat-o-meter the image is increasing by 330KB~ and that isn't acceptable. Instead, disable IPv6 on this architecture by default. This is aligned with m68k RAM requirements and recommendations [1].
[1] http://www.linux-m68k.org/faq/ram.html
---
v2: updated m68k default configuration to CONFIG_IPV6=n and used device_initcall() instead fs_initcall() to avoid a race condition.
--- arch/arm64/configs/defconfig | 2 +- arch/m68k/configs/amiga_defconfig | 45 +------------------- arch/m68k/configs/apollo_defconfig | 46 +------------------- arch/m68k/configs/atari_defconfig | 45 +------------------- arch/m68k/configs/bvme6000_defconfig | 45 +------------------- arch/m68k/configs/hp300_defconfig | 47 +-------------------- arch/m68k/configs/mac_defconfig | 45 +------------------- arch/m68k/configs/multi_defconfig | 45 +------------------- arch/m68k/configs/mvme147_defconfig | 45 +------------------- arch/m68k/configs/mvme16x_defconfig | 45 +------------------- arch/m68k/configs/q40_defconfig | 45 +------------------- arch/m68k/configs/sun3_defconfig | 45 +------------------- arch/m68k/configs/sun3x_defconfig | 45 +------------------- drivers/infiniband/Kconfig | 1 - drivers/infiniband/hw/ocrdma/Kconfig | 2 +- drivers/infiniband/ulp/ipoib/Kconfig | 2 +- drivers/net/Kconfig | 9 ---- drivers/net/ethernet/broadcom/Kconfig | 2 +- drivers/net/ethernet/chelsio/Kconfig | 2 +- drivers/net/ethernet/mellanox/mlxsw/Kconfig | 1 - drivers/net/ethernet/netronome/Kconfig | 1 - drivers/scsi/bnx2fc/Kconfig | 1 - drivers/scsi/bnx2i/Kconfig | 1 - drivers/scsi/cxgbi/cxgb3i/Kconfig | 2 +- drivers/scsi/cxgbi/cxgb4i/Kconfig | 2 +- fs/dlm/Kconfig | 2 +- fs/gfs2/Kconfig | 2 +- net/bridge/Kconfig | 1 - net/ipv4/Kconfig | 9 ++-- net/ipv6/Kconfig | 6 +-- net/ipv6/af_inet6.c | 8 +--- net/l2tp/Kconfig | 1 - net/netfilter/Kconfig | 8 ---- net/rxrpc/Kconfig | 2 +- net/sctp/Kconfig | 1 - net/tipc/Kconfig | 1 - 36 files changed, 40 insertions(+), 572 deletions(-)
arch/arm64/configs/defconfig +1 -1
@@ -140,7 +140,7 @@ CONFIG_IP_MULTICAST=y CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y CONFIG_IP_PNP_BOOTP=y -CONFIG_IPV6=m +CONFIG_IPV6=y CONFIG_NETFILTER=y CONFIG_BRIDGE_NETFILTER=m CONFIG_NF_CONNTRACK=m
arch/m68k/configs/amiga_defconfig +2 -43
101 lines not on this page · raw message
arch/m68k/configs/apollo_defconfig +2 -44
108 lines not on this page · raw message
arch/m68k/configs/atari_defconfig +2 -43
101 lines not on this page · raw message
arch/m68k/configs/bvme6000_defconfig +2 -43
101 lines not on this page · raw message
arch/m68k/configs/hp300_defconfig +2 -45
109 lines not on this page · raw message
arch/m68k/configs/mac_defconfig +2 -43
101 lines not on this page · raw message
arch/m68k/configs/multi_defconfig +2 -43
101 lines not on this page · raw message
arch/m68k/configs/mvme147_defconfig +2 -43
101 lines not on this page · raw message
arch/m68k/configs/mvme16x_defconfig +2 -43
101 lines not on this page · raw message
arch/m68k/configs/q40_defconfig +2 -43
101 lines not on this page · raw message
arch/m68k/configs/sun3_defconfig +2 -43
101 lines not on this page · raw message
arch/m68k/configs/sun3x_defconfig +2 -43
101 lines not on this page · raw message
drivers/infiniband/Kconfig +0 -1
@@ -4,7 +4,6 @@ menuconfig INFINIBAND depends on HAS_IOMEM && HAS_DMA depends on NET depends on INET - depends on m || IPV6 != m depends on !ALPHA select DMA_SHARED_BUFFER select IRQ_POLL
drivers/infiniband/hw/ocrdma/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config INFINIBAND_OCRDMA tristate "Emulex One Connect HCA support" - depends on ETHERNET && NETDEVICES && PCI && INET && (IPV6 || IPV6=n) + depends on ETHERNET && NETDEVICES && PCI && INET select NET_VENDOR_EMULEX select BE2NET help
drivers/infiniband/ulp/ipoib/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config INFINIBAND_IPOIB tristate "IP-over-InfiniBand" - depends on NETDEVICES && INET && (IPV6 || IPV6=n) + depends on NETDEVICES && INET help Support for the IP-over-InfiniBand protocol (IPoIB). This transports IP packets over InfiniBand so you can use your IB
drivers/net/Kconfig +0 -9
@@ -41,7 +41,6 @@ if NET_CORE config BONDING tristate "Bonding driver support" depends on INET - depends on IPV6 || IPV6=n depends on TLS || TLS_DEVICE=n help Say 'Y' or 'M' if you wish to be able to 'bond' multiple Ethernet
@@ -75,7 +74,6 @@ config DUMMY config WIREGUARD tristate "WireGuard secure network tunnel" depends on NET && INET - depends on IPV6 || !IPV6 select NET_UDP_TUNNEL select DST_CACHE select CRYPTO_LIB_CURVE25519
@@ -105,7 +103,6 @@ config WIREGUARD_DEBUG config OVPN tristate "OpenVPN data channel offload" depends on NET && INET - depends on IPV6 || !IPV6 select DST_CACHE select NET_UDP_TUNNEL select CRYPTO
@@ -202,7 +199,6 @@ config IPVLAN_L3S config IPVLAN tristate "IP-VLAN support" depends on INET - depends on IPV6 || !IPV6 help This allows one to create virtual devices off of a main interface and packets will be delivered based on the dest L3 (IPv6/IPv4 addr)
@@ -249,7 +245,6 @@ config VXLAN config GENEVE tristate "Generic Network Virtualization Encapsulation" depends on INET - depends on IPV6 || !IPV6 select NET_UDP_TUNNEL select GRO_CELLS help
@@ -265,7 +260,6 @@ config GENEVE config BAREUDP tristate "Bare UDP Encapsulation" depends on INET - depends on IPV6 || !IPV6 select NET_UDP_TUNNEL select GRO_CELLS help
@@ -308,7 +302,6 @@ config PFCP config AMT tristate "Automatic Multicast Tunneling (AMT)" depends on INET && IP_MULTICAST - depends on IPV6 || !IPV6 select NET_UDP_TUNNEL help This allows one to create AMT(Automatic Multicast Tunneling)
@@ -479,7 +472,6 @@ config NET_VRF tristate "Virtual Routing and Forwarding (Lite)" depends on IP_MULTIPLE_TABLES depends on NET_L3_MASTER_DEV - depends on IPV6 || IPV6=n depends on IPV6_MULTIPLE_TABLES || IPV6=n help This option enables the support for mapping interfaces into VRF's. The
@@ -614,7 +606,6 @@ config NETDEVSIM tristate "Simulated networking device" depends on DEBUG_FS depends on INET - depends on IPV6 || IPV6=n depends on PSAMPLE || PSAMPLE=n depends on PTP_1588_CLOCK_MOCK || PTP_1588_CLOCK_MOCK=n select NET_DEVLINK
drivers/net/ethernet/broadcom/Kconfig +1 -1
@@ -96,7 +96,7 @@ config BNX2 config CNIC tristate "QLogic CNIC support" - depends on PCI && (IPV6 || IPV6=n) + depends on PCI select BNX2 select UIO help
drivers/net/ethernet/chelsio/Kconfig +1 -1
@@ -68,7 +68,7 @@ config CHELSIO_T3 config CHELSIO_T4 tristate "Chelsio Communications T4/T5/T6 Ethernet support" - depends on PCI && (IPV6 || IPV6=n) && (TLS || TLS=n) + depends on PCI && (TLS || TLS=n) depends on PTP_1588_CLOCK_OPTIONAL select FW_LOADER select MDIO
drivers/net/ethernet/mellanox/mlxsw/Kconfig +0 -1
@@ -56,7 +56,6 @@ config MLXSW_SPECTRUM depends on MLXSW_CORE && MLXSW_PCI && NET_SWITCHDEV && VLAN_8021Q depends on PSAMPLE || PSAMPLE=n depends on BRIDGE || BRIDGE=n - depends on IPV6 || IPV6=n depends on NET_IPGRE || NET_IPGRE=n depends on IPV6_GRE || IPV6_GRE=n depends on VXLAN || VXLAN=n
drivers/net/ethernet/netronome/Kconfig +0 -1
@@ -33,7 +33,6 @@ config NFP_APP_FLOWER bool "NFP4000/NFP6000 TC Flower offload support" depends on NFP depends on NET_SWITCHDEV - depends on IPV6!=m || NFP=m default y help Enable driver support for TC Flower offload on NFP4000 and NFP6000.
drivers/scsi/bnx2fc/Kconfig +0 -1
@@ -2,7 +2,6 @@ config SCSI_BNX2X_FCOE tristate "QLogic FCoE offload support" depends on PCI - depends on (IPV6 || IPV6=n) depends on LIBFC depends on LIBFCOE select NETDEVICES
drivers/scsi/bnx2i/Kconfig +0 -1
@@ -3,7 +3,6 @@ config SCSI_BNX2_ISCSI tristate "QLogic NetXtreme II iSCSI support" depends on NET depends on PCI - depends on (IPV6 || IPV6=n) select SCSI_ISCSI_ATTRS select NETDEVICES select ETHERNET
drivers/scsi/cxgbi/cxgb3i/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config SCSI_CXGB3_ISCSI tristate "Chelsio T3 iSCSI support" - depends on PCI && INET && (IPV6 || IPV6=n) + depends on PCI && INET select NETDEVICES select ETHERNET select NET_VENDOR_CHELSIO
drivers/scsi/cxgbi/cxgb4i/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config SCSI_CXGB4_ISCSI tristate "Chelsio T4 iSCSI support" - depends on PCI && INET && (IPV6 || IPV6=n) + depends on PCI && INET depends on PTP_1588_CLOCK_OPTIONAL depends on THERMAL || !THERMAL depends on ETHERNET
fs/dlm/Kconfig +1 -1
@@ -2,7 +2,7 @@ menuconfig DLM tristate "Distributed Lock Manager (DLM)" depends on INET - depends on SYSFS && CONFIGFS_FS && (IPV6 || IPV6=n) + depends on SYSFS && CONFIGFS_FS help A general purpose distributed lock manager for kernel or userspace applications.
fs/gfs2/Kconfig +1 -1
@@ -26,7 +26,7 @@ config GFS2_FS config GFS2_FS_LOCKING_DLM bool "GFS2 DLM locking" - depends on (GFS2_FS!=n) && NET && INET && (IPV6 || IPV6=n) && \ + depends on (GFS2_FS!=n) && NET && INET && \ CONFIGFS_FS && SYSFS && (DLM=y || DLM=GFS2_FS) help Multiple node locking module for GFS2
net/bridge/Kconfig +0 -1
@@ -7,7 +7,6 @@ config BRIDGE tristate "802.1d Ethernet Bridging" select LLC select STP - depends on IPV6 || IPV6=n help If you say Y here, then your Linux box will be able to act as an Ethernet bridge, which means that the different Ethernet segments it
net/ipv4/Kconfig +4 -5
@@ -191,7 +191,7 @@ config NET_IP_TUNNEL config NET_IPGRE tristate "IP: GRE tunnels over IP" - depends on (IPV6 || IPV6=n) && NET_IPGRE_DEMUX + depends on NET_IPGRE_DEMUX select NET_IP_TUNNEL help Tunneling means encapsulating data of one protocol type within
@@ -303,7 +303,6 @@ config SYN_COOKIES config NET_IPVTI tristate "Virtual (secure) IP: tunneling" - depends on IPV6 || IPV6=n select INET_TUNNEL select NET_IP_TUNNEL select XFRM
@@ -439,7 +438,7 @@ config INET_TCP_DIAG config INET_UDP_DIAG tristate "UDP: socket monitoring interface" - depends on INET_DIAG && (IPV6 || IPV6=n) + depends on INET_DIAG default n help Support for UDP socket monitoring interface used by the ss tool.
@@ -447,7 +446,7 @@ config INET_UDP_DIAG config INET_RAW_DIAG tristate "RAW: socket monitoring interface" - depends on INET_DIAG && (IPV6 || IPV6=n) + depends on INET_DIAG default n help Support for RAW socket monitoring interface used by the ss tool.
@@ -750,7 +749,7 @@ config TCP_AO select CRYPTO select CRYPTO_LIB_UTILS select TCP_SIGPOOL - depends on 64BIT && IPV6 != m # seq-number extension needs WRITE_ONCE(u64) + depends on 64BIT # seq-number extension needs WRITE_ONCE(u64) help TCP-AO specifies the use of stronger Message Authentication Codes (MACs), protects against replays for long-lived TCP connections, and
net/ipv6/Kconfig +1 -5
@@ -3,9 +3,8 @@ # IPv6 configuration # -# IPv6 as module will cause a CRASH if you try to unload it menuconfig IPV6 - tristate "The IPv6 protocol" + bool "The IPv6 protocol" default y select CRYPTO_LIB_SHA1 help
@@ -17,9 +16,6 @@ menuconfig IPV6 Documentation/networking/ipv6.rst and read the HOWTO at <https://www.tldp.org/HOWTO/Linux+IPv6-HOWTO/> - To compile this protocol support as a module, choose M here: the - module will be called ipv6. - if IPV6 config IPV6_ROUTER_PREF
net/ipv6/af_inet6.c +1 -7
@@ -71,10 +71,6 @@#include "ip6_offload.h" -MODULE_AUTHOR ("Cast of dozens" ); -MODULE_DESCRIPTION ("IPv6 protocol stack for Linux" ); -MODULE_LICENSE ("GPL" ); -/* The inetsw6 table contains everything that inet6_create needs to * build a new socket. */
@@ -1312,6 +1308,4 @@ static int __init inet6_init(void)proto_unregister (&tcpv6_prot); goto out; } -module_init (inet6_init); - -MODULE_ALIAS_NETPROTO (PF_INET6 ); +device_initcall (inet6_init);
net/l2tp/Kconfig +0 -1
@@ -5,7 +5,6 @@ menuconfig L2TP tristate "Layer Two Tunneling Protocol (L2TP)" - depends on (IPV6 || IPV6=n) depends on INET select NET_UDP_TUNNEL help
net/netfilter/Kconfig +0 -8
@@ -249,7 +249,6 @@ config NF_CONNTRACK_FTP config NF_CONNTRACK_H323 tristate "H.323 protocol support" - depends on IPV6 || IPV6=n depends on NETFILTER_ADVANCED help H.323 is a VoIP signalling protocol from ITU-T. As one of the most
@@ -589,7 +588,6 @@ config NFT_QUOTA config NFT_REJECT default m if NETFILTER_ADVANCED=n tristate "Netfilter nf_tables reject support" - depends on !NF_TABLES_INET || (IPV6!=m || m) help This option adds the "reject" expression that you can use to explicitly deny and notify via TCP reset/ICMP informational errors
@@ -636,7 +634,6 @@ config NFT_XFRM config NFT_SOCKET tristate "Netfilter nf_tables socket match support" - depends on IPV6 || IPV6=n select NF_SOCKET_IPV4 select NF_SOCKET_IPV6 if NF_TABLES_IPV6 help
@@ -652,7 +649,6 @@ config NFT_OSF config NFT_TPROXY tristate "Netfilter nf_tables tproxy support" - depends on IPV6 || IPV6=n select NF_DEFRAG_IPV4 select NF_DEFRAG_IPV6 if NF_TABLES_IPV6 select NF_TPROXY_IPV4
@@ -1071,7 +1067,6 @@ config NETFILTER_XT_TARGET_MASQUERADE config NETFILTER_XT_TARGET_TEE tristate '"TEE" - packet cloning to alternate destination' depends on NETFILTER_ADVANCED - depends on IPV6 || IPV6=n depends on !NF_CONNTRACK || NF_CONNTRACK depends on IP6_NF_IPTABLES || !IP6_NF_IPTABLES select NF_DUP_IPV4
@@ -1084,7 +1079,6 @@ config NETFILTER_XT_TARGET_TPROXY tristate '"TPROXY" target transparent proxying support' depends on NETFILTER_XTABLES depends on NETFILTER_ADVANCED - depends on IPV6 || IPV6=n depends on IP6_NF_IPTABLES || IP6_NF_IPTABLES=n depends on IP_NF_MANGLE || NFT_COMPAT select NF_DEFRAG_IPV4
@@ -1126,7 +1120,6 @@ config NETFILTER_XT_TARGET_SECMARK config NETFILTER_XT_TARGET_TCPMSS tristate '"TCPMSS" target support' - depends on IPV6 || IPV6=n default m if NETFILTER_ADVANCED=n help This option adds a `TCPMSS' target, which allows you to alter the
@@ -1581,7 +1574,6 @@ config NETFILTER_XT_MATCH_SOCKET tristate '"socket" match support' depends on NETFILTER_XTABLES depends on NETFILTER_ADVANCED - depends on IPV6 || IPV6=n depends on IP6_NF_IPTABLES || IP6_NF_IPTABLES=n select NF_SOCKET_IPV4 select NF_SOCKET_IPV6 if IP6_NF_IPTABLES
net/rxrpc/Kconfig +1 -1
@@ -25,7 +25,7 @@ if AF_RXRPC config AF_RXRPC_IPV6 bool "IPv6 support for RxRPC" - depends on (IPV6 = m && AF_RXRPC = m) || (IPV6 = y && AF_RXRPC) + depends on IPV6 help Say Y here to allow AF_RXRPC to use IPV6 UDP as well as IPV4 UDP as its network transport.
net/sctp/Kconfig +0 -1
@@ -6,7 +6,6 @@ menuconfig IP_SCTP tristate "The SCTP Protocol" depends on INET - depends on IPV6 || IPV6=n select CRYPTO_LIB_SHA1 select CRYPTO_LIB_SHA256 select CRYPTO_LIB_UTILS
net/tipc/Kconfig +0 -1
@@ -6,7 +6,6 @@ menuconfig TIPC tristate "The TIPC Protocol" depends on INET - depends on IPV6 || IPV6=n help The Transparent Inter Process Communication (TIPC) protocol is specially designed for intra cluster communication. This protocol
Signature · 1 line
2.53.0
PATCH v2 2/10 ipv6: replace IS_BUILTIN(CONFIG_IPV6) with IS_ENABLED(CONFIG_IPV6)
In reply to Fernando Fernandez ManceraAs IPv6 is built-in only, it does not make sense to continue using IS_BUILTIN(CONFIG_IPV6). Therefore, replace it with IS_ENABLED() when necessary and drop it if it isn't valid anymore.
Notice that there is still one instance related to ICMPv6, as it requires more changes it will be handle separately.
---
v2: no changes
--- include/linux/indirect_call_wrapper.h | 2 +- include/net/ip6_fib.h | 2 +- net/core/filter.c | 14 +++++++------- net/ipv6/ip6_fib.c | 2 +- net/ipv6/ip6_offload.c | 4 ++-- net/ipv6/route.c | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-)
include/linux/indirect_call_wrapper.h +1 -1
@@ -57,7 +57,7 @@* builtin, this macro simplify dealing with indirect calls with only ipv4/ipv6 * alternatives */ -#if IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV6 )#define INDIRECT_CALL_INET (f, f2, f1, ...) \ INDIRECT_CALL_2(f, f2, f1, __VA_ARGS__)#elif IS_ENABLED (CONFIG_INET )
include/net/ip6_fib.h +1 -1
@@ -580,7 +580,7 @@ static inline bool fib6_metric_locked(struct fib6_info *f6i, int metric)void fib6_info_hw_flags_set (struct net *net,struct fib6_info *f6i,bool offload,bool trap,bool offload_failed); -#if IS_BUILTIN(CONFIG_IPV6) && defined(CONFIG_BPF_SYSCALL) +#if IS_ENABLED(CONFIG_IPV6) && defined(CONFIG_BPF_SYSCALL) struct bpf_iter__ipv6_route { __bpf_md_ptr(struct bpf_iter_meta *, meta); __bpf_md_ptr(struct fib6_info *, rt);
net/core/filter.c +7 -7
@@ -7584,7 +7584,7 @@ BPF_CALL_5(bpf_tcp_check_syncookie, struct sock *, sk, void *, iph, u32, iph_len ret =__cookie_v4_check ((struct iphdr *)iph, th);break ; -#if IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV6 )case 6 :if (unlikely (iph_len <sizeof (struct ipv6hdr )))return -EINVAL ;
@@ -7654,7 +7654,7 @@ BPF_CALL_5(bpf_tcp_gen_syncookie, struct sock *, sk, void *, iph, u32, iph_len, mss =tcp_v4_get_syncookie (sk, iph, th, &cookie);break ; -#if IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV6 )case 6 :if (unlikely (iph_len <sizeof (struct ipv6hdr )))return -EINVAL ;
@@ -8020,7 +8020,7 @@ static const struct bpf_func_proto bpf_tcp_raw_gen_syncookie_ipv4_proto = { BPF_CALL_3(bpf_tcp_raw_gen_syncookie_ipv6, struct ipv6hdr *, iph, struct tcphdr *, th, u32, th_len) { -#if IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV6 )const u16 mss_clamp =IPV6_MIN_MTU -sizeof (struct tcphdr ) -sizeof (struct ipv6hdr );u32 cookie;
@@ -8072,7 +8072,7 @@ static const struct bpf_func_proto bpf_tcp_raw_check_syncookie_ipv4_proto = { BPF_CALL_2(bpf_tcp_raw_check_syncookie_ipv6, struct ipv6hdr *, iph, struct tcphdr *, th) { -#if IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV6 )if (__cookie_v6_check (iph, th) >0 )return 0 ;
@@ -11958,7 +11958,7 @@ BPF_CALL_1(bpf_skc_to_tcp_timewait_sock, struct sock *, sk)return (unsigned long )sk;#endif -#if IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV6 )if (sk && sk->sk_prot == &tcpv6_prot && sk->sk_state ==TCP_TIME_WAIT )return (unsigned long )sk;#endif
@@ -11981,7 +11981,7 @@ BPF_CALL_1(bpf_skc_to_tcp_request_sock, struct sock *, sk)return (unsigned long )sk;#endif -#if IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV6 )if (sk && sk->sk_prot == &tcpv6_prot && sk->sk_state ==TCP_NEW_SYN_RECV )return (unsigned long )sk;#endif
@@ -12244,7 +12244,7 @@ __bpf_kfunc int bpf_sk_assign_tcp_reqsk(struct __sk_buff *s, struct sock *sk, ops = &tcp_request_sock_ops; min_mss =536 ;break ; -#if IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV6 )case htons (ETH_P_IPV6 ): ops = &tcp6_request_sock_ops; min_mss =IPV6_MIN_MTU -60 ;
net/ipv6/ip6_fib.c +1 -1
@@ -2763,7 +2763,7 @@ static void ipv6_route_native_seq_stop(struct seq_file *seq, void *v)rcu_read_unlock (); } -#if IS_BUILTIN (CONFIG_IPV6 ) && defined(CONFIG_BPF_SYSCALL ) +#if IS_ENABLED (CONFIG_IPV6 ) && defined(CONFIG_BPF_SYSCALL )static int ipv6_route_prog_seq_show (struct bpf_prog *prog,struct bpf_iter_meta *meta,void *v)
net/ipv6/ip6_offload.c +2 -2
@@ -286,7 +286,7 @@ INDIRECT_CALLABLE_SCOPE struct sk_buff *ipv6_gro_receive(struct list_head *head,if (likely (proto ==IPPROTO_TCP )) pp =tcp6_gro_receive (head, skb); -#if IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV6 ) else if (likely(proto == IPPROTO_UDP)) pp =udp6_gro_receive (head, skb);#endif
@@ -346,7 +346,7 @@ INDIRECT_CALLABLE_SCOPE int ipv6_gro_complete(struct sk_buff *skb, int nhoff)if (likely (ops == &net_hotdata.tcpv6_offload))return tcp6_gro_complete (skb, nhoff); -#if IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV6 )if (ops == &net_hotdata.udpv6_offload)return udp6_gro_complete (skb, nhoff);#endif
net/ipv6/route.c +3 -3
@@ -6826,7 +6826,7 @@ void __init ip6_route_init_special_entries(void)#endif } -#if IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV6 )#if defined(CONFIG_BPF_SYSCALL ) && defined(CONFIG_PROC_FS ) DEFINE_BPF_ITER_FUNC(ipv6_route, struct bpf_iter_meta *meta, struct fib6_info *rt)
@@ -6921,7 +6921,7 @@ int __init ip6_route_init(void)if (ret) goto out_register_late_subsys; -#if IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV6 )#if defined(CONFIG_BPF_SYSCALL ) && defined(CONFIG_PROC_FS ) ret =bpf_iter_register ();if (ret)
@@ -6961,7 +6961,7 @@ int __init ip6_route_init(void)void ip6_route_cleanup (void ) { -#if IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV6 )#if defined(CONFIG_BPF_SYSCALL ) && defined(CONFIG_PROC_FS )bpf_iter_unregister ();#endif
Signature · 1 line
2.53.0
PATCH v2 3/10 ipv6: remove dynamic ICMPv6 sender registration infrastructure
In reply to Fernando Fernandez ManceraAs IPv6 is built-in only, there is no need to maintain the sender registration infrastructure used to allow built-in subsystems to send ICMPv6 messages when IPv6 was compiled as a module.
Drop the registration mechanism and the __icmpv6_send() sender implementation. While icmpv6_send() users could be converted to icmp6_send() that doesn't seems necessary as none of them are using the force_saddr parameter.
---
v2: no changes
--- include/linux/icmpv6.h | 26 ++---------------------- net/ipv6/icmp.c | 6 ------ net/ipv6/ip6_icmp.c | 46 +++--------------------------------------- 3 files changed, 5 insertions(+), 73 deletions(-)
include/linux/icmpv6.h +2 -24
@@ -21,32 +21,10 @@ typedef void ip6_icmp_send_t(struct sk_buff *skb, u8 type, u8 code, __u32 info,void icmp6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info,const struct in6_addr *force_saddr,const struct inet6_skb_parm *parm); -#if IS_BUILTIN (CONFIG_IPV6 ) -static inline void __icmpv6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info, -const struct inet6_skb_parm *parm) -{ -icmp6_send (skb, type, code, info,NULL , parm); -} -static inline int inet6_register_icmp_sender (ip6_icmp_send_t *fn) -{ -BUILD_BUG_ON (fn != icmp6_send); -return 0 ; -} -static inline int inet6_unregister_icmp_sender (ip6_icmp_send_t *fn) -{ -BUILD_BUG_ON (fn != icmp6_send); -return 0 ; -} -#else -extern void __icmpv6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info, -const struct inet6_skb_parm *parm); -extern int inet6_register_icmp_sender (ip6_icmp_send_t *fn); -extern int inet6_unregister_icmp_sender (ip6_icmp_send_t *fn); -#endif static inline void icmpv6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info) { -__icmpv6_send (skb, type, code, info,IP6CB (skb)); +icmp6_send (skb, type, code, info,NULL ,IP6CB (skb)); } int ip6_err_gen_icmpv6_unreach(struct sk_buff *skb, int nhs, int type,
@@ -58,7 +36,7 @@ void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info);static inline void icmpv6_ndo_send (struct sk_buff *skb_in,u8 type,u8 code,__u32 info) {struct inet6_skb_parm parm = {0 }; -__icmpv6_send (skb_in, type, code, info, &parm); +icmp6_send (skb_in, type, code, info,NULL , &parm); }#endif
net/ipv6/icmp.c +0 -6
@@ -1288,13 +1288,8 @@ int __init icmpv6_init(void)if (inet6_add_protocol (&icmpv6_protocol,IPPROTO_ICMPV6 ) <0 ) goto fail; - err =inet6_register_icmp_sender (icmp6_send); -if (err) - goto sender_reg_err;return 0 ; -sender_reg_err: -inet6_del_protocol (&icmpv6_protocol,IPPROTO_ICMPV6 ); fail:pr_err ("Failed to register ICMP6 protocol\n" );return err;
@@ -1302,7 +1297,6 @@ int __init icmpv6_init(void)void icmpv6_cleanup (void ) { -inet6_unregister_icmp_sender (icmp6_send);inet6_del_protocol (&icmpv6_protocol,IPPROTO_ICMPV6 ); }
net/ipv6/ip6_icmp.c +3 -43
68 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v2 5/10 drivers: net: drop ipv6_stub usage and use direct function calls
In reply to Fernando Fernandez ManceraAs 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.
---
v2: no changes
--- drivers/infiniband/core/addr.c | 3 +-- drivers/infiniband/sw/rxe/rxe_net.c | 6 +++--- .../ethernet/mellanox/mlx5/core/en/rep/neigh.c | 12 ++++++++---- .../net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 3 +-- .../mellanox/mlx5/core/en/tc_tun_encap.c | 2 +- .../mellanox/mlx5/core/en_accel/ipsec.c | 1 - .../net/ethernet/mellanox/mlx5/core/en_rep.c | 1 - drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 1 - .../ethernet/mellanox/mlxsw/spectrum_router.c | 9 +++++---- .../net/ethernet/mellanox/mlxsw/spectrum_span.c | 3 ++- .../net/ethernet/netronome/nfp/flower/action.c | 2 +- .../ethernet/netronome/nfp/flower/tunnel_conf.c | 9 ++++----- drivers/net/ethernet/sfc/tc_counters.c | 2 +- drivers/net/ethernet/sfc/tc_encap_actions.c | 5 ++--- drivers/net/geneve.c | 1 - drivers/net/gtp.c | 2 +- drivers/net/ovpn/peer.c | 3 +-- drivers/net/ovpn/udp.c | 3 +-- drivers/net/usb/cdc_mbim.c | 17 +++++++++-------- drivers/net/vrf.c | 3 ++- drivers/net/vxlan/vxlan_core.c | 11 +++++------ drivers/net/vxlan/vxlan_multicast.c | 6 ++---- drivers/net/wireguard/socket.c | 3 +-- drivers/net/wireless/intel/ipw2x00/ipw2100.c | 2 +- net/bridge/br_arp_nd_proxy.c | 3 +-- 25 files changed, 53 insertions(+), 60 deletions(-)
drivers/infiniband/core/addr.c +1 -2
@@ -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);
drivers/infiniband/sw/rxe/rxe_net.c +3 -3
@@ -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 ;
drivers/net/ethernet/mellanox/mlx5/core/en/rep/neigh.c +8 -4
@@ -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,10 @@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 ); +struct neigh_table *tbl =ipv6_get_nd_tbl (); + +if (IS_ENABLED (CONFIG_IPV6 ) &&ipv6_mod_enabled ()) +return NEIGH_VAR (&tbl->parms,DELAY_PROBE_TIME );return ~0UL ; }
@@ -217,7 +220,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 !=ipv6_get_nd_tbl () && n->tbl != &arp_tbl) #else if (n->tbl != &arp_tbl)#endif
@@ -238,7 +241,8 @@ 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 !=ipv6_get_nd_tbl () && p->tbl != &arp_tbl)) #else if (!p->dev || p->tbl != &arp_tbl)#endif
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +1 -2
@@ -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);
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c +1 -1
@@ -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 =ipv6_get_nd_tbl ();#endif else return;
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c +0 -1
@@ -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"
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +0 -1
@@ -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"
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +0 -1
@@ -40,7 +40,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>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +5 -4
@@ -2458,7 +2458,7 @@ static void mlxsw_sp_router_neigh_ent_ipv6_process(struct mlxsw_sp *mlxsw_sp, } dev =mlxsw_sp_rif_dev (mlxsw_sp->router->rifs[rif]); - n =neigh_lookup (&nd_tbl, &dip, dev); + n =neigh_lookup (ipv6_get_nd_tbl (), &dip, dev);if (!n)return ;
@@ -3022,7 +3022,8 @@ static int mlxsw_sp_neigh_rif_made_sync(struct mlxsw_sp *mlxsw_sp, goto err_arp;#if IS_ENABLED (CONFIG_IPV6 ) -neigh_for_each (&nd_tbl, mlxsw_sp_neigh_rif_made_sync_each, &rms); +neigh_for_each (ipv6_get_nd_tbl (), + mlxsw_sp_neigh_rif_made_sync_each, &rms);#endif if (rms.err) goto err_nd;
@@ -5124,7 +5125,7 @@ mlxsw_sp_nexthop_obj_init(struct mlxsw_sp *mlxsw_sp,case AF_INET6 :memcpy (&nh->gw_addr, &nh_obj->ipv6,sizeof (nh_obj->ipv6));#if IS_ENABLED (CONFIG_IPV6 ) - nh->neigh_tbl = &nd_tbl; + nh->neigh_tbl =ipv6_get_nd_tbl ();#endif break ; }
@@ -6980,7 +6981,7 @@ static int mlxsw_sp_nexthop6_init(struct mlxsw_sp *mlxsw_sp, nh->nh_weight = rt->fib6_nh->fib_nh_weight;memcpy (&nh->gw_addr, &rt->fib6_nh->fib_nh_gw6,sizeof (nh->gw_addr));#if IS_ENABLED (CONFIG_IPV6 ) - nh->neigh_tbl = &nd_tbl; + nh->neigh_tbl =ipv6_get_nd_tbl ();#endif err =mlxsw_sp_nexthop_counter_enable (mlxsw_sp, nh);
drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c +2 -1
@@ -576,7 +576,8 @@ mlxsw_sp_span_entry_gretap6_parms(struct mlxsw_sp *mlxsw_sp, l3edev =mlxsw_sp_span_gretap6_route (to_dev, &saddr.addr6, &gw.addr6);return mlxsw_sp_span_entry_tunnel_parms_common (l3edev, saddr, daddr, gw, tparm.hop_limit, - &nd_tbl, sparmsp); +ipv6_get_nd_tbl (), + sparmsp); } static int
drivers/net/ethernet/netronome/nfp/flower/action.c +1 -1
@@ -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);
drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +4 -5
@@ -277,7 +277,7 @@ void nfp_tunnel_keep_alive_v6(struct nfp_app *app, struct sk_buff *skb)if (!netdev)continue ; - n =neigh_lookup (&nd_tbl, ipv6_add, netdev); + n =neigh_lookup (ipv6_get_nd_tbl (), ipv6_add, netdev);if (!n)continue ;
@@ -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 !=ipv6_get_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
drivers/net/ethernet/sfc/tc_counters.c +1 -1
@@ -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 (ipv6_get_nd_tbl (), &encap->neigh->dst_ip6, encap->neigh->egdev);#else
drivers/net/ethernet/sfc/tc_encap_actions.c +2 -3
@@ -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 == ipv6_get_nd_tbl()) { ipv6 = true; keysize =sizeof (keys.dst_ip6);#endif
drivers/net/geneve.c +0 -1
@@ -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>
drivers/net/gtp.c +1 -1
@@ -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 );
drivers/net/ovpn/peer.c +1 -2
@@ -821,8 +821,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);
drivers/net/ovpn/udp.c +1 -2
@@ -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",
drivers/net/usb/cdc_mbim.c +9 -8
@@ -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 @@ static struct sk_buff *cdc_mbim_tx_fixup(struct usbnet *dev, struct sk_buff *skbreturn 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 :
drivers/net/vrf.c +2 -1
@@ -616,7 +616,8 @@ static int vrf_finish_output6(struct net *net, struct sock *sk, nexthop =rt6_nexthop (dst_rt6_info (dst), &ipv6_hdr (skb)->daddr); neigh =__ipv6_neigh_lookup_noref (dst->dev, nexthop);if (unlikely (!neigh)) - neigh =__neigh_create (&nd_tbl, nexthop, dst->dev, false); + neigh =__neigh_create (ipv6_get_nd_tbl (), nexthop, + dst->dev, false);if (!IS_ERR (neigh)) {sock_confirm_neigh (skb, neigh); ret =neigh_output (neigh, skb, false);
drivers/net/vxlan/vxlan_core.c +5 -6
@@ -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 (ipv6_get_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 (ipv6_get_nd_tbl (), &pip6->daddr, dev);if (!n && (vxlan->cfg.flags &VXLAN_F_L3MISS )) {union vxlan_addr ipa = { .sin6.sin6_addr = pip6->daddr,
drivers/net/vxlan/vxlan_multicast.c +2 -4
@@ -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 }
drivers/net/wireguard/socket.c +1 -2
@@ -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",
drivers/net/wireless/intel/ipw2x00/ipw2100.c +1 -1
@@ -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 ;
net/bridge/br_arp_nd_proxy.c +1 -2
@@ -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 (ipv6_get_nd_tbl (), &msg->target, vlandev);if (n) {struct net_bridge_fdb_entry *f;
Signature · 1 line
2.53.0
PATCH v2 4/10 ipv6: prepare headers for ipv6_stub removal
In reply to Fernando Fernandez ManceraIn preparation for dropping ipv6_stub and converting its users to direct function calls, introduce static inline dummy functions and fallback macros in the IPv6 networking headers.
These fallbacks ensure that when CONFIG_IPV6 is completely disabled, there are no compiling or linking errors due to code paths not guarded by preprocessor macro IS_ENABLED(CONFIG_IPV6).
In addition, export ndisc_send_na(), ip6_route_input() and ip6_fragment().
---
v2: no changes
--- include/net/ip6_fib.h | 31 +++++++++++++++++++++++++++++++ include/net/ip6_route.h | 26 ++++++++++++++++++++++++++ include/net/ipv6.h | 10 ++++++++++ include/net/ndisc.h | 13 ++++++++++++- net/ipv6/ip6_output.c | 1 + net/ipv6/ndisc.c | 1 + net/ipv6/route.c | 1 + 7 files changed, 82 insertions(+), 1 deletion(-)
include/net/ip6_fib.h +31 -0
@@ -486,11 +486,29 @@ void rt6_get_prefsrc(const struct rt6_info *rt, struct in6_addr *addr)rcu_read_unlock (); } +#if IS_ENABLED (CONFIG_IPV6 )int fib6_nh_init (struct net *net,struct fib6_nh *fib6_nh,struct fib6_config *cfg,gfp_t gfp_flags,struct netlink_ext_ack *extack);void fib6_nh_release (struct fib6_nh *fib6_nh);void fib6_nh_release_dsts (struct fib6_nh *fib6_nh); +#else +static inline int fib6_nh_init (struct net *net,struct fib6_nh *fib6_nh, +struct fib6_config *cfg,gfp_t gfp_flags, +struct netlink_ext_ack *extack) +{ +return -EAFNOSUPPORT ; +} + +static inline void fib6_nh_release (struct fib6_nh *fib6_nh) +{ +} + +static inline void fib6_nh_release_dsts (struct fib6_nh *fib6_nh) +{ +} +#endif + int call_fib6_entry_notifiers(struct net *net, enum fib_event_type event_type,
@@ -502,8 +520,15 @@ int call_fib6_multipath_entry_notifiers(struct net *net,unsigned int nsiblings, struct netlink_ext_ack *extack);int call_fib6_entry_notifiers_replace (struct net *net,struct fib6_info *rt); +#if IS_ENABLED (CONFIG_IPV6 )void fib6_rt_update (struct net *net,struct fib6_info *rt,struct nl_info *info); +#else +static inline void fib6_rt_update (struct net *net,struct fib6_info *rt, +struct nl_info *info) +{ +} +#endif void inet6_rt_notify (int event,struct fib6_info *rt,struct nl_info *info,unsigned int flags);
@@ -568,7 +593,13 @@ unsigned int fib6_tables_seq_read(const struct net *net);int fib6_tables_dump (struct net *net,struct notifier_block *nb,struct netlink_ext_ack *extack); +#if IS_ENABLED (CONFIG_IPV6 )void fib6_update_sernum (struct net *net,struct fib6_info *rt); +#else +static inline void fib6_update_sernum (struct net *net,struct fib6_info *rt) +{ +} +#endif void fib6_update_sernum_upto_root (struct net *net,struct fib6_info *rt);void fib6_update_sernum_stub (struct net *net,struct fib6_info *f6i);
include/net/ip6_route.h +26 -0
@@ -77,7 +77,14 @@ static inline bool rt6_qualify_for_ecmp(const struct fib6_info *f6i) f6i->fib6_nh->fib_nh_gw_family; } +#if IS_ENABLED (CONFIG_IPV6 )void ip6_route_input (struct sk_buff *skb); +#else +static inline void ip6_route_input (struct sk_buff *skb) +{ +} +#endif + struct dst_entry *ip6_route_input_lookup(struct net *net, struct net_device *dev, struct flowi6 *fl6,
@@ -119,7 +126,15 @@ int ipv6_route_ioctl(struct net *net, unsigned int cmd,int ip6_route_add (struct fib6_config *cfg,gfp_t gfp_flags,struct netlink_ext_ack *extack);int ip6_ins_rt (struct net *net,struct fib6_info *f6i); +#if IS_ENABLED (CONFIG_IPV6 )int ip6_del_rt (struct net *net,struct fib6_info *f6i,bool skip_notify); +#else +static inline int ip6_del_rt (struct net *net,struct fib6_info *f6i, +bool skip_notify) +{ +return -EAFNOSUPPORT ; +} +#endif void rt6_flush_exceptions (struct fib6_info *f6i); void rt6_age_exceptions(struct fib6_info *f6i, struct fib6_gc_args *gc_args,
@@ -270,8 +285,19 @@ static inline bool ipv6_anycast_destination(const struct dst_entry *dst,return __ipv6_anycast_destination (&rt->rt6i_dst, rt->rt6i_flags, daddr); } +#if IS_ENABLED (CONFIG_IPV6 )int ip6_fragment (struct net *net,struct sock *sk,struct sk_buff *skb,int (*output)(struct net *,struct sock *,struct sk_buff *)); +#else +static inline int ip6_fragment (struct net *net,struct sock *sk, +struct sk_buff *skb, +int (*output)(struct net *,struct sock *, +struct sk_buff *)) +{ +kfree_skb (skb); +return -EAFNOSUPPORT ; +} +#endif /* Variant of dst_mtu() for IPv6 users */ static inline u32 dst6_mtu (const struct dst_entry *dst)
include/net/ipv6.h +10 -0
@@ -1044,8 +1044,18 @@ static inline struct sk_buff *ip6_finish_skb(struct sock *sk)int ip6_dst_lookup (struct net *net,struct sock *sk,struct dst_entry **dst,struct flowi6 *fl6); +#if IS_ENABLED (CONFIG_IPV6 )struct dst_entry *ip6_dst_lookup_flow (struct net *net,const struct sock *sk,struct flowi6 *fl6,const struct in6_addr *final_dst); +#else +static inline struct dst_entry *ip6_dst_lookup_flow (struct net *net,const struct sock *sk, +struct flowi6 *fl6, +const struct in6_addr *final_dst) +{ +return ERR_PTR (-EAFNOSUPPORT ); +} +#endif +struct dst_entry *ip6_sk_dst_lookup_flow (struct sock *sk,struct flowi6 *fl6,const struct in6_addr *final_dst,bool connected);
include/net/ndisc.h +12 -1
@@ -69,6 +69,12 @@ struct prefix_info;extern struct neigh_table nd_tbl; +#if IS_ENABLED (CONFIG_IPV6 ) +#define ipv6_get_nd_tbl () (&nd_tbl) +#else +#define ipv6_get_nd_tbl () NULL +#endif +struct nd_msg {struct icmp6hdr icmph;struct in6_addr target;
@@ -356,7 +362,8 @@ static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, _static inline struct neighbour *__ipv6_neigh_lookup_noref (struct net_device *dev,const void *pkey) { -return ___neigh_lookup_noref (&nd_tbl, neigh_key_eq128, ndisc_hashfn, pkey, dev); +return ___neigh_lookup_noref (ipv6_get_nd_tbl (), neigh_key_eq128, + ndisc_hashfn, pkey, dev); } static inline
@@ -406,6 +413,7 @@ static inline void __ipv6_confirm_neigh_stub(struct net_device *dev,static inline struct neighbour *ip_neigh_gw6 (struct net_device *dev,const void *addr) { +#if IS_ENABLED (CONFIG_IPV6 )struct neighbour *neigh; neigh =__ipv6_neigh_lookup_noref_stub (dev, addr);
@@ -413,6 +421,9 @@ static inline struct neighbour *ip_neigh_gw6(struct net_device *dev, neigh =__neigh_create (ipv6_stub->nd_tbl, addr, dev, false);return neigh; +#else +return ERR_PTR (-EAFNOSUPPORT ); +#endif }int ndisc_init (void );
net/ipv6/ip6_output.c +1 -0
@@ -1045,6 +1045,7 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,kfree_skb (skb);return err; } +EXPORT_SYMBOL_GPL (ip6_fragment); static inline int ip6_rt_check(const struct rt6key *rt_key, const struct in6_addr *fl_addr,
net/ipv6/ndisc.c +1 -0
@@ -576,6 +576,7 @@ void ndisc_send_na(struct net_device *dev, const struct in6_addr *daddr,ndisc_send_skb (skb, daddr, src_addr); } +EXPORT_SYMBOL_GPL (ndisc_send_na);static void ndisc_send_unsol_na (struct net_device *dev) {
net/ipv6/route.c +1 -0
@@ -2655,6 +2655,7 @@ void ip6_route_input(struct sk_buff *skb)skb_dst_set_noref (skb,ip6_route_input_lookup (net, skb->dev, &fl6, skb, flags)); } +EXPORT_SYMBOL_GPL (ip6_route_input); INDIRECT_CALLABLE_SCOPE struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table,
Signature · 1 line
2.53.0
PATCH v2 7/10 net: convert remaining ipv6_stub users to direct function calls
In reply to Fernando Fernandez ManceraAs IPv6 is built-in only, the ipv6_stub infrastruture is no longer necessary.
Convert remaining ipv6_stub users to make direct function calls. The fallback functions introduced previously will prevent linkage errors when CONFIG_IPV6 is disabled.
---
v2: no changes
--- include/net/udp_tunnel.h | 2 +- net/ieee802154/6lowpan/tx.c | 2 +- net/mpls/af_mpls.c | 3 +-- net/openvswitch/actions.c | 3 ++- net/sched/sch_frag.c | 4 ++-- net/tipc/udp_media.c | 9 +++------ net/xfrm/espintcp.c | 5 +---- net/xfrm/xfrm_nat_keepalive.c | 4 ++-- net/xfrm/xfrm_output.c | 3 +-- 9 files changed, 14 insertions(+), 21 deletions(-)
include/net/udp_tunnel.h +1 -1
@@ -230,7 +230,7 @@ static inline void udp_tunnel_encap_enable(struct sock *sk)#if IS_ENABLED (CONFIG_IPV6 )if (READ_ONCE (sk->sk_family) ==PF_INET6 ) - ipv6_stub->udpv6_encap_enable (); +udpv6_encap_enable ();#endif udp_encap_enable (); }
net/ieee802154/6lowpan/tx.c +1 -1
@@ -59,7 +59,7 @@ int lowpan_header_create(struct sk_buff *skb, struct net_device *ldev, }else {__le16 short_addr =cpu_to_le16 (IEEE802154_ADDR_SHORT_UNSPEC ); - n =neigh_lookup (&nd_tbl, &hdr->daddr, ldev); + n =neigh_lookup (ipv6_get_nd_tbl (), &hdr->daddr, ldev);if (n) { llneigh =lowpan_802154_neigh (neighbour_priv (n));read_lock_bh (&n->lock);
net/mpls/af_mpls.c +1 -2
@@ -24,7 +24,6 @@#if IS_ENABLED (CONFIG_IPV6 )#include <net/ipv6.h> #endif -#include <net/ipv6_stubs.h> #include <net/rtnh.h> #include "internal.h"
@@ -642,7 +641,7 @@ static struct net_device *inet6_fib_lookup_dev(struct net *net,memset (&fl6,0 ,sizeof (fl6));memcpy (&fl6.daddr, addr,sizeof (struct in6_addr )); - dst = ipv6_stub->ipv6_dst_lookup_flow (net,NULL , &fl6,NULL ); + dst =ip6_dst_lookup_flow (net,NULL , &fl6,NULL );if (IS_ERR (dst))return ERR_CAST (dst);
net/openvswitch/actions.c +2 -1
@@ -21,6 +21,7 @@#include <net/ip.h> #include <net/ipv6.h> #include <net/ip6_fib.h> +#include <net/ip6_route.h> #include <net/checksum.h> #include <net/dsfield.h> #include <net/mpls.h>
@@ -810,7 +811,7 @@ static void ovs_fragment(struct net *net, struct vport *vport,skb_dst_set_noref (skb, &ovs_rt.dst);IP6CB (skb)->frag_max_size = mru; - ipv6_stub->ipv6_fragment (net, skb->sk, skb, ovs_vport_output); +ip6_fragment (net, skb->sk, skb, ovs_vport_output);refdst_drop (orig_dst); }else { WARN_ONCE(1, "Failed fragment ->%s: eth=%04x, MRU=%d, MTU=%d.",
net/sched/sch_frag.c +2 -2
@@ -6,6 +6,7 @@#include <net/dst.h> #include <net/ip.h> #include <net/ip6_fib.h> +#include <net/ip6_route.h> struct sch_frag_data {unsigned long dst;
@@ -127,8 +128,7 @@ static int sch_fragment(struct net *net, struct sk_buff *skb,skb_dst_set_noref (skb, &sch_frag_rt.dst);IP6CB (skb)->frag_max_size = mru; - ret = ipv6_stub->ipv6_fragment (net, skb->sk, skb, - sch_frag_xmit); + ret =ip6_fragment (net, skb->sk, skb, sch_frag_xmit);local_unlock_nested_bh (&sch_frag_data_storage.bh_lock);refdst_drop (orig_dst); }else {
net/tipc/udp_media.c +3 -6
@@ -44,7 +44,6 @@#include <net/sock.h> #include <net/ip.h> #include <net/udp_tunnel.h> -#include <net/ipv6_stubs.h> #include <linux/tipc_netlink.h> #include "core.h" #include "addr.h"
@@ -207,9 +206,8 @@ static int tipc_udp_xmit(struct net *net, struct sk_buff *skb, .saddr = src->ipv6, .flowi6_proto = IPPROTO_UDP }; - ndst = ipv6_stub->ipv6_dst_lookup_flow (net, - ub->ubsock->sk, - &fl6,NULL ); + ndst =ip6_dst_lookup_flow (net, ub->ubsock->sk, + &fl6,NULL );if (IS_ERR (ndst)) { err =PTR_ERR (ndst); goto tx_error;
@@ -418,8 +416,7 @@ static int enable_mcast(struct udp_bearer *ub, struct udp_media_addr *remote)#if IS_ENABLED (CONFIG_IPV6 ) } else {lock_sock (sk); - err = ipv6_stub->ipv6_sock_mc_join (sk, ub->ifindex, - &remote->ipv6); + err =ipv6_sock_mc_join (sk, ub->ifindex, &remote->ipv6);release_sock (sk);#endif }
net/xfrm/espintcp.c +1 -4
@@ -7,9 +7,6 @@#include <linux/skmsg.h> #include <net/inet_common.h> #include <trace/events/sock.h> -#if IS_ENABLED (CONFIG_IPV6 ) -#include <net/ipv6_stubs.h> -#endif #include <net/hotdata.h> static void handle_nonesp(struct espintcp_ctx *ctx, struct sk_buff *skb,
@@ -43,7 +40,7 @@ static void handle_esp(struct sk_buff *skb, struct sock *sk)local_bh_disable ();#if IS_ENABLED (CONFIG_IPV6 )if (sk->sk_family ==AF_INET6 ) - ipv6_stub->xfrm6_rcv_encap (skb,IPPROTO_ESP ,0 ,TCP_ENCAP_ESPINTCP ); +xfrm6_rcv_encap (skb,IPPROTO_ESP ,0 ,TCP_ENCAP_ESPINTCP ); else#endif xfrm4_rcv_encap (skb,IPPROTO_ESP ,0 ,TCP_ENCAP_ESPINTCP );
net/xfrm/xfrm_nat_keepalive.c +2 -2
@@ -98,14 +98,14 @@ static int nat_keepalive_send_ipv6(struct sk_buff *skb,local_lock_nested_bh (&nat_keepalive_sk_ipv6.bh_lock); sk =this_cpu_read (nat_keepalive_sk_ipv6.sock);sock_net_set (sk, net); - dst = ipv6_stub->ipv6_dst_lookup_flow (net, sk, &fl6,NULL ); + dst =ip6_dst_lookup_flow (net, sk, &fl6,NULL );if (IS_ERR (dst)) {local_unlock_nested_bh (&nat_keepalive_sk_ipv6.bh_lock);return PTR_ERR (dst); }skb_dst_set (skb, dst); - err = ipv6_stub->ip6_xmit (sk, skb, &fl6, skb->mark,NULL ,0 ,0 ); + err =ip6_xmit (sk, skb, &fl6, skb->mark,NULL ,0 ,0 );sock_net_set (sk, &init_net);local_unlock_nested_bh (&nat_keepalive_sk_ipv6.bh_lock);return err;
net/xfrm/xfrm_output.c +1 -2
@@ -20,7 +20,6 @@#if IS_ENABLED (CONFIG_IPV6 )#include <net/ip6_route.h> -#include <net/ipv6_stubs.h> #endif #include "xfrm_inout.h"
@@ -900,7 +899,7 @@ int xfrm6_tunnel_check_size(struct sk_buff *skb) skb->protocol =htons (ETH_P_IPV6 );if (xfrm6_local_dontfrag (sk)) - ipv6_stub->xfrm6_local_rxpmtu (skb, mtu); +xfrm6_local_rxpmtu (skb, mtu);else if (sk)xfrm_local_error (skb, mtu);else
Signature · 1 line
2.53.0
PATCH v2 6/10 ipv4: drop ipv6_stub usage and use direct function calls
In reply to Fernando Fernandez ManceraAs 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.
---
v2: no changes
--- net/ipv4/fib_semantics.c | 11 +++++------ net/ipv4/icmp.c | 2 +- net/ipv4/nexthop.c | 21 ++++++++++----------- net/ipv4/route.c | 2 +- net/ipv4/udp.c | 7 ++----- 5 files changed, 19 insertions(+), 24 deletions(-)
net/ipv4/fib_semantics.c +5 -6
@@ -586,8 +586,7 @@ static int fib_detect_death(struct fib_info *fi, int order,if (likely (nhc->nhc_gw_family ==AF_INET )) n =neigh_lookup (&arp_tbl, &nhc->nhc_gw.ipv4, nhc->nhc_dev);else if (nhc->nhc_gw_family ==AF_INET6 ) - n =neigh_lookup (ipv6_stub->nd_tbl, &nhc->nhc_gw.ipv6, - nhc->nhc_dev); + n =neigh_lookup (ipv6_get_nd_tbl (), &nhc->nhc_gw.ipv6, nhc->nhc_dev);else n =NULL ;
@@ -1083,7 +1082,7 @@ static int fib_check_nh_v6_gw(struct net *net, struct fib_nh *nh,struct fib6_nh fib6_nh = {};int err; - err = ipv6_stub->fib6_nh_init (net, &fib6_nh, &cfg,GFP_KERNEL , extack); + err =fib6_nh_init (net, &fib6_nh, &cfg,GFP_KERNEL , extack);if (!err) { nh->fib_nh_dev = fib6_nh.fib_nh_dev; netdev_hold(nh->fib_nh_dev, &nh->fib_nh_dev_tracker,
@@ -1091,7 +1090,7 @@ static int fib_check_nh_v6_gw(struct net *net, struct fib_nh *nh, nh->fib_nh_oif = nh->fib_nh_dev->ifindex; nh->fib_nh_scope =RT_SCOPE_LINK ; - ipv6_stub->fib6_nh_release (&fib6_nh); +fib6_nh_release (&fib6_nh); }return err;
@@ -2148,8 +2147,8 @@ static bool fib_good_nh(const struct fib_nh *nh) n =__ipv4_neigh_lookup_noref (nh->fib_nh_dev, (__force u32 )nh->fib_nh_gw4); else if (nh->fib_nh_gw_family == AF_INET6) - n =__ipv6_neigh_lookup_noref_stub (nh->fib_nh_dev, - &nh->fib_nh_gw6); + n =__ipv6_neigh_lookup_noref (nh->fib_nh_dev, + &nh->fib_nh_gw6); else n =NULL ;if (n)
net/ipv4/icmp.c +1 -1
@@ -1342,7 +1342,7 @@ bool icmp_build_probe(struct sk_buff *skb, struct icmphdr *icmphdr)case ICMP_AFI_IP6 :if (iio->ident.addr.ctype3_hdr.addrlen !=sizeof (struct in6_addr )) goto send_mal_query; - dev = ipv6_stub->ipv6_dev_find (net, &iio->ident.addr.ip_addr.ipv6_addr, dev); + dev =ipv6_dev_find (net, &iio->ident.addr.ip_addr.ipv6_addr, dev);dev_hold (dev);break ;#endif
net/ipv4/nexthop.c +10 -11
@@ -10,7 +10,7 @@#include <linux/slab.h> #include <linux/vmalloc.h> #include <net/arp.h> -#include <net/ipv6_stubs.h> +#include <net/ip6_route.h> #include <net/lwtunnel.h> #include <net/ndisc.h> #include <net/nexthop.h>
@@ -510,7 +510,7 @@ static void nexthop_free_single(struct nexthop *nh)fib_nh_release (nh->net, &nhi->fib_nh);break ;case AF_INET6 : - ipv6_stub->fib6_nh_release (&nhi->fib6_nh); +fib6_nh_release (&nhi->fib6_nh);break ; }kfree (nhi);
@@ -1367,7 +1367,7 @@ static bool ipv6_good_nh(const struct fib6_nh *nh)rcu_read_lock (); - n =__ipv6_neigh_lookup_noref_stub (nh->fib_nh_dev, &nh->fib_nh_gw6); + n =__ipv6_neigh_lookup_noref (nh->fib_nh_dev, &nh->fib_nh_gw6);if (n) state =READ_ONCE (n->nud_state);
@@ -2143,8 +2143,8 @@ static void __remove_nexthop_fib(struct net *net, struct nexthop *nh)fib6_info_hold (f6i);spin_unlock_bh (&nh->lock); - ipv6_stub->ip6_del_rt (net, f6i, - !READ_ONCE (net->ipv4.sysctl_nexthop_compat_mode)); +ip6_del_rt (net, f6i, + !READ_ONCE (net->ipv4.sysctl_nexthop_compat_mode));spin_lock_bh (&nh->lock); }
@@ -2201,7 +2201,7 @@ static void nh_rt_cache_flush(struct net *net, struct nexthop *nh,rt_cache_flush (net);list_for_each_entry (f6i, &nh->f6i_list, nh_list) - ipv6_stub->fib6_update_sernum (net, f6i); +fib6_update_sernum (net, f6i);/* if an IPv6 group was replaced, we have to release all old * dsts to make sure all refcounts are released
@@ -2215,7 +2215,7 @@ static void nh_rt_cache_flush(struct net *net, struct nexthop *nh,struct nh_info *nhi =rtnl_dereference (nhge->nh->nh_info);if (nhi->family ==AF_INET6 ) - ipv6_stub->fib6_nh_release_dsts (&nhi->fib6_nh); +fib6_nh_release_dsts (&nhi->fib6_nh); } }
@@ -2496,7 +2496,7 @@ static void __nexthop_replace_notify(struct net *net, struct nexthop *nh, }list_for_each_entry (f6i, &nh->f6i_list, nh_list) - ipv6_stub->fib6_rt_update (net, f6i, info); +fib6_rt_update (net, f6i, info); }/* send RTM_NEWROUTE with REPLACE flag set for all FIB entries
@@ -2869,13 +2869,12 @@ static int nh_create_ipv6(struct net *net, struct nexthop *nh, fib6_cfg.fc_flags |=RTF_GATEWAY ;/* sets nh_dev if successful */ - err = ipv6_stub->fib6_nh_init (net, fib6_nh, &fib6_cfg,GFP_KERNEL , - extack); + err =fib6_nh_init (net, fib6_nh, &fib6_cfg,GFP_KERNEL , extack);if (err) {/* IPv6 is not enabled, don't call fib6_nh_release */ if (err == -EAFNOSUPPORT ) goto out; - ipv6_stub->fib6_nh_release (fib6_nh); +fib6_nh_release (fib6_nh); }else { nh->nh_flags = fib6_nh->fib_nh_flags; }
net/ipv4/route.c +1 -1
@@ -447,7 +447,7 @@ static void ipv4_confirm_neigh(const struct dst_entry *dst, const void *daddr)if (rt->rt_gw_family ==AF_INET ) { pkey = (const __be32 *)&rt->rt_gw4; }else if (rt->rt_gw_family ==AF_INET6 ) { -return __ipv6_confirm_neigh_stub (dev, &rt->rt_gw6); +return __ipv6_confirm_neigh (dev, &rt->rt_gw6); }else if (!daddr || (rt->rt_flags & (RTCF_MULTICAST |RTCF_BROADCAST |RTCF_LOCAL ))) {
net/ipv4/udp.c +2 -5
@@ -117,9 +117,6 @@#include <net/addrconf.h> #include <net/udp_tunnel.h> #include <net/gro.h> -#if IS_ENABLED (CONFIG_IPV6 ) -#include <net/ipv6_stubs.h> -#endif #include <net/rps.h> struct udp_table udp_table__read_mostly ;
@@ -2970,7 +2967,7 @@ static void set_xfrm_gro_udp_encap_rcv(__u16 encap_type, unsigned short family,if (udp_test_bit (GRO_ENABLED , sk) && encap_type ==UDP_ENCAP_ESPINUDP ) {if (IS_ENABLED (CONFIG_IPV6 ) && family ==AF_INET6 ) - new_gro_receive = ipv6_stub->xfrm6_gro_udp_encap_rcv; + new_gro_receive = xfrm6_gro_udp_encap_rcv;else new_gro_receive = xfrm4_gro_udp_encap_rcv;
@@ -3043,7 +3040,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,#if IS_ENABLED (CONFIG_IPV6 )if (sk->sk_family ==AF_INET6 )WRITE_ONCE (up->encap_rcv, - ipv6_stub->xfrm6_udp_encap_rcv); + xfrm6_udp_encap_rcv); else#endif WRITE_ONCE(up->encap_rcv,
Signature · 1 line
2.53.0
PATCH v2 8/10 bpf: remove ipv6_bpf_stub completely and use direct function calls
In reply to Fernando Fernandez ManceraAs IPv6 is built-in only, the ipv6_bpf_stub can be removed completely.
Convert all ipv6_bpf_stub usage to direct function calls instead. The fallback functions introduced previously will prevent linkage errors when CONFIG_IPV6 is disabled.
---
v2: no changes
--- include/net/ipv6.h | 2 ++ include/net/ipv6_stubs.h | 21 --------------- net/core/filter.c | 56 +++++++++++++++++----------------------- net/core/lwt_bpf.c | 10 ++++--- net/ipv6/af_inet6.c | 15 +++++------ 5 files changed, 38 insertions(+), 66 deletions(-)
include/net/ipv6.h +2 -0
@@ -1151,6 +1151,8 @@ void inet6_sock_destruct(struct sock *sk);int inet6_release (struct socket *sock);int inet6_bind (struct socket *sock,struct sockaddr_unsized *uaddr,int addr_len);int inet6_bind_sk (struct sock *sk,struct sockaddr_unsized *uaddr,int addr_len); +int inet6_bind_flags (struct sock *sk,struct sockaddr_unsized *uaddr, +int addr_len,u32 flags);int inet6_getname (struct socket *sock,struct sockaddr *uaddr,int peer);int inet6_ioctl (struct socket *sock,unsigned int cmd,unsigned long arg);
include/net/ipv6_stubs.h +0 -21
@@ -78,25 +78,4 @@ struct ipv6_stub { };extern const struct ipv6_stub *ipv6_stub__read_mostly ; -/* A stub used by bpf helpers. Similarly ugly as ipv6_stub */ -struct ipv6_bpf_stub { -int (*inet6_bind)(struct sock *sk,struct sockaddr_unsized *uaddr,int addr_len, -u32 flags); -struct sock *(*udp6_lib_lookup)(const struct net *net, -const struct in6_addr *saddr,__be16 sport, -const struct in6_addr *daddr,__be16 dport, -int dif,int sdif,struct udp_table *tbl, -struct sk_buff *skb); -int (*ipv6_setsockopt)(struct sock *sk,int level,int optname, -sockptr_t optval,unsigned int optlen); -int (*ipv6_getsockopt)(struct sock *sk,int level,int optname, -sockptr_t optval,sockptr_t optlen); -int (*ipv6_dev_get_saddr)(struct net *net, -const struct net_device *dst_dev, -const struct in6_addr *daddr, -unsigned int prefs, -struct in6_addr *saddr); -}; -extern const struct ipv6_bpf_stub *ipv6_bpf_stub__read_mostly ; -#endif
net/core/filter.c +23 -33
134 lines not on this page · raw message
net/core/lwt_bpf.c +7 -3
@@ -13,7 +13,6 @@#include <net/gre.h> #include <net/ip.h> #include <net/ip6_route.h> -#include <net/ipv6_stubs.h> struct bpf_lwt_prog {struct bpf_prog *prog;
@@ -103,7 +102,12 @@ static int bpf_lwt_input_reroute(struct sk_buff *skb)dev_put (dev); }else if (skb->protocol ==htons (ETH_P_IPV6 )) {skb_dst_drop (skb); - err = ipv6_stub->ipv6_route_input (skb); +if (IS_ENABLED (CONFIG_IPV6 )) { +ip6_route_input (skb); + err =skb_dst (skb)->error; + }else { + err = -EAFNOSUPPORT ; + } }else { err = -EAFNOSUPPORT ; }
@@ -233,7 +237,7 @@ static int bpf_lwt_xmit_reroute(struct sk_buff *skb) fl6.daddr = iph6->daddr; fl6.saddr = iph6->saddr; - dst = ipv6_stub->ipv6_dst_lookup_flow (net, skb->sk, &fl6,NULL ); + dst =ip6_dst_lookup_flow (net, skb->sk, &fl6,NULL );if (IS_ERR (dst)) { err =PTR_ERR (dst); goto err;
net/ipv6/af_inet6.c +6 -9
@@ -460,6 +460,12 @@ int inet6_bind_sk(struct sock *sk, struct sockaddr_unsized *uaddr, int addr_len)return __inet6_bind (sk, uaddr, addr_len, flags); } +int inet6_bind_flags (struct sock *sk,struct sockaddr_unsized *uaddr, +int addr_len,u32 flags) +{ +return __inet6_bind (sk, uaddr, addr_len, flags); +} +/* bind for INET6 API */ int inet6_bind (struct socket *sock,struct sockaddr_unsized *uaddr,int addr_len) {
@@ -1050,14 +1056,6 @@ static const struct ipv6_stub ipv6_stub_impl = { .ip6_xmit = ip6_xmit, }; -static const struct ipv6_bpf_stub ipv6_bpf_stub_impl = { - .inet6_bind = __inet6_bind, - .udp6_lib_lookup = __udp6_lib_lookup, - .ipv6_setsockopt = do_ipv6_setsockopt, - .ipv6_getsockopt = do_ipv6_getsockopt, - .ipv6_dev_get_saddr = ipv6_dev_get_saddr, -}; -static int __init inet6_init (void ) {struct list_head *r;
@@ -1227,7 +1225,6 @@ static int __init inet6_init(void)/* ensure that ipv6 stubs are visible only after ipv6 is ready */ wmb (); ipv6_stub = &ipv6_stub_impl; - ipv6_bpf_stub = &ipv6_bpf_stub_impl; out:return err;
Signature · 1 line
2.53.0
PATCH v2 10/10 netfilter: remove nf_ipv6_ops and use direct function calls
In reply to Fernando Fernandez ManceraAs IPv6 is built-in only, nf_ipv6_ops can be removed completely as it is not longer necessary.
Convert all nf_ipv6_ops usage to direct function calls instead. In addition, remove the ipv6_netfilter_init/fini() functions as they are not necessary any longer.
---
v2: no changes
--- include/linux/netfilter_ipv6.h | 102 ++---------------------------- include/net/ip.h | 5 -- net/bridge/br_netfilter_hooks.c | 12 +--- net/bridge/br_netfilter_ipv6.c | 7 +- net/ipv6/af_inet6.c | 6 -- net/ipv6/netfilter.c | 48 -------------- net/netfilter/core.c | 3 - net/netfilter/nf_nat_masquerade.c | 21 +----- net/netfilter/nfnetlink_queue.c | 22 +++++-- net/netfilter/utils.c | 1 - 10 files changed, 32 insertions(+), 195 deletions(-)
include/linux/netfilter_ipv6.h +6 -96
@@ -34,59 +34,13 @@ struct ip6_rt_info {struct nf_queue_entry ;struct nf_bridge_frag_data ; -/* -* Hook functions for ipv6 to allow xt_* modules to be built-in even -* if IPv6 is a module. -*/ -struct nf_ipv6_ops { -#if IS_MODULE (CONFIG_IPV6 ) -int (*chk_addr)(struct net *net,const struct in6_addr *addr, -const struct net_device *dev,int strict); -int (*route_me_harder)(struct net *net,struct sock *sk,struct sk_buff *skb); -int (*dev_get_saddr)(struct net *net,const struct net_device *dev, -const struct in6_addr *daddr,unsigned int srcprefs, -struct in6_addr *saddr); -int (*route)(struct net *net,struct dst_entry **dst,struct flowi *fl, -bool strict); -u32 (*cookie_init_sequence)(const struct ipv6hdr *iph, -const struct tcphdr *th,u16 *mssp); -int (*cookie_v6_check)(const struct ipv6hdr *iph, -const struct tcphdr *th); -#endif -void (*route_input)(struct sk_buff *skb); -int (*fragment)(struct net *net,struct sock *sk,struct sk_buff *skb, -int (*output)(struct net *,struct sock *,struct sk_buff *)); -int (*reroute)(struct sk_buff *skb,const struct nf_queue_entry *entry); -#if IS_MODULE (CONFIG_IPV6 ) -int (*br_fragment)(struct net *net,struct sock *sk, -struct sk_buff *skb, -struct nf_bridge_frag_data *data, -int (*output)(struct net *,struct sock *sk, -const struct nf_bridge_frag_data *data, -struct sk_buff *)); -#endif -}; -#ifdef CONFIG_NETFILTER #include <net/addrconf.h> -extern const struct nf_ipv6_ops __rcu *nf_ipv6_ops; -static inline const struct nf_ipv6_ops *nf_get_ipv6_ops (void ) -{ -return rcu_dereference (nf_ipv6_ops); -} -static inline int nf_ipv6_chk_addr (struct net *net,const struct in6_addr *addr,const struct net_device *dev,int strict) { -#if IS_MODULE (CONFIG_IPV6 ) -const struct nf_ipv6_ops *v6_ops =nf_get_ipv6_ops (); - -if (!v6_ops) -return 1 ; - -return v6_ops->chk_addr (net, addr, dev, strict); -#elif IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV6 )return ipv6_chk_addr (net, addr, dev, strict);#else return 1 ;
@@ -99,15 +53,7 @@ int __nf_ip6_route(struct net *net, struct dst_entry **dst,static inline int nf_ip6_route (struct net *net,struct dst_entry **dst,struct flowi *fl,bool strict) { -#if IS_MODULE (CONFIG_IPV6 ) -const struct nf_ipv6_ops *v6ops =nf_get_ipv6_ops (); - -if (v6ops) -return v6ops->route (net, dst, fl, strict); - -return -EHOSTUNREACH ; -#endif -#if IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV6 )return __nf_ip6_route (net, dst, fl, strict);#else return -EHOSTUNREACH ;
@@ -129,14 +75,7 @@ static inline int nf_br_ip6_fragment(struct net *net, struct sock *sk, const struct nf_bridge_frag_data *data, struct sk_buff *)) { -#if IS_MODULE(CONFIG_IPV6) - const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops(); - -if (!v6_ops) -return 1 ; - -return v6_ops->br_fragment (net, sk, skb, data, output); -#elif IS_BUILTIN(CONFIG_IPV6) +#if IS_ENABLED(CONFIG_IPV6) return br_ip6_fragment(net, sk, skb, data, output);#else return 1 ;
@@ -147,14 +86,7 @@ int ip6_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb);static inline int nf_ip6_route_me_harder (struct net *net,struct sock *sk,struct sk_buff *skb) { -#if IS_MODULE (CONFIG_IPV6 ) -const struct nf_ipv6_ops *v6_ops =nf_get_ipv6_ops (); - -if (!v6_ops) -return -EHOSTUNREACH ; - -return v6_ops->route_me_harder (net, sk, skb); -#elif IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV6 )return ip6_route_me_harder (net, sk, skb);#else return -EHOSTUNREACH ;
@@ -165,15 +97,8 @@ static inline u32 nf_ipv6_cookie_init_sequence(const struct ipv6hdr *iph, const struct tcphdr *th, u16 *mssp) { -#if IS_ENABLED(CONFIG_SYN_COOKIES) -#if IS_MODULE (CONFIG_IPV6 ) -const struct nf_ipv6_ops *v6_ops =nf_get_ipv6_ops (); - -if (v6_ops) -return v6_ops->cookie_init_sequence (iph, th, mssp); -#elif IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED(CONFIG_IPV6) && IS_ENABLED(CONFIG_SYN_COOKIES) return __cookie_v6_init_sequence(iph, th, mssp); -#endif #endif return 0 ; }
@@ -181,15 +106,8 @@ static inline u32 nf_ipv6_cookie_init_sequence(const struct ipv6hdr *iph,static inline int nf_cookie_v6_check (const struct ipv6hdr *iph,const struct tcphdr *th) { -#if IS_ENABLED (CONFIG_SYN_COOKIES ) -#if IS_MODULE (CONFIG_IPV6 ) -const struct nf_ipv6_ops *v6_ops =nf_get_ipv6_ops (); - -if (v6_ops) -return v6_ops->cookie_v6_check (iph, th); -#elif IS_BUILTIN (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV6 ) &&IS_ENABLED (CONFIG_SYN_COOKIES )return __cookie_v6_check (iph, th); -#endif #endif return 0 ; }
@@ -198,14 +116,6 @@ __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, u_int8_t protocol);int nf_ip6_check_hbh_len (struct sk_buff *skb,u32 *plen); - -int ipv6_netfilter_init (void ); -void ipv6_netfilter_fini (void ); - -#else /* CONFIG_NETFILTER */ -static inline int ipv6_netfilter_init (void ) {return 0 ; } -static inline void ipv6_netfilter_fini (void ) {return ; } -static inline const struct nf_ipv6_ops *nf_get_ipv6_ops (void ) {return NULL ; }#endif /* CONFIG_NETFILTER */ #endif /*__LINUX_IP6_NETFILTER_H*/
include/net/ip.h +0 -5
@@ -692,13 +692,8 @@ static __inline__ void inet_reset_saddr(struct sock *sk)#endif -#if IS_MODULE (CONFIG_IPV6 ) -#define EXPORT_IPV6_MOD (X ) EXPORT_SYMBOL(X) -#define EXPORT_IPV6_MOD_GPL (X ) EXPORT_SYMBOL_GPL(X) -#else #define EXPORT_IPV6_MOD (X )#define EXPORT_IPV6_MOD_GPL (X ) -#endif static inline unsigned int ipv4_addr_hash (__be32 ip) {
net/bridge/br_netfilter_hooks.c +3 -9
@@ -32,6 +32,7 @@#include <net/ip.h> #include <net/ipv6.h> +#include <net/ip6_route.h> #include <net/addrconf.h> #include <net/dst_metadata.h> #include <net/route.h>
@@ -890,7 +891,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff }if (IS_ENABLED (CONFIG_NF_DEFRAG_IPV6 ) && skb->protocol ==htons (ETH_P_IPV6 )) { -const struct nf_ipv6_ops *v6ops =nf_get_ipv6_ops ();struct brnf_frag_data *data;if (br_validate_ipv6 (net, skb))
@@ -906,15 +906,9 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buffskb_copy_from_linear_data_offset (skb, -data->size, data->mac, data->size); -if (v6ops) { - ret = v6ops->fragment (net, sk, skb, br_nf_push_frag_xmit); -local_unlock_nested_bh (&brnf_frag_data_storage.bh_lock); -return ret; - } + ret =ip6_fragment (net, sk, skb, br_nf_push_frag_xmit);local_unlock_nested_bh (&brnf_frag_data_storage.bh_lock); - -kfree_skb (skb); -return -EMSGSIZE ; +return ret; }nf_bridge_info_free (skb);return br_dev_queue_push_xmit (net, sk, skb);
net/bridge/br_netfilter_ipv6.c +3 -4
@@ -30,6 +30,7 @@#include <net/ip.h> #include <net/ipv6.h> +#include <net/ip6_route.h> #include <net/addrconf.h> #include <net/route.h> #include <net/netfilter/br_netfilter.h>
@@ -95,15 +96,13 @@ br_nf_ipv6_daddr_was_changed(const struct sk_buff *skb,/* PF_BRIDGE/PRE_ROUTING: Undo the changes made for ip6tables * PREROUTING and continue the bridge PRE_ROUTING hook. See comment -* for br_nf_pre_routing_finish(), same logic is used here but -* equivalent IPv6 function ip6_route_input() called indirectly. +* for br_nf_pre_routing_finish(), same logic is used here. */ static int br_nf_pre_routing_finish_ipv6 (struct net *net,struct sock *sk,struct sk_buff *skb) {struct nf_bridge_info *nf_bridge =nf_bridge_info_get (skb);struct rtable *rt;struct net_device *dev = skb->dev, *br_indev; -const struct nf_ipv6_ops *v6ops =nf_get_ipv6_ops (); br_indev =nf_bridge_get_physindev (skb, net);if (!br_indev) {
@@ -120,7 +119,7 @@ static int br_nf_pre_routing_finish_ipv6(struct net *net, struct sock *sk, struc nf_bridge->in_prerouting =0 ;if (br_nf_ipv6_daddr_was_changed (skb, nf_bridge)) {skb_dst_drop (skb); - v6ops->route_input (skb); +ip6_route_input (skb);if (skb_dst (skb)->error) {kfree_skb (skb);
net/ipv6/af_inet6.c +0 -6
@@ -38,7 +38,6 @@#include <linux/inet.h> #include <linux/netdevice.h> #include <linux/icmpv6.h> -#include <linux/netfilter_ipv6.h> #include <net/ip.h> #include <net/ipv6.h>
@@ -1094,9 +1093,6 @@ static int __init inet6_init(void)if (err) goto igmp_fail; - err =ipv6_netfilter_init (); -if (err) - goto netfilter_fail;/* Create /proc/foo6 entries. */ #ifdef CONFIG_PROC_FS err = -ENOMEM ;
@@ -1237,8 +1233,6 @@ static int __init inet6_init(void)raw6_proc_exit (); proc_raw6_fail:#endif -ipv6_netfilter_fini (); -netfilter_fail:igmp6_cleanup (); igmp_fail:ndisc_cleanup ();
net/ipv6/netfilter.c +0 -48
57 lines not on this page · raw message
net/netfilter/core.c +0 -3
@@ -27,9 +27,6 @@#include "nf_internals.h" -const struct nf_ipv6_ops __rcu *nf_ipv6_ops__read_mostly ; -EXPORT_SYMBOL_GPL (nf_ipv6_ops); -#ifdef CONFIG_JUMP_LABEL struct static_key nf_hooks_needed[NFPROTO_NUMPROTO ][NF_MAX_HOOKS ];EXPORT_SYMBOL (nf_hooks_needed);
net/netfilter/nf_nat_masquerade.c +2 -19
@@ -220,23 +220,6 @@ static struct notifier_block masq_inet_notifier = { };#if IS_ENABLED (CONFIG_IPV6 ) -static int -nat_ipv6_dev_get_saddr (struct net *net,const struct net_device *dev, -const struct in6_addr *daddr,unsigned int srcprefs, -struct in6_addr *saddr) -{ -#ifdef CONFIG_IPV6_MODULE -const struct nf_ipv6_ops *v6_ops =nf_get_ipv6_ops (); - -if (!v6_ops) -return -EHOSTUNREACH ; - -return v6_ops->dev_get_saddr (net, dev, daddr, srcprefs, saddr); -#else -return ipv6_dev_get_saddr (net, dev, daddr, srcprefs, saddr); -#endif -} -unsigned int nf_nat_masquerade_ipv6 (struct sk_buff *skb,const struct nf_nat_range2 *range,const struct net_device *out)
@@ -251,8 +234,8 @@ nf_nat_masquerade_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range,WARN_ON (!(ct && (ctinfo ==IP_CT_NEW || ctinfo ==IP_CT_RELATED || ctinfo ==IP_CT_RELATED_REPLY ))); -if (nat_ipv6_dev_get_saddr (nf_ct_net (ct), out, - &ipv6_hdr (skb)->daddr,0 , &src) <0 ) +if (ipv6_dev_get_saddr (nf_ct_net (ct), out, + &ipv6_hdr (skb)->daddr,0 , &src) <0 )return NF_DROP ; nat =nf_ct_nat_ext_add (ct);
net/netfilter/nfnetlink_queue.c +18 -4
@@ -356,9 +356,25 @@ static int nf_ip_reroute(struct sk_buff *skb, const struct nf_queue_entry *entryreturn 0 ; } +static int nf_ip6_reroute (struct sk_buff *skb, +const struct nf_queue_entry *entry) +{ +struct ip6_rt_info *rt_info =nf_queue_entry_reroute (entry); + +if (entry->state.hook ==NF_INET_LOCAL_OUT ) { +const struct ipv6hdr *iph =ipv6_hdr (skb); + +if (!ipv6_addr_equal (&iph->daddr, &rt_info->daddr) || + !ipv6_addr_equal (&iph->saddr, &rt_info->saddr) || + skb->mark != rt_info->mark) +return nf_ip6_route_me_harder (entry->state.net, + entry->state.sk, skb); + } +return 0 ; +} +static int nf_reroute (struct sk_buff *skb,struct nf_queue_entry *entry) { -const struct nf_ipv6_ops *v6ops;int ret =0 ;switch (entry->state.pf) {
@@ -366,9 +382,7 @@ static int nf_reroute(struct sk_buff *skb, struct nf_queue_entry *entry) ret =nf_ip_reroute (skb, entry);break ;case AF_INET6 : - v6ops =rcu_dereference (nf_ipv6_ops); -if (v6ops) - ret = v6ops->reroute (skb, entry); + ret =nf_ip6_reroute (skb, entry);break ; }return ret;
net/netfilter/utils.c +0 -1
@@ -163,7 +163,6 @@ EXPORT_SYMBOL_GPL(nf_checksum_partial);int nf_route (struct net *net,struct dst_entry **dst,struct flowi *fl,bool strict,unsigned short family) { -const struct nf_ipv6_ops *v6ops__maybe_unused ;int ret =0 ;switch (family) {
Signature · 1 line
2.53.0
PATCH v2 9/10 ipv6: remove ipv6_stub infrastructure completely
In reply to Fernando Fernandez ManceraAs IPv6 is built-in only and there are no more users of ipv6_stub, the ipv6_stub is now entirely obsolte.
Remove all the code related to the definition, initialization and usage.
---
v2: no changes
--- include/net/ip6_fib.h | 1 - include/net/ipv6_stubs.h | 81 ---------------------------------- include/net/ndisc.h | 27 ++---------- include/net/udp_tunnel.h | 1 - net/ipv6/addrconf.c | 10 ++--- net/ipv6/addrconf_core.c | 91 --------------------------------------- net/ipv6/af_inet6.c | 40 ----------------- net/ipv6/ip6_fib.c | 8 ---- net/ipv6/ip6_output.c | 4 +- net/ipv6/ip6_udp_tunnel.c | 3 +- net/ipv6/ndisc.c | 34 +++++++-------- net/ipv6/route.c | 6 +-- 12 files changed, 31 insertions(+), 275 deletions(-) delete mode 100644 include/net/ipv6_stubs.h
include/net/ip6_fib.h +0 -1
@@ -601,7 +601,6 @@ static inline void fib6_update_sernum(struct net *net, struct fib6_info *rt) }#endif void fib6_update_sernum_upto_root (struct net *net,struct fib6_info *rt); -void fib6_update_sernum_stub (struct net *net,struct fib6_info *f6i);void fib6_metric_set (struct fib6_info *f6i,int metric,u32 val);static inline bool fib6_metric_locked (struct fib6_info *f6i,int metric)
include/net/ipv6_stubs.h deleted +0 -81
81 lines not on this page · raw message
include/net/ndisc.h +3 -24
@@ -2,8 +2,6 @@#ifndef _NDISC_H#define _NDISC_H -#include <net/ipv6_stubs.h> -/* * ICMP codes for neighbour discovery messages */
@@ -366,14 +364,6 @@ static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev ndisc_hashfn, pkey, dev); } -static inline -struct neighbour *__ipv6_neigh_lookup_noref_stub (struct net_device *dev, -const void *pkey) -{ -return ___neigh_lookup_noref (ipv6_stub->nd_tbl, neigh_key_eq128, - ndisc_hashfn, pkey, dev); -} -static inline struct neighbour *__ipv6_neigh_lookup (struct net_device *dev,const void *pkey) {struct neighbour *n;
@@ -398,27 +388,15 @@ static inline void __ipv6_confirm_neigh(struct net_device *dev,rcu_read_unlock (); } -static inline void __ipv6_confirm_neigh_stub (struct net_device *dev, -const void *pkey) -{ -struct neighbour *n; - -rcu_read_lock (); - n =__ipv6_neigh_lookup_noref_stub (dev, pkey); -neigh_confirm (n); -rcu_read_unlock (); -} - -/* uses ipv6_stub and is meant for use outside of IPv6 core */ static inline struct neighbour *ip_neigh_gw6 (struct net_device *dev,const void *addr) {#if IS_ENABLED (CONFIG_IPV6 )struct neighbour *neigh; - neigh =__ipv6_neigh_lookup_noref_stub (dev, addr); + neigh =__ipv6_neigh_lookup_noref (dev, addr);if (unlikely (!neigh)) - neigh =__neigh_create (ipv6_stub->nd_tbl, addr, dev, false); + neigh =__neigh_create (ipv6_get_nd_tbl (), addr, dev, false);return neigh;#else
@@ -445,6 +423,7 @@ void ndisc_send_skb(struct sk_buff *skb, const struct in6_addr *daddr,void ndisc_send_rs (struct net_device *dev,const struct in6_addr *saddr,const struct in6_addr *daddr); +void ndisc_send_na (struct net_device *dev,const struct in6_addr *daddr,const struct in6_addr *solicited_addr,bool router,bool solicited,bool override,bool inc_opt);
include/net/udp_tunnel.h +0 -1
@@ -7,7 +7,6 @@#if IS_ENABLED (CONFIG_IPV6 )#include <net/ipv6.h> -#include <net/ipv6_stubs.h> #endif #define UDP_TUNNEL_PARTIAL_FEATURES NETIF_F_GSO_ENCAP_ALL
net/ipv6/addrconf.c +5 -5
@@ -399,7 +399,7 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev) ndev->cnf.mtu6 = dev->mtu; ndev->ra_mtu =0 ; - ndev->nd_parms =neigh_parms_alloc (dev, &nd_tbl); + ndev->nd_parms =neigh_parms_alloc (dev,ipv6_get_nd_tbl ());if (!ndev->nd_parms) {kfree (ndev);return ERR_PTR (err);
@@ -412,7 +412,7 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev)if (snmp6_alloc_dev (ndev) <0 ) {netdev_dbg (dev,"%s: cannot allocate memory for statistics\n" , __func__); -neigh_parms_release (&nd_tbl, ndev->nd_parms); +neigh_parms_release (ipv6_get_nd_tbl (), ndev->nd_parms);netdev_put (dev, &ndev->dev_tracker);kfree (ndev);return ERR_PTR (err);
@@ -480,7 +480,7 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev)return ndev; err_release: -neigh_parms_release (&nd_tbl, ndev->nd_parms); +neigh_parms_release (ipv6_get_nd_tbl (), ndev->nd_parms); ndev->dead =1 ;in6_dev_finish_destroy (ndev);return ERR_PTR (err);
@@ -4008,8 +4008,8 @@ static int addrconf_ifdown(struct net_device *dev, bool unregister)/* Last: Shot the device (if unregistered) */ if (unregister) {addrconf_sysctl_unregister (idev); -neigh_parms_release (&nd_tbl, idev->nd_parms); -neigh_ifdown (&nd_tbl, dev); +neigh_parms_release (ipv6_get_nd_tbl (), idev->nd_parms); +neigh_ifdown (ipv6_get_nd_tbl (), dev);in6_dev_put (idev); }return 0 ;
net/ipv6/addrconf_core.c +0 -91
103 lines not on this page · raw message
net/ipv6/af_inet6.c +0 -40
@@ -52,7 +52,6 @@#include <net/transp_v6.h> #include <net/ip6_route.h> #include <net/addrconf.h> -#include <net/ipv6_stubs.h> #include <net/ndisc.h> #ifdef CONFIG_IPV6_TUNNEL #include <net/ip6_tunnel.h>
@@ -1020,42 +1019,6 @@ static struct pernet_operations inet6_net_ops = { .exit = inet6_net_exit, }; -static int ipv6_route_input (struct sk_buff *skb) -{ -ip6_route_input (skb); -return skb_dst (skb)->error; -} - -static const struct ipv6_stub ipv6_stub_impl = { - .ipv6_sock_mc_join = ipv6_sock_mc_join, - .ipv6_sock_mc_drop = ipv6_sock_mc_drop, - .ipv6_dst_lookup_flow = ip6_dst_lookup_flow, - .ipv6_route_input = ipv6_route_input, - .fib6_get_table = fib6_get_table, - .fib6_table_lookup = fib6_table_lookup, - .fib6_lookup = fib6_lookup, - .fib6_select_path = fib6_select_path, - .ip6_mtu_from_fib6 = ip6_mtu_from_fib6, - .fib6_nh_init = fib6_nh_init, - .fib6_nh_release = fib6_nh_release, - .fib6_nh_release_dsts = fib6_nh_release_dsts, - .fib6_update_sernum = fib6_update_sernum_stub, - .fib6_rt_update = fib6_rt_update, - .ip6_del_rt = ip6_del_rt, - .udpv6_encap_enable = udpv6_encap_enable, - .ndisc_send_na = ndisc_send_na, -#if IS_ENABLED(CONFIG_XFRM) - .xfrm6_local_rxpmtu = xfrm6_local_rxpmtu, - .xfrm6_udp_encap_rcv = xfrm6_udp_encap_rcv, - .xfrm6_gro_udp_encap_rcv = xfrm6_gro_udp_encap_rcv, - .xfrm6_rcv_encap = xfrm6_rcv_encap, -#endif - .nd_tbl = &nd_tbl, - .ipv6_fragment = ip6_fragment, - .ipv6_dev_find = ipv6_dev_find, - .ip6_xmit = ip6_xmit, -}; -static int __init inet6_init (void ) {struct list_head *r;
@@ -1222,9 +1185,6 @@ static int __init inet6_init(void) goto sysctl_fail;#endif -/* ensure that ipv6 stubs are visible only after ipv6 is ready */ -wmb (); - ipv6_stub = &ipv6_stub_impl; out:return err;
net/ipv6/ip6_fib.c +0 -8
@@ -1408,14 +1408,6 @@ void fib6_update_sernum_upto_root(struct net *net, struct fib6_info *rt)__fib6_update_sernum_upto_root (rt,fib6_new_sernum (net)); } -/* allow ipv4 to update sernum via ipv6_stub */ -void fib6_update_sernum_stub (struct net *net,struct fib6_info *f6i) -{ -spin_lock_bh (&f6i->fib6_table->tb6_lock); -fib6_update_sernum_upto_root (net, f6i); -spin_unlock_bh (&f6i->fib6_table->tb6_lock); -} -/* * Add routing information to the routing tree. * <destination addr>/<source addr>
net/ipv6/ip6_output.c +2 -2
@@ -125,7 +125,7 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *if (IS_ERR_OR_NULL (neigh)) {if (unlikely (!neigh)) - neigh =__neigh_create (&nd_tbl, nexthop, dev, false); + neigh =__neigh_create (ipv6_get_nd_tbl (), nexthop, dev, false);if (IS_ERR (neigh)) {IP6_INC_STATS (net, idev,IPSTATS_MIB_OUTNOROUTES );kfree_skb_reason (skb,SKB_DROP_REASON_NEIGH_CREATEFAIL );
@@ -559,7 +559,7 @@ int ip6_forward(struct sk_buff *skb)/* XXX: idev->cnf.proxy_ndp? */ if (READ_ONCE (net->ipv6.devconf_all->proxy_ndp) && -pneigh_lookup (&nd_tbl, net, &hdr->daddr, skb->dev)) { +pneigh_lookup (ipv6_get_nd_tbl (), net, &hdr->daddr, skb->dev)) {int proxied =ip6_forward_proxy_check (skb);if (proxied >0 ) {/* It's tempting to decrease the hop limit
net/ipv6/ip6_udp_tunnel.c +1 -2
@@ -162,8 +162,7 @@ struct dst_entry *udp_tunnel6_dst_lookup(struct sk_buff *skb, fl6.fl6_dport = dport; fl6.flowlabel =ip6_make_flowinfo (dsfield, key->label); - dst = ipv6_stub->ipv6_dst_lookup_flow (net, sock->sk, &fl6, -NULL ); + dst =ip6_dst_lookup_flow (net, sock->sk, &fl6,NULL );if (IS_ERR (dst)) {netdev_dbg (dev,"no route to %pI6\n" , &fl6.daddr);return ERR_PTR (-ENETUNREACH );
net/ipv6/ndisc.c +17 -17
@@ -120,7 +120,7 @@ struct neigh_table nd_tbl = { .allow_add = ndisc_allow_add, .id = "ndisc_cache", .parms = { - .tbl = &nd_tbl, + .tbl = ipv6_get_nd_tbl(), .reachable_time = ND_REACHABLE_TIME, .data = { [NEIGH_VAR_MCAST_PROBES] = 3,
@@ -769,7 +769,7 @@ static int pndisc_is_router(const void *pkey,struct pneigh_entry *n;int ret =-1 ; - n =pneigh_lookup (&nd_tbl,dev_net (dev), pkey, dev); + n =pneigh_lookup (ipv6_get_nd_tbl (),dev_net (dev), pkey, dev);if (n) ret = !!(READ_ONCE (n->flags) &NTF_ROUTER );
@@ -917,7 +917,7 @@ static enum skb_drop_reason ndisc_recv_ns(struct sk_buff *skb)*/ struct sk_buff *n =skb_clone (skb,GFP_ATOMIC );if (n) -pneigh_enqueue (&nd_tbl, idev->nd_parms, n); +pneigh_enqueue (ipv6_get_nd_tbl (), idev->nd_parms, n); goto out; } }else {
@@ -936,15 +936,15 @@ static enum skb_drop_reason ndisc_recv_ns(struct sk_buff *skb) }if (inc) -NEIGH_CACHE_STAT_INC (&nd_tbl, rcv_probes_mcast); +NEIGH_CACHE_STAT_INC (ipv6_get_nd_tbl (), rcv_probes_mcast);else -NEIGH_CACHE_STAT_INC (&nd_tbl, rcv_probes_ucast); +NEIGH_CACHE_STAT_INC (ipv6_get_nd_tbl (), rcv_probes_ucast);/* * update / create cache entry * for the source address */ - neigh =__neigh_lookup (&nd_tbl, saddr, dev, + neigh =__neigh_lookup (ipv6_get_nd_tbl (), saddr, dev, !inc || lladdr || !dev->addr_len);if (neigh) ndisc_update(dev, neigh, lladdr, NUD_STALE,
@@ -1059,7 +1059,7 @@ static enum skb_drop_reason ndisc_recv_na(struct sk_buff *skb)return reason; } - neigh =neigh_lookup (&nd_tbl, &msg->target, dev); + neigh =neigh_lookup (ipv6_get_nd_tbl (), &msg->target, dev);/* RFC 9131 updates original Neighbour Discovery RFC 4861. * NAs with Target LL Address option without a corresponding
@@ -1079,7 +1079,7 @@ static enum skb_drop_reason ndisc_recv_na(struct sk_buff *skb) new_state = msg->icmph.icmp6_solicited ?NUD_REACHABLE :NUD_STALE ;if (!neigh && lladdr && idev &&READ_ONCE (idev->cnf.forwarding)) {if (accept_untracked_na (dev, saddr)) { - neigh =neigh_create (&nd_tbl, &msg->target, dev); + neigh =neigh_create (ipv6_get_nd_tbl (), &msg->target, dev); new_state =NUD_STALE ; } }
@@ -1099,7 +1099,7 @@ static enum skb_drop_reason ndisc_recv_na(struct sk_buff *skb)if (lladdr && !memcmp (lladdr, dev->dev_addr, dev->addr_len) &&READ_ONCE (net->ipv6.devconf_all->forwarding) &&READ_ONCE (net->ipv6.devconf_all->proxy_ndp) && -pneigh_lookup (&nd_tbl, net, &msg->target, dev)) { +pneigh_lookup (ipv6_get_nd_tbl (), net, &msg->target, dev)) {/* XXX: idev->cnf.proxy_ndp */ goto out; }
@@ -1167,7 +1167,7 @@ static enum skb_drop_reason ndisc_recv_rs(struct sk_buff *skb) goto out; } - neigh =__neigh_lookup (&nd_tbl, saddr, skb->dev,1 ); + neigh =__neigh_lookup (ipv6_get_nd_tbl (), saddr, skb->dev,1 );if (neigh) { ndisc_update(skb->dev, neigh, lladdr, NUD_STALE, NEIGH_UPDATE_F_WEAK_OVERRIDE|
@@ -1464,7 +1464,7 @@ static enum skb_drop_reason ndisc_router_discovery(struct sk_buff *skb)*/ if (!neigh) - neigh =__neigh_lookup (&nd_tbl, &ipv6_hdr (skb)->saddr, + neigh =__neigh_lookup (ipv6_get_nd_tbl (), &ipv6_hdr (skb)->saddr, skb->dev,1 );if (neigh) {u8 *lladdr =NULL ;
@@ -1860,7 +1860,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event,switch (event) {case NETDEV_CHANGEADDR : -neigh_changeaddr (&nd_tbl, dev); +neigh_changeaddr (ipv6_get_nd_tbl (), dev);fib6_run_gc (0 , net, false); fallthrough;case NETDEV_UP :
@@ -1884,12 +1884,12 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, change_info = ptr;if (change_info->flags_changed &IFF_NOARP ) -neigh_changeaddr (&nd_tbl, dev); +neigh_changeaddr (ipv6_get_nd_tbl (), dev);if (evict_nocarrier && !netif_carrier_ok (dev)) -neigh_carrier_down (&nd_tbl, dev); +neigh_carrier_down (ipv6_get_nd_tbl (), dev);break ;case NETDEV_DOWN : -neigh_ifdown (&nd_tbl, dev); +neigh_ifdown (ipv6_get_nd_tbl (), dev);fib6_run_gc (0 , net, false);break ;case NETDEV_NOTIFY_PEERS :
@@ -2006,7 +2006,7 @@ int __init ndisc_init(void)/* * Initialize the neighbour table */ -neigh_table_init (NEIGH_ND_TABLE , &nd_tbl); +neigh_table_init (NEIGH_ND_TABLE ,ipv6_get_nd_tbl ());#ifdef CONFIG_SYSCTL err = neigh_sysctl_register(NULL, &nd_tbl.parms,
@@ -2039,6 +2039,6 @@ void ndisc_cleanup(void)#ifdef CONFIG_SYSCTL neigh_sysctl_unregister (&nd_tbl.parms);#endif -neigh_table_clear (NEIGH_ND_TABLE , &nd_tbl); +neigh_table_clear (NEIGH_ND_TABLE ,ipv6_get_nd_tbl ());unregister_pernet_subsys (&ndisc_net_ops); }
net/ipv6/route.c +3 -3
@@ -217,7 +217,7 @@ struct neighbour *ip6_neigh_lookup(const struct in6_addr *gw,if (n)return n; - n =neigh_create (&nd_tbl, daddr, dev); + n =neigh_create (ipv6_get_nd_tbl (), daddr, dev);return IS_ERR (n) ?NULL : n; }
@@ -4287,7 +4287,7 @@ static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_bu*/ dst_confirm_neigh (&rt->dst, &ipv6_hdr (skb)->saddr); - neigh =__neigh_lookup (&nd_tbl, &msg->target, skb->dev,1 ); + neigh =__neigh_lookup (ipv6_get_nd_tbl (), &msg->target, skb->dev,1 );if (!neigh)return ;
@@ -5017,7 +5017,7 @@ void rt6_disable_ip(struct net_device *dev, unsigned long event) {rt6_sync_down_dev (dev, event);rt6_uncached_list_flush_dev (dev); -neigh_ifdown (&nd_tbl, dev); +neigh_ifdown (ipv6_get_nd_tbl (), dev); }struct rt6_mtu_change_arg {
Signature · 1 line
2.53.0
David Ahern
maintainerRe: [PATCH 04/10 net-next v2] ipv6: prepare headers for ipv6_stub removal
In reply to Fernando Fernandez ManceraQuoted 9 lines · Fernando Fernandez Mancera
include/net/ip6_fib.h +1
-0@@ -486,11 +486,29 @@ void rt6_get_prefsrc(const struct rt6_info *rt, struct in6_addr *addr)rcu_read_unlock (); } +#if IS_ENABLED (CONFIG_IPV6 )
include/net/ip6_fib.h void rt6_get_prefsrc(const struct rt6_info *rt, struct in6_addr *addr) · line 499
Quoted 10 lines
include/net/ip6_fib.h +5
-0int fib6_nh_init (struct net *net,struct fib6_nh *fib6_nh,struct fib6_config *cfg,gfp_t gfp_flags,struct netlink_ext_ack *extack);void fib6_nh_release (struct fib6_nh *fib6_nh);void fib6_nh_release_dsts (struct fib6_nh *fib6_nh); +#else +static inline int fib6_nh_init (struct net *net,struct fib6_nh *fib6_nh, +struct fib6_config *cfg,gfp_t gfp_flags, +struct netlink_ext_ack *extack) +{
NL_SET_ERR_MSG(extack, "IPv6 support not enabled in kernel");
let's keep the helpful, user facing message
Quoted 15 lines
include/net/ip6_fib.h +12
-0+return -EAFNOSUPPORT ; +} + +static inline void fib6_nh_release (struct fib6_nh *fib6_nh) +{ +} + +static inline void fib6_nh_release_dsts (struct fib6_nh *fib6_nh) +{ +} +#endif + int call_fib6_entry_notifiers(struct net *net, enum fib_event_type event_type,
Quoted 47 lines · Fernando Fernandez Mancera
Historically, the Linux kernel has supported compiling the IPv6 stack as a loadable module. While this made sense in the early days of IPv6 adoption, modern deployments and distributions overwhelmingly either build IPv6 directly into the kernel (
CONFIG_IPV6=y) or disable it entirely (CONFIG_IPV6=n). The modular IPv6 use-case offers image size and memory savings for specific setups, this benefit is outweighed by the architectural burden it imposes on the subsystems on implementation and maintenance.To allow core networking, BPF, Netfilter, and various device drivers to safely interact with a potentially unloaded IPv6 module, the kernel relies on indirect call structures like
ipv6_stub,ipv6_bpf_stub, andnf_ipv6_ops, along with dynamic RCU registrations for things like ICMPv6 senders.This patch series addresses this by changing
CONFIG_IPV6from a tristate to a boolean, enforcing that IPv6 is either built-in or disabled. This allows us to completely rip out the stub infrastructures and safely replace them with direct function calls.The bloat-o-meter report the following results for m68k, arm64,
x86_64defconfig.m68k (keep on mind that
CONFIG_IPV6is disabled now):
add/remove: 65/938 grow/shrink: 36/254 up/down: 3022/-49692 (-46670)arm64:
add/remove: 1251/265 grow/shrink: 81/46 up/down: 448740/-71519 (377221)
x86_64:
add/remove: 62/98 grow/shrink: 10/39 up/down: 2497/-4357 (-1860)All the patches has been independently build tested. With allmodconfig and allmodconfig +
CONFIG_IPV6=n. In addition, net selftest has been run against them on virtme-ng.The series applied as a whole as been tested with allyesconfig and also allyesconfig +
CONFIG_IPV6=nbut not all patches has been independently tested this way.This will like need to wait for [1] and [2] to be applied to avoid conflicts from net tree and rebased in top of them.
Quoted 11 lines
Fernando Fernandez Mancera (10):
ipv6: convertCONFIG_IPV6to built-in only and clean up Kconfigs
ipv6: replaceIS_BUILTIN(CONFIG_IPV6)withIS_ENABLED(CONFIG_IPV6)
ipv6: remove dynamic ICMPv6 sender registration infrastructure
ipv6: prepare headers foripv6_stubremoval
drivers: net: dropipv6_stubusage and use direct function calls
ipv4: dropipv6_stubusage and use direct function calls
net: convert remainingipv6_stubusers to direct function calls
bpf: removeipv6_bpf_stubcompletely and use direct function calls
ipv6: removeipv6_stubinfrastructure completely
netfilter: removenf_ipv6_opsand use direct function calls
Using defconfig + tools/testing/selftests/net/config:
- All commits build with both IPV6=y and IPV6=n with no problems.
- All net selftests report OK on tip commit.
Quoted 106 lines
arch/arm64/configs/defconfig | 2 +- arch/m68k/configs/amiga_defconfig | 45 +------- arch/m68k/configs/apollo_defconfig | 46 +------- arch/m68k/configs/atari_defconfig | 45 +------- arch/m68k/configs/bvme6000_defconfig | 45 +------- arch/m68k/configs/hp300_defconfig | 47 +------- arch/m68k/configs/mac_defconfig | 45 +------- arch/m68k/configs/multi_defconfig | 45 +------- arch/m68k/configs/mvme147_defconfig | 45 +------- arch/m68k/configs/mvme16x_defconfig | 45 +------- arch/m68k/configs/q40_defconfig | 45 +------- arch/m68k/configs/sun3_defconfig | 45 +------- arch/m68k/configs/sun3x_defconfig | 45 +------- drivers/infiniband/Kconfig | 1 - drivers/infiniband/core/addr.c | 3 +- drivers/infiniband/hw/ocrdma/Kconfig | 2 +- drivers/infiniband/sw/rxe/rxe_net.c | 6 +- drivers/infiniband/ulp/ipoib/Kconfig | 2 +- drivers/net/Kconfig | 9 -- drivers/net/ethernet/broadcom/Kconfig | 2 +- drivers/net/ethernet/chelsio/Kconfig | 2 +- .../mellanox/mlx5/core/en/rep/neigh.c | 12 ++- .../ethernet/mellanox/mlx5/core/en/tc_tun.c | 3 +- .../mellanox/mlx5/core/en/tc_tun_encap.c | 2 +- .../mellanox/mlx5/core/en_accel/ipsec.c | 1 - .../net/ethernet/mellanox/mlx5/core/en_rep.c | 1 - .../net/ethernet/mellanox/mlx5/core/en_tc.c | 1 - drivers/net/ethernet/mellanox/mlxsw/Kconfig | 1 - .../ethernet/mellanox/mlxsw/spectrum_router.c | 9 +- .../ethernet/mellanox/mlxsw/spectrum_span.c | 3 +- drivers/net/ethernet/netronome/Kconfig | 1 - .../ethernet/netronome/nfp/flower/action.c | 2 +- .../netronome/nfp/flower/tunnel_conf.c | 9 +- drivers/net/ethernet/sfc/tc_counters.c | 2 +- drivers/net/ethernet/sfc/tc_encap_actions.c | 5 +- drivers/net/geneve.c | 1 - drivers/net/gtp.c | 2 +- drivers/net/ovpn/peer.c | 3 +- drivers/net/ovpn/udp.c | 3 +- drivers/net/usb/cdc_mbim.c | 17 +-- drivers/net/vrf.c | 3 +- drivers/net/vxlan/vxlan_core.c | 11 +- drivers/net/vxlan/vxlan_multicast.c | 6 +- drivers/net/wireguard/socket.c | 3 +- drivers/net/wireless/intel/ipw2x00/ipw2100.c | 2 +- drivers/scsi/bnx2fc/Kconfig | 1 - drivers/scsi/bnx2i/Kconfig | 1 - drivers/scsi/cxgbi/cxgb3i/Kconfig | 2 +- drivers/scsi/cxgbi/cxgb4i/Kconfig | 2 +- fs/dlm/Kconfig | 2 +- fs/gfs2/Kconfig | 2 +- include/linux/icmpv6.h | 26 +---- include/linux/indirect_call_wrapper.h | 2 +- include/linux/netfilter_ipv6.h | 102 ++---------------- include/net/ip.h | 5 - include/net/ip6_fib.h | 34 +++++- include/net/ip6_route.h | 26 +++++ include/net/ipv6.h | 12 +++ include/net/ipv6_stubs.h | 102 ------------------ include/net/ndisc.h | 38 +++---- include/net/udp_tunnel.h | 3 +- net/bridge/Kconfig | 1 - net/bridge/br_arp_nd_proxy.c | 3 +- net/bridge/br_netfilter_hooks.c | 12 +-- net/bridge/br_netfilter_ipv6.c | 7 +- net/core/filter.c | 70 ++++++------ net/core/lwt_bpf.c | 10 +- net/ieee802154/6lowpan/tx.c | 2 +- net/ipv4/Kconfig | 9 +- net/ipv4/fib_semantics.c | 11 +- net/ipv4/icmp.c | 2 +- net/ipv4/nexthop.c | 21 ++-- net/ipv4/route.c | 2 +- net/ipv4/udp.c | 7 +- net/ipv6/Kconfig | 6 +- net/ipv6/addrconf.c | 10 +- net/ipv6/addrconf_core.c | 91 ---------------- net/ipv6/af_inet6.c | 69 ++---------- net/ipv6/icmp.c | 6 -- net/ipv6/ip6_fib.c | 10 +- net/ipv6/ip6_icmp.c | 46 +------- net/ipv6/ip6_offload.c | 4 +- net/ipv6/ip6_output.c | 5 +- net/ipv6/ip6_udp_tunnel.c | 3 +- net/ipv6/ndisc.c | 35 +++--- net/ipv6/netfilter.c | 48 --------- net/ipv6/route.c | 13 +-- net/l2tp/Kconfig | 1 - net/mpls/af_mpls.c | 3 +- net/netfilter/Kconfig | 8 -- net/netfilter/core.c | 3 - net/netfilter/nf_nat_masquerade.c | 21 +--- net/netfilter/nfnetlink_queue.c | 22 +++- net/netfilter/utils.c | 1 - net/openvswitch/actions.c | 3 +- net/rxrpc/Kconfig | 2 +- net/sched/sch_frag.c | 4 +- net/sctp/Kconfig | 1 - net/tipc/Kconfig | 1 - net/tipc/udp_media.c | 9 +- net/xfrm/espintcp.c | 5 +- net/xfrm/xfrm_nat_keepalive.c | 4 +- net/xfrm/xfrm_output.c | 3 +- 103 files changed, 328 insertions(+), 1301 deletions(-) delete mode 100644 include/net/ipv6_stubs.h
Jakub Kicinski
maintainerQuoted 8 lines · On Tue, 10 Mar 2026 16:34:23 +0100 Fernando Fernandez Mancera wrote:
Historically, the Linux kernel has supported compiling the IPv6 stack as a loadable module. While this made sense in the early days of IPv6 adoption, modern deployments and distributions overwhelmingly either build IPv6 directly into the kernel (
CONFIG_IPV6=y) or disable it entirely (CONFIG_IPV6=n). The modular IPv6 use-case offers image size and memory savings for specific setups, this benefit is outweighed by the architectural burden it imposes on the subsystems on implementation and maintenance.
Would you mind also listing in the cover letter the examples folks have provided on the RFC of distros etc validating that this is a common choice even for openwrt these days? Also I quite like Geert's analysis of kernel growing by this much anyway so this isn't a huge jump :)
When you repost could you trim the "(open list:.." stuff form the CC lists? For lists just the email addr is enough, no need to quote the rest of get_maintainers output.
Jakub Kicinski
maintainerRe: [PATCH 01/10 net-next v2] ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs
In reply to Fernando Fernandez ManceraQuoted 14 lines · On Tue, 10 Mar 2026 16:34:24 +0100 Fernando Fernandez Mancera wrote:
Maintaining a modular IPv6 stack offers image size and memory savings for specific setups, this benefit is outweighed by the architectural burden it imposes on the subsystems on implementation and maintenance. Therefore, drop it.
Change
CONFIG_IPV6from tristate to bool. Remove allKconfigdependencies across the tree that explicitly checked for IPV6=m. In addition, removeMODULE_DESCRIPTION(),MODULE_ALIAS(),MODULE_AUTHOR()andMODULE_LICENSE().This is also replacing
module_init()bydevice_initcall(). It is not possible to usefs_initcall()as IPv4 does because that creates a race condition on IPv6 addrconf.
Quoted 5 lines
Finally, modify the default configs from
CONFIG_IPV6=mtoCONFIG_IPV6=yexcept for m68k as according to the bloat-o-meter the image is increasing by 330KB~ and that isn't acceptable. Instead, disable IPv6 on this architecture by default. This is aligned with m68k RAM requirements and recommendations [1].
AI has spotted:
arch/m68k/configs/amiga_defconfig CONFIG_NET_IPIP=m · line 67
Quoted 10 lines
arch/m68k/configs/amiga_defconfig +0
-1@@ -64,7 +64,6 @@ CONFIG_NET_IPIP=m CONFIG_NET_IPGRE_DEMUX=m CONFIG_NET_IPGRE=m CONFIG_NET_IPVTI=m -CONFIG_NET_FOU_IP_TUNNELS=y CONFIG_INET_AH=m
Is CONFIG_NET_FOU_IP_TUNNELS=y removed intentionally? This option provides FOU/GUE encapsulation for IP tunnels and has 'depends on NET_IPIP || NET_IPGRE || IPV6_SIT' as its Kconfig dependency. With IPv6 disabled, IPV6_SIT becomes unavailable, but CONFIG_NET_IPIP=m and CONFIG_NET_IPGRE=m are both still present in the defconfig, so the dependency remains satisfiable.
Since CONFIG_NET_FOU_IP_TUNNELS has no 'default y', removing it from the defconfig means FOU/GUE encapsulation for IP tunnels will be silently disabled by default on m68k. The commit message describes only disabling IPv6 on m68k, not removing IPv4 FOU tunnel support.
This affects four m68k defconfigs:
- amiga_defconfig
- apollo_defconfig
- atari_defconfig
- bvme6000_defconfig
Geert Uytterhoeven
maintainerRe: [PATCH 01/10 net-next v2] ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs
In reply to Fernando Fernandez ManceraHi Fernando,
Quoted 20 lines · Fernando Fernandez Mancera
Maintaining a modular IPv6 stack offers image size and memory savings for specific setups, this benefit is outweighed by the architectural burden it imposes on the subsystems on implementation and maintenance. Therefore, drop it.
Change
CONFIG_IPV6from tristate to bool. Remove allKconfigdependencies across the tree that explicitly checked for IPV6=m. In addition, removeMODULE_DESCRIPTION(),MODULE_ALIAS(),MODULE_AUTHOR()andMODULE_LICENSE().This is also replacing
module_init()bydevice_initcall(). It is not possible to usefs_initcall()as IPv4 does because that creates a race condition on IPv6 addrconf.Finally, modify the default configs from
CONFIG_IPV6=mtoCONFIG_IPV6=yexcept for m68k as according to the bloat-o-meter the image is increasing by 330KB~ and that isn't acceptable. Instead, disable IPv6 on this architecture by default. This is aligned with m68k RAM requirements and recommendations [1].
Quoted 3 lines
[1] http://www.linux-m68k.org/faq/ram.html
Signed-off-by Fernando Fernandez Mancera <[email protected]>
Thanks for your patch!
Quoted 4 lines
arch/m68k/configs/amiga_defconfig | 45 +------------------- arch/m68k/configs/apollo_defconfig | 46 +------------------- arch/m68k/configs/atari_defconfig | 45 +------------------- arch/m68k/configs/bvme6000_defconfig | 45 +-------------------
Quoted 8 lines
arch/m68k/configs/hp300_defconfig | 47 +-------------------- arch/m68k/configs/mac_defconfig | 45 +------------------- arch/m68k/configs/multi_defconfig | 45 +------------------- arch/m68k/configs/mvme147_defconfig | 45 +------------------- arch/m68k/configs/mvme16x_defconfig | 45 +------------------- arch/m68k/configs/q40_defconfig | 45 +------------------- arch/m68k/configs/sun3_defconfig | 45 +------------------- arch/m68k/configs/sun3x_defconfig | 45 +-------------------
Why are the stats not the same for each file?
arch/m68k/configs/apollo_defconfig CONFIG_FB=y · line 387
Quoted 8 lines
arch/m68k/configs/apollo_defconfig +0
-1@@ -384,7 +343,6 @@ CONFIG_FB=y CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION=y CONFIG_LOGO=y -# CONFIG_LOGO_LINUX_VGA16 is not set
Unrelated change.
arch/m68k/configs/hp300_defconfig CONFIG_FB=y · line 390
Quoted 13 lines
arch/m68k/configs/apollo_defconfig +0
-0# CONFIG_LOGO_LINUX_CLUT224 is not set CONFIG_HID=m CONFIG_HIDRAW=yarch/m68k/configs/hp300_defconfig +0
-2@@ -386,8 +345,6 @@ CONFIG_FB=y CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION=y CONFIG_LOGO=y -# CONFIG_LOGO_LINUX_MONO is not set -# CONFIG_LOGO_LINUX_VGA16 is not set
Two more.
arch/m68k/configs/hp300_defconfig CONFIG_FB=y · line 350
Quoted 3 lines
arch/m68k/configs/hp300_defconfig +0
-0CONFIG_HID=m CONFIG_HIDRAW=y CONFIG_UHID=m
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH 08/10 net-next v2] bpf: remove ipv6_bpf_stub completely and use direct function calls
In reply to Fernando Fernandez ManceraQuoted 7 lines · Fernando Fernandez Mancera
As IPv6 is built-in only, the
ipv6_bpf_stubcan be removed completely.Convert all
ipv6_bpf_stubusage to direct function calls instead. The fallback functions introduced previously will prevent linkage errors whenCONFIG_IPV6is disabled.Signed-off-by Fernando Fernandez Mancera <[email protected]>
[...]
net/core/filter.c BPF_CALL_3(bpf_bind, struct bpf_sock_addr_kern *, ctx, struct sockaddr *, addr, · line 6001
Quoted 12 lines
net/core/filter.c +3
-5@@ -6000,11 +5996,9 @@ BPF_CALL_3(bpf_bind, struct bpf_sock_addr_kern *, ctx, struct sockaddr *, addr,return err;if (((struct sockaddr_in6 *)addr)->sin6_port ==htons (0 )) flags |=BIND_FORCE_ADDRESS_NO_PORT ; -/* ipv6_bpf_stub cannot be NULL, since it's called from -* bpf_cgroup_inet6_connect hook and ipv6 is already loaded -*/ -return ipv6_bpf_stub->inet6_bind (sk, (struct sockaddr_unsized *)addr, - addr_len, flags); + +return inet6_bind_flags (sk, (struct sockaddr_unsized *)addr, + addr_len, flags);
nit: You're adding the inet6_bind_flags just as an alias for __inet6_bind, might as well just call the latter directly like we do in IPv4 case further above.
[...]> @@ -6283,12 +6277,11 @@ static int bpf_ipv6_fib_lookup(struct net *net, struct bpf_fib_lookup *params,
Quoted 4 lines
net/core/filter.c +0
-1params->tbid =0 ; } - tb = ipv6_stub->fib6_get_table (net, tbid);
net/core/filter.c static int bpf_ipv6_fib_lookup(struct net *net, struct bpf_fib_lookup *params, · line 6287
Quoted 10 lines
net/core/filter.c +2
-2+ tb =fib6_get_table (net, tbid);if (unlikely (!tb))return BPF_FIB_LKUP_RET_NOT_FWDED ; - err = ipv6_stub->fib6_table_lookup (net, tb, oif, &fl6, &res, - strict); + err =fib6_table_lookup (net, tb, oif, &fl6, &res, strict); }else {if (flags &BPF_FIB_LOOKUP_MARK ) fl6.flowi6_mark = params->mark;
Love it, for the bpf_ipv6_fib_lookup we're now able to get rid of 3 subsequent indirect calls in fast-path (ipv6_stub->fib6_lookup + ipv6_stub->fib6_select_path + ipv6_bpf_stub->ipv6_dev_get_saddr in case BPF prog requested to fill src IP).
[...]
Quoted 5 lines
net/ipv6/af_inet6.c +0
-0
net/ipv6/af_inet6.c int inet6_bind_sk(struct sock *sk, struct sockaddr_unsized *uaddr, int addr_len) · line 468
Quoted 9 lines
net/ipv6/af_inet6.c +6
-0@@ -460,6 +460,12 @@ int inet6_bind_sk(struct sock *sk, struct sockaddr_unsized *uaddr, int addr_len)return __inet6_bind (sk, uaddr, addr_len, flags); } +int inet6_bind_flags (struct sock *sk,struct sockaddr_unsized *uaddr, +int addr_len,u32 flags) +{ +return __inet6_bind (sk, uaddr, addr_len, flags); +} +
(wrt above comment)
Thanks,
Daniel
Re: [PATCH 05/10 net-next v2] drivers: net: drop ipv6_stub usage and use direct function calls
In reply to Fernando Fernandez ManceraQuoted 5 lines · Fernando Fernandez Mancera
drivers/net/wireguard/socket.c +0
-0
drivers/net/wireguard/socket.c static int send6(struct wg_device *wg, struct sk_buff *skb, · line 142
Quoted 9 lines
drivers/net/wireguard/socket.c +1
-2@@ -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",
Rest in peace, stub.
For the WireGuard part,
Re: [PATCH 01/10 net-next v2] ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs
In reply to Jakub KicinskiQuoted 41 lines · Jakub Kicinski
Quoted 14 lines · On Tue, 10 Mar 2026 16:34:24 +0100 Fernando Fernandez Mancera wrote:
Maintaining a modular IPv6 stack offers image size and memory savings for specific setups, this benefit is outweighed by the architectural burden it imposes on the subsystems on implementation and maintenance. Therefore, drop it.
Change
CONFIG_IPV6from tristate to bool. Remove allKconfigdependencies across the tree that explicitly checked for IPV6=m. In addition, removeMODULE_DESCRIPTION(),MODULE_ALIAS(),MODULE_AUTHOR()andMODULE_LICENSE().This is also replacing
module_init()bydevice_initcall(). It is not possible to usefs_initcall()as IPv4 does because that creates a race condition on IPv6 addrconf.Quoted 5 lines
Finally, modify the default configs from
CONFIG_IPV6=mtoCONFIG_IPV6=yexcept for m68k as according to the bloat-o-meter the image is increasing by 330KB~ and that isn't acceptable. Instead, disable IPv6 on this architecture by default. This is aligned with m68k RAM requirements and recommendations [1].AI has spotted:
arch/m68k/configs/amiga_defconfig CONFIG_NET_IPIP=m · line 67
Quoted 10 lines
arch/m68k/configs/amiga_defconfig +0
-1@@ -64,7 +64,6 @@ CONFIG_NET_IPIP=m CONFIG_NET_IPGRE_DEMUX=m CONFIG_NET_IPGRE=m CONFIG_NET_IPVTI=m -CONFIG_NET_FOU_IP_TUNNELS=y CONFIG_INET_AH=mIs
CONFIG_NET_FOU_IP_TUNNELS=yremoved intentionally? This option provides FOU/GUE encapsulation for IP tunnels and has 'depends onNET_IPIP||NET_IPGRE||IPV6_SIT' as itsKconfigdependency. With IPv6 disabled,IPV6_SITbecomes unavailable, butCONFIG_NET_IPIP=mandCONFIG_NET_IPGRE=mare both still present in the defconfig, so the dependency remains satisfiable.
Quoted 5 lines
Since
CONFIG_NET_FOU_IP_TUNNELShas no 'default y', removing it from the defconfig means FOU/GUE encapsulation for IP tunnels will be silently disabled by default on m68k. The commit message describes only disabling IPv6 on m68k, not removing IPv4 FOU tunnel support.
I noticed that when running
./scripts/config --disable CONFIG_IPV6
for the m68k, the script was adding CONFIG_LWTUNNEL=y and CONFIG_NET_FOU=y.
CONFIG_LWTUNNEL was selected by multiple IPV6 features. I do not think it makes sense to keep it for m68k given the information there is on http://www.linux-m68k.org/faq/platinfo.html.
CONFIG_NET_FOU was something IPV6_FOU required, probably it should be just dropped from the config instead of explicitly turn it off as it turns off FOU_IP_TUNNELS too. It will be selected by FOU_IP_TUNNELS too anyway.
I will update the config and also the commit message about CONFIG_LWTUNNEL.
FTR; I doubt anyone is running Foo over UDP in m68k but let's avoid doing extra undocumented changes.
Thanks,
Fernando.
Quoted 6 lines
This affects four m68k defconfigs:
-amiga_defconfig
-apollo_defconfig
-atari_defconfig
-bvme6000_defconfig
Geert Uytterhoeven
maintainerRe: [PATCH 01/10 net-next v2] ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs
Hi Fernando,
Quoted 50 lines · Fernando Fernandez Mancera
Quoted 41 lines · Jakub Kicinski
Quoted 14 lines · On Tue, 10 Mar 2026 16:34:24 +0100 Fernando Fernandez Mancera wrote:
Maintaining a modular IPv6 stack offers image size and memory savings for specific setups, this benefit is outweighed by the architectural burden it imposes on the subsystems on implementation and maintenance. Therefore, drop it.
Change
CONFIG_IPV6from tristate to bool. Remove allKconfigdependencies across the tree that explicitly checked for IPV6=m. In addition, removeMODULE_DESCRIPTION(),MODULE_ALIAS(),MODULE_AUTHOR()andMODULE_LICENSE().This is also replacing
module_init()bydevice_initcall(). It is not possible to usefs_initcall()as IPv4 does because that creates a race condition on IPv6 addrconf.Quoted 5 lines
Finally, modify the default configs from
CONFIG_IPV6=mtoCONFIG_IPV6=yexcept for m68k as according to the bloat-o-meter the image is increasing by 330KB~ and that isn't acceptable. Instead, disable IPv6 on this architecture by default. This is aligned with m68k RAM requirements and recommendations [1].AI has spotted:
arch/m68k/configs/amiga_defconfig CONFIG_NET_IPIP=m · line 67
Quoted 10 lines
arch/m68k/configs/amiga_defconfig +0
-1@@ -64,7 +64,6 @@ CONFIG_NET_IPIP=m CONFIG_NET_IPGRE_DEMUX=m CONFIG_NET_IPGRE=m CONFIG_NET_IPVTI=m -CONFIG_NET_FOU_IP_TUNNELS=y CONFIG_INET_AH=mIs
CONFIG_NET_FOU_IP_TUNNELS=yremoved intentionally? This option provides FOU/GUE encapsulation for IP tunnels and has 'depends onNET_IPIP||NET_IPGRE||IPV6_SIT' as itsKconfigdependency. With IPv6 disabled,IPV6_SITbecomes unavailable, butCONFIG_NET_IPIP=mandCONFIG_NET_IPGRE=mare both still present in the defconfig, so the dependency remains satisfiable.Quoted 5 lines
Since
CONFIG_NET_FOU_IP_TUNNELShas no 'default y', removing it from the defconfig means FOU/GUE encapsulation for IP tunnels will be silently disabled by default on m68k. The commit message describes only disabling IPv6 on m68k, not removing IPv4 FOU tunnel support.I noticed that when running
Quoted 7 lines
./scripts/config--disableCONFIG_IPV6for the m68k, the script was adding
CONFIG_LWTUNNEL=yandCONFIG_NET_FOU=y.
CONFIG_LWTUNNELwas selected by multiple IPV6 features. I do not think it makes sense to keep it for m68k given the information there is on
http://www.linux-m68k.org/faq/platinfo.html.
Dunno about lwtunnel...
Quoted 4 lines
CONFIG_NET_FOUwas somethingIPV6_FOUrequired, probably it should be just dropped from the config instead of explicitly turn it off as it turns offFOU_IP_TUNNELStoo. It will be selected byFOU_IP_TUNNELStoo anyway.
... but CONFIG_NET_FOU seems to be just a gatekeeping symbol for the tristate symbol IPV6_FOU, so FOU is still a module., which is good.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH 05/10 net-next v2] drivers: net: drop ipv6_stub usage and use direct function calls
In reply to Fernando Fernandez ManceraQuoted 27 lines · Fernando Fernandez Mancera
drivers/net/ovpn/peer.c +1
-2@@ -821,8 +821,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);drivers/net/ovpn/udp.c +0
-1@@ -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>
drivers/net/ovpn/udp.c static int ovpn_udp6_output(struct ovpn_peer *peer, struct ovpn_bind *bind, · line 256
Quoted 8 lines
drivers/net/ovpn/udp.c +1
-1@@ -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",
For ovpn:
Regards,
Signature · 2 lines
Antonio Quartulli OpenVPN Inc.
Edward Cree
maintainerRe: [PATCH 05/10 net-next v2] drivers: net: drop ipv6_stub usage and use direct function calls
In reply to Fernando Fernandez ManceraQuoted 8 lines · Fernando Fernandez Mancera
As IPv6 is built-in only, the
ipv6_stubinfrastructure is no longer necessary.Convert all drivers currently utilizing
ipv6_stubto make direct function calls. The fallback functions introduced previously will prevent linkage errors whenCONFIG_IPV6is disabled.Signed-off-by Fernando Fernandez Mancera <[email protected]>
...
Quoted 28 lines
drivers/net/ethernet/sfc/tc_counters.c +1
-1@@ -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 (ipv6_get_nd_tbl (), &encap->neigh->dst_ip6, encap->neigh->egdev);#else drivers/net/ethernet/sfc/tc_encap_actions.c +1
-2@@ -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" );
drivers/net/ethernet/sfc/tc_encap_actions.c static int efx_neigh_event(struct efx_nic *efx, struct neighbour *n) · line 536
Quoted 8 lines
drivers/net/ethernet/sfc/tc_encap_actions.c +1
-1@@ -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 == ipv6_get_nd_tbl()) { ipv6 = true; keysize =sizeof (keys.dst_ip6);#endif
# for sfc: Reviewed-by: Edward Cree <[email protected]>
Re: [PATCH 01/10 net-next v2] ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs
In reply to Fernando Fernandez ManceraQuoted 20 lines · Fernando Fernandez Mancera
Maintaining a modular IPv6 stack offers image size and memory savings for specific setups, this benefit is outweighed by the architectural burden it imposes on the subsystems on implementation and maintenance. Therefore, drop it.
Change
CONFIG_IPV6from tristate to bool. Remove allKconfigdependencies across the tree that explicitly checked for IPV6=m. In addition, removeMODULE_DESCRIPTION(),MODULE_ALIAS(),MODULE_AUTHOR()andMODULE_LICENSE().This is also replacing
module_init()bydevice_initcall(). It is not possible to usefs_initcall()as IPv4 does because that creates a race condition on IPv6 addrconf.Finally, modify the default configs from
CONFIG_IPV6=mtoCONFIG_IPV6=yexcept for m68k as according to the bloat-o-meter the image is increasing by 330KB~ and that isn't acceptable. Instead, disable IPv6 on this architecture by default. This is aligned with m68k RAM requirements and recommendations [1].
Quoted 6 lines
[1] http://www.linux-m68k.org/faq/ram.html
Signed-off-by Fernando Fernandez Mancera <[email protected]>---
v2: updated m68k default configuration toCONFIG_IPV6=nand useddevice_initcall()insteadfs_initcall()to avoid a race condition.
Don't know exavtly netdev policy about merging cover letters, but if the cover letter does not end up merged (e.g. with b4), then please move other bloatometer stats here. Although the best if cover letter is simply merged.
Quoted 2 lines
--- arch/arm64/configs/defconfig | 2 +-
Quoted 4 lines
arch/m68k/configs/amiga_defconfig | 45 +------------------- arch/m68k/configs/apollo_defconfig | 46 +------------------- arch/m68k/configs/atari_defconfig | 45 +------------------- arch/m68k/configs/bvme6000_defconfig | 45 +-------------------
Quoted 8 lines
arch/m68k/configs/hp300_defconfig | 47 +-------------------- arch/m68k/configs/mac_defconfig | 45 +------------------- arch/m68k/configs/multi_defconfig | 45 +------------------- arch/m68k/configs/mvme147_defconfig | 45 +------------------- arch/m68k/configs/mvme16x_defconfig | 45 +------------------- arch/m68k/configs/q40_defconfig | 45 +------------------- arch/m68k/configs/sun3_defconfig | 45 +------------------- arch/m68k/configs/sun3x_defconfig | 45 +-------------------
Thanks Fernando for addressing the comments. Great job!
Best regards,
Krzysztof