Skip to contentSkip to conversation

Convert CONFIG_IPV6 to built-in and remove stubs

PATCH Superseded Fernando Fernandez Mancera 12 participants 40 messages Mar 9 – Apr 1

Subsystems (40)
Networking Network drivers SCSI USB +36 more subsystems

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

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 provides little to no practical benefit today.

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.

All the patches has been independently build tested. With allmodconfig and allmodconfig + CONFIG_IPV6=n. In addition, IPv6 core network selftest has been run against them.

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             |   2 +-
 arch/m68k/configs/apollo_defconfig            |   2 +-
 arch/m68k/configs/atari_defconfig             |   2 +-
 arch/m68k/configs/bvme6000_defconfig          |   2 +-
 arch/m68k/configs/hp300_defconfig             |   2 +-
 arch/m68k/configs/mac_defconfig               |   2 +-
 arch/m68k/configs/multi_defconfig             |   2 +-
 arch/m68k/configs/mvme147_defconfig           |   2 +-
 arch/m68k/configs/mvme16x_defconfig           |   2 +-
 arch/m68k/configs/q40_defconfig               |   2 +-
 arch/m68k/configs/sun3_defconfig              |   2 +-
 arch/m68k/configs/sun3x_defconfig             |   2 +-
 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         |  11 +-
 .../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 |   8 +-
 .../ethernet/mellanox/mlxsw/spectrum_span.c   |   2 +-
 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                             |   2 +-
 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                         |  33 +++++-
 include/net/ip6_route.h                       |  25 +++++
 include/net/ipv6.h                            |  12 +++
 include/net/ipv6_stubs.h                      | 102 ------------------
 include/net/ndisc.h                           |  39 +++----
 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, 310 insertions(+), 795 deletions(-)
 delete mode 100644 include/net/ipv6_stubs.h
Signature · 1 line
2.53.0
#1 lore raw

PATCH 1/10 ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs

Configuring IPV6 as a module provides little or no benefit and requires time and resources to maintain. Therefore, drop the support for it.

Change CONFIG_IPV6 from tristate to bool. Remove all Kconfig dependencies across the tree that explicitly checked for IPV6=m. Adjust all the default configurations from CONFIG_IPV6=m to CONFIG_IPV6=y. In addition, remove MODULE_DESCRIPTION(), MODULE_ALIAS(), MODULE_AUTHOR() and MODULE_LICENSE().

This is also replacing module_init() by fs_initcall().

---
 arch/arm64/configs/defconfig                | 2 +-
 arch/m68k/configs/amiga_defconfig           | 2 +-
 arch/m68k/configs/apollo_defconfig          | 2 +-
 arch/m68k/configs/atari_defconfig           | 2 +-
 arch/m68k/configs/bvme6000_defconfig        | 2 +-
 arch/m68k/configs/hp300_defconfig           | 2 +-
 arch/m68k/configs/mac_defconfig             | 2 +-
 arch/m68k/configs/multi_defconfig           | 2 +-
 arch/m68k/configs/mvme147_defconfig         | 2 +-
 arch/m68k/configs/mvme16x_defconfig         | 2 +-
 arch/m68k/configs/q40_defconfig             | 2 +-
 arch/m68k/configs/sun3_defconfig            | 2 +-
 arch/m68k/configs/sun3x_defconfig           | 2 +-
 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, 28 insertions(+), 65 deletions(-)
arch/arm64/configs/defconfig +1 -1
index b67d5b1fc45b..0651a771f5c1 100644
@@ -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 +1 -1
index 31d16cba9879..ba511da41ec8 100644
@@ -72,7 +72,7 @@ CONFIG_INET_IPCOMP=m
 CONFIG_INET_DIAG=m
 CONFIG_INET_UDP_DIAG=m
 CONFIG_INET_RAW_DIAG=m
-CONFIG_IPV6=m
+CONFIG_IPV6=y
 CONFIG_IPV6_ROUTER_PREF=y
 CONFIG_INET6_AH=m
 CONFIG_INET6_ESP=m
arch/m68k/configs/apollo_defconfig +1 -1
index c0c419ec9a9e..0a5f045c5a86 100644
@@ -68,7 +68,7 @@ CONFIG_INET_IPCOMP=m
 CONFIG_INET_DIAG=m
 CONFIG_INET_UDP_DIAG=m
 CONFIG_INET_RAW_DIAG=m
-CONFIG_IPV6=m
+CONFIG_IPV6=y
 CONFIG_IPV6_ROUTER_PREF=y
 CONFIG_INET6_AH=m
 CONFIG_INET6_ESP=m
arch/m68k/configs/atari_defconfig +1 -1
index 2b7547ecc4c4..d1506feb27f5 100644
@@ -75,7 +75,7 @@ CONFIG_INET_IPCOMP=m
 CONFIG_INET_DIAG=m
 CONFIG_INET_UDP_DIAG=m
 CONFIG_INET_RAW_DIAG=m
-CONFIG_IPV6=m
+CONFIG_IPV6=y
 CONFIG_IPV6_ROUTER_PREF=y
 CONFIG_INET6_AH=m
 CONFIG_INET6_ESP=m
arch/m68k/configs/bvme6000_defconfig +1 -1
index 0b63787cff0d..4614d383fe9b 100644
@@ -65,7 +65,7 @@ CONFIG_INET_IPCOMP=m
 CONFIG_INET_DIAG=m
 CONFIG_INET_UDP_DIAG=m
 CONFIG_INET_RAW_DIAG=m
-CONFIG_IPV6=m
+CONFIG_IPV6=y
 CONFIG_IPV6_ROUTER_PREF=y
 CONFIG_INET6_AH=m
 CONFIG_INET6_ESP=m
arch/m68k/configs/hp300_defconfig +1 -1
index 308836b60bba..d0e74a2f01e3 100644
@@ -67,7 +67,7 @@ CONFIG_INET_IPCOMP=m
 CONFIG_INET_DIAG=m
 CONFIG_INET_UDP_DIAG=m
 CONFIG_INET_RAW_DIAG=m
-CONFIG_IPV6=m
+CONFIG_IPV6=y
 CONFIG_IPV6_ROUTER_PREF=y
 CONFIG_INET6_AH=m
 CONFIG_INET6_ESP=m
arch/m68k/configs/mac_defconfig +1 -1
index 97e108c0d24f..aa5b8682503a 100644
@@ -66,7 +66,7 @@ CONFIG_INET_IPCOMP=m
 CONFIG_INET_DIAG=m
 CONFIG_INET_UDP_DIAG=m
 CONFIG_INET_RAW_DIAG=m
-CONFIG_IPV6=m
+CONFIG_IPV6=y
 CONFIG_IPV6_ROUTER_PREF=y
 CONFIG_INET6_AH=m
 CONFIG_INET6_ESP=m
arch/m68k/configs/multi_defconfig +1 -1
index 7e9f83af9af4..99e0bc09cb41 100644
@@ -86,7 +86,7 @@ CONFIG_INET_IPCOMP=m
 CONFIG_INET_DIAG=m
 CONFIG_INET_UDP_DIAG=m
 CONFIG_INET_RAW_DIAG=m
-CONFIG_IPV6=m
+CONFIG_IPV6=y
 CONFIG_IPV6_ROUTER_PREF=y
 CONFIG_INET6_AH=m
 CONFIG_INET6_ESP=m
arch/m68k/configs/mvme147_defconfig +1 -1
index 2fe33271d249..f36844c03074 100644
@@ -64,7 +64,7 @@ CONFIG_INET_IPCOMP=m
 CONFIG_INET_DIAG=m
 CONFIG_INET_UDP_DIAG=m
 CONFIG_INET_RAW_DIAG=m
-CONFIG_IPV6=m
+CONFIG_IPV6=y
 CONFIG_IPV6_ROUTER_PREF=y
 CONFIG_INET6_AH=m
 CONFIG_INET6_ESP=m
arch/m68k/configs/mvme16x_defconfig +1 -1
index 4308daaa7f74..be89e951e8bc 100644
@@ -65,7 +65,7 @@ CONFIG_INET_IPCOMP=m
 CONFIG_INET_DIAG=m
 CONFIG_INET_UDP_DIAG=m
 CONFIG_INET_RAW_DIAG=m
-CONFIG_IPV6=m
+CONFIG_IPV6=y
 CONFIG_IPV6_ROUTER_PREF=y
 CONFIG_INET6_AH=m
 CONFIG_INET6_ESP=m
arch/m68k/configs/q40_defconfig +1 -1
index 36eb29ec54ee..0c1b17d12204 100644
@@ -66,7 +66,7 @@ CONFIG_INET_IPCOMP=m
 CONFIG_INET_DIAG=m
 CONFIG_INET_UDP_DIAG=m
 CONFIG_INET_RAW_DIAG=m
-CONFIG_IPV6=m
+CONFIG_IPV6=y
 CONFIG_IPV6_ROUTER_PREF=y
 CONFIG_INET6_AH=m
 CONFIG_INET6_ESP=m
arch/m68k/configs/sun3_defconfig +1 -1
index 524a89fa6953..a39df48a3f19 100644
@@ -61,7 +61,7 @@ CONFIG_INET_IPCOMP=m
 CONFIG_INET_DIAG=m
 CONFIG_INET_UDP_DIAG=m
 CONFIG_INET_RAW_DIAG=m
-CONFIG_IPV6=m
+CONFIG_IPV6=y
 CONFIG_IPV6_ROUTER_PREF=y
 CONFIG_INET6_AH=m
 CONFIG_INET6_ESP=m
arch/m68k/configs/sun3x_defconfig +1 -1
index f4fbc65c52d9..921f2c138b48 100644
@@ -62,7 +62,7 @@ CONFIG_INET_IPCOMP=m
 CONFIG_INET_DIAG=m
 CONFIG_INET_UDP_DIAG=m
 CONFIG_INET_RAW_DIAG=m
-CONFIG_IPV6=m
+CONFIG_IPV6=y
 CONFIG_IPV6_ROUTER_PREF=y
 CONFIG_INET6_AH=m
 CONFIG_INET6_ESP=m
drivers/infiniband/Kconfig +0 -1
index 78ac2ff5befd..23f4245f7d7d 100644
@@ -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
index 54bd70bc4d1a..b50c5f507e7c 100644
@@ -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
index 254e31a90a66..b5253a231bdd 100644
@@ -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
index 17108c359216..46f37ec713b8 100644
@@ -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
index cd7dddeb91dd..3190231c91da 100644
@@ -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
index c931ec8cac40..96d7779cd2f0 100644
@@ -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
index 74f7e27b490f..2229a2694aa5 100644
@@ -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
index d03d6e96f730..d115d16d4649 100644
@@ -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
index 3cf7e08df809..d12eeb13384a 100644
@@ -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
index 75ace2302fed..e649a04fab1d 100644
@@ -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
index e20e6f3bfe64..143e881ec77e 100644
@@ -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
index 63c8a0f3cd0c..dd1c8ff36b00 100644
@@ -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
index b46165df5a91..fb6ba9f5a634 100644
@@ -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
index 7bd231d16d4a..8beee571b6af 100644
@@ -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
index 3c8ded7d3e84..318715c8fc9b 100644
@@ -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
index df922f9f5289..21e5164e30db 100644
@@ -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
index b8f9a8c0302e..c024aa77f25b 100644
@@ -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
index 0b995a961359..cfdac4753683 100644
@@ -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);
+fs_initcall(inet6_init);
net/l2tp/Kconfig +0 -1
index b7856748e960..0de178d5baba 100644
@@ -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
index 6cdc994fdc8a..f3ea0cb26f36 100644
@@ -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
index f60b81c66078..43416b3026fb 100644
@@ -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
index e947646a380c..fc989a3791b3 100644
@@ -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
index bb0d71eb02a6..18f62135e47b 100644
@@ -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
#9 lore raw

PATCH 2/10 ipv6: replace IS_BUILTIN(CONFIG_IPV6) with IS_ENABLED(CONFIG_IPV6)

In reply to Fernando Fernandez Mancera

As 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.

---
 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
index dc272b514a01..0e4340ecd857 100644
@@ -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
index 88b0dd4d8e09..39c98c3d8ac5 100644
@@ -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
index a77d23fe2359..62cae2bcc562 100644
@@ -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
index a6e58a435735..0fc6ef4a48b1 100644
@@ -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
index bd7f780e37a5..d8072ad6b8c4 100644
@@ -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
index 08cd86f49bf9..e206777785d4 100644
@@ -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
#11 lore raw

PATCH 3/10 ipv6: remove dynamic ICMPv6 sender registration infrastructure

In reply to Fernando Fernandez Mancera

As 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.

---
 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
index e3b3b0fa2a8f..bb000dc571f0 100644
@@ -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
index 813d2e9edb8b..8e8d7bd84a4c 100644
@@ -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
#12 lore raw

PATCH 4/10 ipv6: prepare headers for ipv6_stub removal

In reply to Fernando Fernandez Mancera

In 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().

---
 include/net/ip6_fib.h   | 30 ++++++++++++++++++++++++++++++
 include/net/ip6_route.h | 25 +++++++++++++++++++++++++
 include/net/ipv6.h      | 10 ++++++++++
 include/net/ndisc.h     | 12 +++++++++++-
 net/ipv6/ip6_output.c   |  1 +
 net/ipv6/ndisc.c        |  1 +
 net/ipv6/route.c        |  1 +
 7 files changed, 79 insertions(+), 1 deletion(-)
include/net/ip6_fib.h +30 -0
index 39c98c3d8ac5..9439ff815062 100644
@@ -486,11 +486,28 @@ 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 +519,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 +592,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 +25 -0
index 0c8eeb6abe7a..fb85669092c4 100644
@@ -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,18 @@ 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
index 1c0ce5151275..06d1fa54cbf7 100644
@@ -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 +11 -1
index d38783a2ce57..dc96c883a211 100644
@@ -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,7 @@ 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 +412,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 +420,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
index 8e2a6b28cea7..315808dc2a07 100644
@@ -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
index f6a5d8c73af9..f76fb8a85452 100644
@@ -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
index e206777785d4..b66a2f791e3f 100644
@@ -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
#13 lore raw

PATCH 5/10 drivers: net: drop ipv6_stub usage and use direct function calls

In reply to Fernando Fernandez Mancera

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

Convert all drivers currently utilizing ipv6_stub to make direct function calls. The fallback functions introduced previously will prevent linkage errors when CONFIG_IPV6 is disabled.

---
 drivers/infiniband/core/addr.c                  |  3 +--
 drivers/infiniband/sw/rxe/rxe_net.c             |  6 +++---
 .../ethernet/mellanox/mlx5/core/en/rep/neigh.c  | 11 +++++++----
 .../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   |  8 ++++----
 .../net/ethernet/mellanox/mlxsw/spectrum_span.c |  2 +-
 .../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                               |  2 +-
 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, 49 insertions(+), 60 deletions(-)
drivers/infiniband/core/addr.c +1 -2
index 866746695712..48d4b06384ec 100644
@@ -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
index 0bd0902b11f7..cbc646a30003 100644
@@ -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 +7 -4
index d220b045b331..2c07a53e12c0 100644
@@ -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,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
 		 * done per device delay prob time parameter.
 		 */
 #if IS_ENABLED(CONFIG_IPV6)
-		if (!p->dev || (p->tbl != ipv6_stub->nd_tbl && p->tbl != &arp_tbl))
+		if (!p->dev || (p->tbl != 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
index a14f216048cd..de74dbfe7b20 100644
@@ -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
index bfd401bee9e8..ce2a27124642 100644
@@ -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
index 64e13747084e..a52e12c3c95a 100644
@@ -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
index 1db4ecb2356f..5ec5cae8d229 100644
@@ -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
index 1434b65d4746..4e4ee1d520ce 100644
@@ -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 +4 -4
index 7bd87d0547d8..5146663f9d23 100644
@@ -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,7 @@ 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 +5124,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 +6980,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 +1 -1
index ae63d549b542..7bf0b07f2e09 100644
@@ -576,7 +576,7 @@ 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
index aca2a7417af3..ae2f8b31adfb 100644
@@ -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
index 0cef0e2b85d0..053265e135f6 100644
@@ -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
index d168282f30bf..d8a5f9fd1007 100644
@@ -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
index da35705cc5e1..63d8f794b869 100644
@@ -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
index 01cdd06102e0..c6563367d382 100644
@@ -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
index e8949f556209..70b9e58b9b78 100644
@@ -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
index 3716a1d82801..6dd11c71204b 100644
@@ -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
index 272b535ecaad..059e896b4a2f 100644
@@ -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
index dbf01210b0e7..877fb0ed7d3d 100644
@@ -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 *skb
 	return NULL;
 }
 
+#if IS_ENABLED(CONFIG_IPV6)
 /* Some devices are known to send Neighbor Solicitation messages and
  * require Neighbor Advertisement replies.  The IPv6 core will not
  * respond since IFF_NOARP is set, so we must handle them ourselves.
@@ -342,12 +342,11 @@ static void do_neigh_solicit(struct usbnet *dev, u8 *buf, u16 tci)
 	is_router = !!READ_ONCE(in6_dev->cnf.forwarding);
 	in6_dev_put(in6_dev);
 
-	/* ipv6_stub != NULL if in6_dev_get returned an inet6_dev */
-	ipv6_stub->ndisc_send_na(netdev, &iph->saddr, &msg->target,
-				 is_router /* router */,
-				 true /* solicited */,
-				 false /* override */,
-				 true /* inc_opt */);
+	ndisc_send_na(netdev, &iph->saddr, &msg->target,
+		      is_router /* router */,
+		      true /* solicited */,
+		      false /* override */,
+		      true /* inc_opt */);
 out:
 	dev_put(netdev);
 }
@@ -362,7 +361,7 @@ static bool is_neigh_solicit(u8 *buf, size_t len)
 		msg->icmph.icmp6_code == 0 &&
 		msg->icmph.icmp6_type == NDISC_NEIGHBOUR_SOLICITATION);
 }
-
+#endif /* IPV6 */
 
 static struct sk_buff *cdc_mbim_process_dgram(struct usbnet *dev, u8 *buf, size_t len, u16 tci)
 {
@@ -378,8 +377,10 @@ static struct sk_buff *cdc_mbim_process_dgram(struct usbnet *dev, u8 *buf, size_
 			proto = htons(ETH_P_IP);
 			break;
 		case 0x60:
+#if IS_ENABLED(CONFIG_IPV6)
 			if (is_neigh_solicit(buf, len))
 				do_neigh_solicit(dev, buf, tci);
+#endif
 			proto = htons(ETH_P_IPV6);
 			break;
 		default:
drivers/net/vrf.c +1 -1
index 8c009bcaa8e7..8d9e312d536d 100644
@@ -616,7 +616,7 @@ 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
index 17c941aac32d..4ab94dfe0d12 100644
@@ -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
index a7f2d67dc61b..b0e80bca855c 100644
@@ -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
index 253488f8c00f..c362c78d908e 100644
@@ -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
index 248a051da52d..c11428485dcc 100644
@@ -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
index 1e2b51769eec..494bf69a3017 100644
@@ -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
#14 lore raw

PATCH 6/10 ipv4: drop ipv6_stub usage and use direct function calls

In reply to Fernando Fernandez Mancera

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

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

---
 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
index 01cb587866d8..b576dd74d678 100644
@@ -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
index ac6d2ffc1963..f76c9ac183ae 100644
@@ -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
index 1aa2b05ee8de..2ef79c2ab881 100644
@@ -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
index 463236e0dc2d..802c68a1b446 100644
@@ -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
index 668a0284c3d5..4995ce651a31 100644
@@ -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
#15 lore raw

PATCH 7/10 net: convert remaining ipv6_stub users to direct function calls

In reply to Fernando Fernandez Mancera

As IPv6 is built-in only, the ipv6_stub infrastructure 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.

---
 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
index d9c6d04bb3b5..277f1ce1c02d 100644
@@ -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
index 0c07662b44c0..69ec02386aaa 100644
@@ -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
index ae85a7654b1f..8b4c0b7d55a2 100644
@@ -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
index 792ca44a461d..140388a18ae0 100644
@@ -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
index d1d87dce7f3f..75ee52750919 100644
@@ -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
index 2b8e385d1e51..2c66b356025a 100644
@@ -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
index 998832419097..a2756186e13a 100644
@@ -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
index ebf95d48e86c..d47f2ed8005c 100644
@@ -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
index 54222fcbd7fd..a9652b422f51 100644
@@ -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
#16 lore raw

PATCH 8/10 bpf: remove ipv6_bpf_stub completely and use direct function calls

In reply to Fernando Fernandez Mancera

As 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.

---
 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
index 06d1fa54cbf7..c55a5e60e821 100644
@@ -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
index d3013e721b14..c5c049b4473f 100644
@@ -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
index 9f40be0c3e71..f71ef82a5f3d 100644
@@ -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
index cfdac4753683..e095d5510a1a 100644
@@ -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
#17 lore raw

PATCH 9/10 ipv6: remove ipv6_stub infrastructure completely

In reply to Fernando Fernandez Mancera

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

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

---
 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
index 9439ff815062..efc524988c1b 100644
@@ -600,7 +600,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
index dc96c883a211..ffdac4f70965 100644
@@ -2,8 +2,6 @@
 #ifndef _NDISC_H
 #define _NDISC_H
 
-#include <net/ipv6_stubs.h>
-
 /*
  *	ICMP codes for neighbour discovery messages
  */
@@ -365,14 +363,6 @@ static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev
 	return ___neigh_lookup_noref(ipv6_get_nd_tbl(), neigh_key_eq128, 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;
@@ -397,27 +387,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
@@ -444,6 +422,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
index 277f1ce1c02d..095f49f741de 100644
@@ -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
index 0e55f139e05d..e022c375f418 100644
@@ -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
index e095d5510a1a..eae7bb770051 100644
@@ -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
index 0fc6ef4a48b1..8a6aabb58c5f 100644
@@ -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
index 315808dc2a07..433b8ab395bd 100644
@@ -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
index cef3e0210744..405ef1cb8864 100644
@@ -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
index f76fb8a85452..918443c75288 100644
@@ -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
index b66a2f791e3f..7809cb9db7a1 100644
@@ -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
#18 lore raw

PATCH 10/10 netfilter: remove nf_ipv6_ops and use direct function calls

In reply to Fernando Fernandez Mancera

As 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.

---
 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
index 61aa48f46dd7..5ce45b6d890f 100644
@@ -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
index f39a3787fedd..40aac82ea212 100644
@@ -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
index 083e2fe96441..0ab1c94db4b9 100644
@@ -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_buff
 		skb_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
index 76ce70b4e7f3..d8548428929e 100644
@@ -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
index eae7bb770051..09a813376c4c 100644
@@ -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
index 11a702065bab..79148bffb1e0 100644
@@ -28,9 +28,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
index a5a23c03fda9..4de6e0a51701 100644
@@ -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
index 5379d8ff39c0..050d7780dedd 100644
@@ -356,9 +356,25 @@ static int nf_ip_reroute(struct sk_buff *skb, const struct nf_queue_entry *entry
 	return 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
index 008419db815a..29c4dcc362c7 100644
@@ -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
#19 lore raw
In reply to Fernando Fernandez Mancera
Quoted 6 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 provides little to no practical benefit today.

It does. We all use generic kernels, thus it is one configuration for all boards and some setups have IPv6 and some not. The ones without IPv6 just don't use that module.

Also, with these generic kernels (so again all machines are using same ones, e.g. distro) users can easily blacklist the module.

Best regards,
Krzysztof

#2 lore raw

Re: [PATCH 01/10 net-next] ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs

In reply to Fernando Fernandez Mancera
Quoted 56 lines · Fernando Fernandez Mancera

Configuring IPV6 as a module provides little or no benefit and requires time and resources to maintain. Therefore, drop the support for it.

Change CONFIG_IPV6 from tristate to bool. Remove all Kconfig dependencies across the tree that explicitly checked for IPV6=m. Adjust all the default configurations from CONFIG_IPV6=m to CONFIG_IPV6=y. In addition, remove MODULE_DESCRIPTION(), MODULE_ALIAS(), MODULE_AUTHOR() and MODULE_LICENSE().

This is also replacing module_init() by fs_initcall().

---
 arch/arm64/configs/defconfig                | 2 +-
 arch/m68k/configs/amiga_defconfig           | 2 +-
 arch/m68k/configs/apollo_defconfig          | 2 +-
 arch/m68k/configs/atari_defconfig           | 2 +-
 arch/m68k/configs/bvme6000_defconfig        | 2 +-
 arch/m68k/configs/hp300_defconfig           | 2 +-
 arch/m68k/configs/mac_defconfig             | 2 +-
 arch/m68k/configs/multi_defconfig           | 2 +-
 arch/m68k/configs/mvme147_defconfig         | 2 +-
 arch/m68k/configs/mvme16x_defconfig         | 2 +-
 arch/m68k/configs/q40_defconfig             | 2 +-
 arch/m68k/configs/sun3_defconfig            | 2 +-
 arch/m68k/configs/sun3x_defconfig           | 2 +-
 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, 28 insertions(+), 65 deletions(-)
arch/arm64/configs/defconfig +0 -0
index b67d5b1fc45b..0651a771f5c1 100644

arch/arm64/configs/defconfig CONFIG_IP_MULTICAST=y · line 146

Quoted 8 lines
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

No, I don't want IPV6. It is allowed as module if some users need, but it's heavy bloat added to each person's build testing setup. Kernel image is already huge and barely fits boot partitions when built with KASAN and I do want a generic image with KASAN.

It must stay module for me. Alternatively, drop it, but then some users will be really affected.

Best regards,
Krzysztof

#20 lore raw
In reply to Krzysztof Kozlowski
Quoted 8 lines · Krzysztof Kozlowski
Quoted 6 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 provides little to no practical benefit today.

Quoted 7 lines

It does. We all use generic kernels, thus it is one configuration for all boards and some setups have IPv6 and some not. The ones without IPv6 just don't use that module.

Also, with these generic kernels (so again all machines are using same ones, e.g. distro) users can easily blacklist the module.

Heh, I just checked, that's 6 MB module on arm64 which apparently you want to put into the kernel! That's not acceptable. We strive to use generic kernels also on very small machines, which are both storage and CPU limited (CPU time needed to load additional 6 MB of image file).

Best regards,
Krzysztof

#25 lore raw
In reply to Krzysztof Kozlowski
Quoted 8 lines · Krzysztof Kozlowski
Quoted 6 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 provides little to no practical benefit today.

Quoted 6 lines

It does. We all use generic kernels, thus it is one configuration for all boards and some setups have IPv6 and some not. The ones without IPv6 just don't use that module.

Also, with these generic kernels (so again all machines are using same ones, e.g. distro) users can easily blacklist the module.

Perhaps it's time for CONFIG_LEGACY_IP to be buildable as a module instead, in preparation for its deprecation?

#26 lore raw
In reply to Krzysztof Kozlowski
Quoted 8 lines · Krzysztof Kozlowski
Quoted 6 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 provides little to no practical benefit today.

Quoted 4 lines

It does. We all use generic kernels, thus it is one configuration for all boards and some setups have IPv6 and some not. The ones without IPv6 just don't use that module.

While I understand this, I would like to clarify that IMHO IPv6 isn't a secondary protocol and it is fundamental to modern networking. This is why I believe it should be built-in by default. Currently OpenWRT, Debian ARM and others already ships the kernel with CONFIG_IPV6=y. I know that Alpine and Yocto doesn't do that for arm64.

I guess the most critical one here is Yocto but if the developer of the embedded device is sure they won't use IPv6 at all, they should turn it off.

At the same time, Alpine ships software that enable IPV6 and is frequently loaded as a module. So the only remaining concern would be the boot partition size. I don't really have a solution for that problem.

I think that the infrastructure for allowing IPV6=m is bug-prone and it impacts performance. Forcing the use of indirect function calls in core networking, Netfilter or BPF datapaths seems like a heavy tax to me.

Quoted 3 lines

Also, with these generic kernels (so again all machines are using same ones, e.g. distro) users can easily blacklist the module.

FWIW; users can still boot with kernel command line parameter ipv6.disable=1 and then IPV6 will be administratively disabled.

At the end this a trade-off, I still believe it is worth it but I understand your concerns.

Thanks,
Fernando.

#27 lore raw
Quoted 9 lines · Fernando Fernandez Mancera
Quoted 8 lines · Krzysztof Kozlowski
Quoted 6 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 provides little to no practical benefit today.

Quoted 7 lines
Quoted 4 lines

It does. We all use generic kernels, thus it is one configuration for all boards and some setups have IPv6 and some not. The ones without IPv6 just don't use that module.

While I understand this, I would like to clarify that IMHO IPv6 isn't a secondary protocol and it is fundamental to modern networking. This is

Not for end user devices. None of my devices - neither routers, nor embedded boards, nor mobile phone from 5G provider - receive IPv6 address, thus for them it is not fundamental.

I agree it is fundamental for your cloud machines and network backbone which you are targeting, but this patchset completely ignores other users calling their use-cases "little practical benefit"! Try running Amiga machine...

There is no even bloatometer stats for these defconfigs so we can see the impact.

Quoted 3 lines

why I believe it should be built-in by default. Currently OpenWRT, Debian ARM and others already ships the kernel with CONFIG_IPV6=y. I know that Alpine and Yocto doesn't do that for arm64.

Maybe there are other reasons why distro should not choose it as module (like module load calls on ipv6 packets) but that was not explained here.

Arch Linux Rpi kernel on arm64 has IPV6=6 and the module itself is 650 kB. That's noticeable for smaller arm64 boards.

For arm it would be even more noticeable as some have 256 MB RAM like first Rpi.

Quoted 12 lines

I guess the most critical one here is Yocto but if the developer of the embedded device is sure they won't use IPv6 at all, they should turn it off.

At the same time, Alpine ships software that enable IPV6 and is frequently loaded as a module. So the only remaining concern would be the boot partition size. I don't really have a solution for that problem.

I think that the infrastructure for allowing IPV6=m is bug-prone and it impacts performance. Forcing the use of indirect function calls in core networking, Netfilter or BPF datapaths seems like a heavy tax to me.

Quoted 6 lines
Quoted 3 lines

Also, with these generic kernels (so again all machines are using same ones, e.g. distro) users can easily blacklist the module.

FWIW; users can still boot with kernel command line parameter ipv6.disable=1 and then IPV6 will be administratively disabled.

It's not the same. You enabled it on amiga_defconfig and do you understand what sort of machine is that? The newest have 16 MB RAM, many much less like 2 MB, and ipv6 module on m68k is 400 kB, so pretty significant change.

Best regards,
Krzysztof

maintainer
#28 lore raw
Quoted 14 lines · Krzysztof Kozlowski
Quoted 13 lines · Fernando Fernandez Mancera
Quoted 11 lines · Krzysztof Kozlowski
Quoted 6 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 provides little to no practical benefit today.

It does. We all use generic kernels, thus it is one configuration for all boards and some setups have IPv6 and some not. The ones without IPv6 just don't use that module.

Quoted 6 lines
Quoted 2 lines

While I understand this, I would like to clarify that IMHO IPv6 isn't a secondary protocol and it is fundamental to modern networking. This is

Not for end user devices. None of my devices - neither routers, nor embedded boards, nor mobile phone from 5G provider - receive IPv6 address, thus for them it is not fundamental.

If that is the case for them, then they should just CONFIG_IPV6=n.

Quoted 4 lines

I agree it is fundamental for your cloud machines and network backbone which you are targeting, but this patchset completely ignores other users calling their use-cases "little practical benefit"! Try running Amiga machine...

Are you talking about [0]? That's legacy hardware and in this case just disable IPv6 altogether, why would you still prefer to have it as a module?

[0] https://en.wikipedia.org/wiki/Amiga

Quoted 7 lines

There is no even bloatometer stats for these defconfigs so we can see the impact.

Quoted 3 lines

why I believe it should be built-in by default. Currently OpenWRT, Debian ARM and others already ships the kernel with CONFIG_IPV6=y. I know that Alpine and Yocto doesn't do that for arm64.

Quoted 8 lines

Maybe there are other reasons why distro should not choose it as module (like module load calls on ipv6 packets) but that was not explained here.

Arch Linux Rpi kernel on arm64 has IPV6=6 and the module itself is 650 kB. That's noticeable for smaller arm64 boards.

For arm it would be even more noticeable as some have 256 MB RAM like first Rpi.

You are arguing that these will never be able to migrate to an IPv6 world given their memory is too small?

Quoted 14 lines
Quoted 14 lines

I guess the most critical one here is Yocto but if the developer of the embedded device is sure they won't use IPv6 at all, they should turn it off.

At the same time, Alpine ships software that enable IPV6 and is frequently loaded as a module. So the only remaining concern would be the boot partition size. I don't really have a solution for that problem.

I think that the infrastructure for allowing IPV6=m is bug-prone and it impacts performance. Forcing the use of indirect function calls in core networking, Netfilter or BPF datapaths seems like a heavy tax to me.

Quoted 2 lines

Also, with these generic kernels (so again all machines are using same ones, e.g. distro) users can easily blacklist the module.

Quoted 7 lines
Quoted 2 lines

FWIW; users can still boot with kernel command line parameter ipv6.disable=1 and then IPV6 will be administratively disabled.

It's not the same. You enabled it on amiga_defconfig and do you understand what sort of machine is that? The newest have 16 MB RAM, many much less like 2 MB, and ipv6 module on m68k is 400 kB, so pretty significant change.

If IPv6 is not relevant for amiga_defconfig presumably it should just be set to CONFIG_IPV6=n?

Thanks,
Daniel

#29 lore raw
Quoted 15 lines · Daniel Borkmann
Quoted 14 lines · Krzysztof Kozlowski
Quoted 13 lines · Fernando Fernandez Mancera
Quoted 11 lines · Krzysztof Kozlowski
Quoted 6 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 provides little to no practical benefit today.

It does. We all use generic kernels, thus it is one configuration for all boards and some setups have IPv6 and some not. The ones without IPv6 just don't use that module.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

While I understand this, I would like to clarify that IMHO IPv6 isn't a secondary protocol and it is fundamental to modern networking. This is

Not for end user devices. None of my devices - neither routers, nor embedded boards, nor mobile phone from 5G provider - receive IPv6 address, thus for them it is not fundamental.

If that is the case for them, then they should just CONFIG_IPV6=n.

That's not a question to me. Look what I wrote: "We all use generic kernels" - in a meaning of generic kernel, with generic defconfig built once serving every machine.

Quoted 7 lines
Quoted 5 lines

I agree it is fundamental for your cloud machines and network backbone which you are targeting, but this patchset completely ignores other users calling their use-cases "little practical benefit"! Try running Amiga machine...

Are you talking about [0]? That's legacy hardware and in this case just

Dunno what is legacy there...

Quoted 1 line

disable IPv6 altogether, why would you still prefer to have it as a module?

That's not a question to me - someone added it as a module now. The author here changes it to built-in.

Quoted 13 lines
   [0] https://en.wikipedia.org/wiki/Amiga
Quoted 10 lines

There is no even bloatometer stats for these defconfigs so we can see the impact.

Quoted 3 lines

why I believe it should be built-in by default. Currently OpenWRT, Debian ARM and others already ships the kernel with CONFIG_IPV6=y. I know that Alpine and Yocto doesn't do that for arm64.

Maybe there are other reasons why distro should not choose it as module (like module load calls on ipv6 packets) but that was not explained here.

Quoted 8 lines
Quoted 5 lines

Arch Linux Rpi kernel on arm64 has IPV6=6 and the module itself is 650 kB. That's noticeable for smaller arm64 boards.

For arm it would be even more noticeable as some have 256 MB RAM like first Rpi.

You are arguing that these will never be able to migrate to an IPv6 world given their memory is too small?

No. I argue that they do not need IPv6 in many cases, thus use-case of IPV6=m is perfectly valid.

The entire discussion here started with "The modular IPv6 use-case provides little to no practical benefit today."

and this is clearly false. I brought you already few arguments of valid use case today.

Quoted 18 lines
Quoted 18 lines
Quoted 17 lines

I guess the most critical one here is Yocto but if the developer of the embedded device is sure they won't use IPv6 at all, they should turn it off.

At the same time, Alpine ships software that enable IPV6 and is frequently loaded as a module. So the only remaining concern would be the boot partition size. I don't really have a solution for that problem.

I think that the infrastructure for allowing IPV6=m is bug-prone and it impacts performance. Forcing the use of indirect function calls in core networking, Netfilter or BPF datapaths seems like a heavy tax to me.

Quoted 2 lines

Also, with these generic kernels (so again all machines are using same ones, e.g. distro) users can easily blacklist the module.

FWIW; users can still boot with kernel command line parameter ipv6.disable=1 and then IPV6 will be administratively disabled.

Quoted 7 lines
Quoted 4 lines

It's not the same. You enabled it on amiga_defconfig and do you understand what sort of machine is that? The newest have 16 MB RAM, many much less like 2 MB, and ipv6 module on m68k is 400 kB, so pretty significant change.

If IPv6 is not relevant for amiga_defconfig presumably it should just be set to CONFIG_IPV6=n?

It might be relevant to some, but this makes it relevant to everyone on Amiga.

There is a reason why kernel supports modules or do you suggest "modules provide little to no practical benefit today" and let's just have everything built-in or disabled.

Best regards,
Krzysztof

#37 lore raw
In reply to Krzysztof Kozlowski
Quoted 15 lines · Krzysztof Kozlowski
Quoted 14 lines · Fernando Fernandez Mancera
Quoted 12 lines · Krzysztof Kozlowski
Quoted 6 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 provides little to no practical benefit today.

It does. We all use generic kernels, thus it is one configuration for all boards and some setups have IPv6 and some not. The ones without IPv6 just don't use that module.

Quoted 7 lines
Quoted 2 lines

While I understand this, I would like to clarify that IMHO IPv6 isn't a secondary protocol and it is fundamental to modern networking. This is

Not for end user devices. None of my devices - neither routers, nor embedded boards, nor mobile phone from 5G provider - receive IPv6 address, thus for them it is not fundamental.

I am not so sure about this. Many if not most modern routers provide IPv6 support and as I said it is enabled as built-in in openWRT since [1]. For mobile phones they probably use IPv6 when connected to routers but even 5G providers are using IPv6. They are working on IPv6-only deployments with NAT64 too [2].

[1] https://github.com/openwrt/openwrt/commit/0c8f0186d58468024db96a5ab0ca36a4d400d408

[2] https://www.ietf.org/archive/id/draft-ma-v6ops-5g-ipv6only-01.html

Quoted 8 lines

I agree it is fundamental for your cloud machines and network backbone which you are targeting, but this patchset completely ignores other users calling their use-cases "little practical benefit"! Try running Amiga machine...

There is no even bloatometer stats for these defconfigs so we can see the impact.

Sure. I can provide them.

Quoted 29 lines
Quoted 3 lines

why I believe it should be built-in by default. Currently OpenWRT, Debian ARM and others already ships the kernel with CONFIG_IPV6=y. I know that Alpine and Yocto doesn't do that for arm64.

Maybe there are other reasons why distro should not choose it as module (like module load calls on ipv6 packets) but that was not explained here.

Arch Linux Rpi kernel on arm64 has IPV6=6 and the module itself is 650 kB. That's noticeable for smaller arm64 boards.

For arm it would be even more noticeable as some have 256 MB RAM like first Rpi.

Quoted 16 lines

I guess the most critical one here is Yocto but if the developer of the embedded device is sure they won't use IPv6 at all, they should turn it off.

At the same time, Alpine ships software that enable IPV6 and is frequently loaded as a module. So the only remaining concern would be the boot partition size. I don't really have a solution for that problem.

I think that the infrastructure for allowing IPV6=m is bug-prone and it impacts performance. Forcing the use of indirect function calls in core networking, Netfilter or BPF datapaths seems like a heavy tax to me.

Quoted 3 lines

Also, with these generic kernels (so again all machines are using same ones, e.g. distro) users can easily blacklist the module.

Quoted 8 lines
Quoted 2 lines

FWIW; users can still boot with kernel command line parameter ipv6.disable=1 and then IPV6 will be administratively disabled.

It's not the same. You enabled it on amiga_defconfig and do you understand what sort of machine is that? The newest have 16 MB RAM, many much less like 2 MB, and ipv6 module on m68k is 400 kB, so pretty significant change.

Fair enough. Of course I am not familiar with all the architectures affected. This feedback is more than welcome and it might make a lot of sense to disable IPv6 on Amiga and probably different architectures. By the way if by Amiga you mean [3] then I believe it should be disabled.

[3] https://en.wikipedia.org/wiki/Amiga

Thanks,
Fernando.

#30 lore raw
In reply to Krzysztof Kozlowski
Quoted 102 lines · Krzysztof Kozlowski
Quoted 15 lines · Daniel Borkmann
Quoted 14 lines · Krzysztof Kozlowski
Quoted 13 lines · Fernando Fernandez Mancera
Quoted 11 lines · Krzysztof Kozlowski
Quoted 6 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 provides little to no practical benefit today.

It does. We all use generic kernels, thus it is one configuration for all boards and some setups have IPv6 and some not. The ones without IPv6 just don't use that module.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

While I understand this, I would like to clarify that IMHO IPv6 isn't a secondary protocol and it is fundamental to modern networking. This is

Not for end user devices. None of my devices - neither routers, nor embedded boards, nor mobile phone from 5G provider - receive IPv6 address, thus for them it is not fundamental.

If that is the case for them, then they should just CONFIG_IPV6=n.

That's not a question to me. Look what I wrote: "We all use generic kernels" - in a meaning of generic kernel, with generic defconfig built once serving every machine.

Quoted 7 lines
Quoted 5 lines

I agree it is fundamental for your cloud machines and network backbone which you are targeting, but this patchset completely ignores other users calling their use-cases "little practical benefit"! Try running Amiga machine...

Are you talking about [0]? That's legacy hardware and in this case just

Dunno what is legacy there...

Quoted 1 line

disable IPv6 altogether, why would you still prefer to have it as a module?

That's not a question to me - someone added it as a module now. The author here changes it to built-in.

Quoted 13 lines
    [0] https://en.wikipedia.org/wiki/Amiga
Quoted 10 lines

There is no even bloatometer stats for these defconfigs so we can see the impact.

Quoted 3 lines

why I believe it should be built-in by default. Currently OpenWRT, Debian ARM and others already ships the kernel with CONFIG_IPV6=y. I know that Alpine and Yocto doesn't do that for arm64.

Maybe there are other reasons why distro should not choose it as module (like module load calls on ipv6 packets) but that was not explained here.

Quoted 8 lines
Quoted 5 lines

Arch Linux Rpi kernel on arm64 has IPV6=6 and the module itself is 650 kB. That's noticeable for smaller arm64 boards.

For arm it would be even more noticeable as some have 256 MB RAM like first Rpi.

You are arguing that these will never be able to migrate to an IPv6 world given their memory is too small?

No. I argue that they do not need IPv6 in many cases, thus use-case of IPV6=m is perfectly valid.

The entire discussion here started with "The modular IPv6 use-case provides little to no practical benefit today."

and this is clearly false. I brought you already few arguments of valid use case today.

Quoted 18 lines
Quoted 18 lines
Quoted 17 lines

I guess the most critical one here is Yocto but if the developer of the embedded device is sure they won't use IPv6 at all, they should turn it off.

At the same time, Alpine ships software that enable IPV6 and is frequently loaded as a module. So the only remaining concern would be the boot partition size. I don't really have a solution for that problem.

I think that the infrastructure for allowing IPV6=m is bug-prone and it impacts performance. Forcing the use of indirect function calls in core networking, Netfilter or BPF datapaths seems like a heavy tax to me.

Quoted 2 lines

Also, with these generic kernels (so again all machines are using same ones, e.g. distro) users can easily blacklist the module.

FWIW; users can still boot with kernel command line parameter ipv6.disable=1 and then IPV6 will be administratively disabled.

Quoted 7 lines
Quoted 4 lines

It's not the same. You enabled it on amiga_defconfig and do you understand what sort of machine is that? The newest have 16 MB RAM, many much less like 2 MB, and ipv6 module on m68k is 400 kB, so pretty significant change.

If IPv6 is not relevant for amiga_defconfig presumably it should just be set to CONFIG_IPV6=n?

Quoted 7 lines

It might be relevant to some, but this makes it relevant to everyone on Amiga.

There is a reason why kernel supports modules or do you suggest "modules provide little to no practical benefit today" and let's just have everything built-in or disabled.

Right, maybe that is a too bold statement. Probably it could be rephrased to:

"While maintaining a modular IPv6 stack still offers footprint savings for specific setups, this benefit is outweighed by the architectural burden it imposes on the rest of the kernel."

I believe that having modules is useful. I just do not think it pays off here.

maintainer
#38 lore raw
In reply to Fernando Fernandez Mancera
Quoted 6 lines · On Mon, 9 Mar 2026 03:19:33 +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 provides little to no practical benefit today.

Have you tested this? Every single VM config we have in CI dies with:

[    0.774671][    T1] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000187: 0000 [#1] SMP KASAN
[    0.775165][    T1] KASAN: null-ptr-deref in range [0x0000000000000c38-0x0000000000000c3f]
[    0.775165][    T1] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 7.0.0-rc2-virtme #1 PREEMPT(full) 
[    0.775165][    T1] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[    0.775165][    T1] RIP: 0010:ipv6_add_dev+0x32/0x1e0
[    0.775165][    T1] Code: fb 48 83 ec 08 e8 0e 48 a8 ff 85 c0 0f 84 65 01 00 00 48 8d bb 39 0c 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 48 89 fa 83 e2 07 38 d0 7f 08 84 c0 0f 85 54 01 00 00
[    0.775165][    T1] RSP: 0018:ffa0000000017d10 EFLAGS: 00010216
[    0.775165][    T1] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000001
[    0.775165][    T1] RDX: 0000000000000187 RSI: 0000000000000008 RDI: 0000000000000c39
[    0.775165][    T1] RBP: 0000000000000100 R08: ffffffffa3eed8dc R09: fffffbfff4f10288
[    0.775165][    T1] R10: fffffbfff4f10289 R11: 0000000000000001 R12: dffffc0000000000
[    0.775165][    T1] R13: dffffc0000000000 R14: ff11000001f1cc00 R15: ffffffffa8216a90
[    0.775165][    T1] FS:  0000000000000000(0000) GS:ff1100008707a000(0000) knlGS:0000000000000000
[    0.775165][    T1] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    0.775165][    T1] CR2: ff11000036a1e000 CR3: 000000003453b001 CR4: 0000000000771ef0
[    0.775165][    T1] PKRU: 55555554
[    0.775165][    T1] Call Trace:
[    0.775165][    T1]  <TASK>
[    0.775165][    T1]  addrconf_init+0xa9/0x160
[    0.775165][    T1]  inet6_init+0x287/0x410
[    0.775165][    T1]  do_one_initcall+0xd7/0x4a0
[    0.775165][    T1]  ? trace_event_raw_event_initcall_level+0x210/0x210
[    0.775165][    T1]  ? __kmalloc_noprof+0x2c5/0x730
[    0.775165][    T1]  kernel_init_freeable+0x57d/0x620
[    0.775165][    T1]  ? rest_init+0x200/0x200
[    0.775165][    T1]  kernel_init+0x1e/0x170
[    0.775165][    T1]  ? _raw_spin_unlock_irq+0x33/0x50
[    0.775165][    T1]  ret_from_fork+0x472/0x6b0
[    0.775165][    T1]  ? arch_exit_to_user_mode_prepare.isra.0+0x140/0x140
[    0.775165][    T1]  ? __switch_to+0x538/0xcf0
[    0.775165][    T1]  ? rest_init+0x200/0x200
[    0.775165][    T1]  ret_from_fork_asm+0x11/0x20
[    0.775165][    T1]  </TASK>
[    0.775165][    T1] Modules linked in:
[    0.816998][    T1] ---[ end trace 0000000000000000 ]---
[    0.818082][    T1] RIP: 0010:ipv6_add_dev+0x32/0x1e0
[    0.819103][    T1] Code: fb 48 83 ec 08 e8 0e 48 a8 ff 85 c0 0f 84 65 01 00 00 48 8d bb 39 0c 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 48 89 fa 83 e2 07 38 d0 7f 08 84 c0 0f 85 54 01 00 00
[    0.822985][    T1] RSP: 0018:ffa0000000017d10 EFLAGS: 00010216
[    0.824176][    T1] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000001
[    0.825749][    T1] RDX: 0000000000000187 RSI: 0000000000000008 RDI: 0000000000000c39
[    0.827317][    T1] RBP: 0000000000000100 R08: ffffffffa3eed8dc R09: fffffbfff4f10288
[    0.828892][    T1] R10: fffffbfff4f10289 R11: 0000000000000001 R12: dffffc0000000000
[    0.830460][    T1] R13: dffffc0000000000 R14: ff11000001f1cc00 R15: ffffffffa8216a90
[    0.832037][    T1] FS:  0000000000000000(0000) GS:ff1100008707a000(0000) knlGS:0000000000000000
[    0.833800][    T1] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    0.835095][    T1] CR2: ff11000036a1e000 CR3: 000000003453b001 CR4: 0000000000771ef0
[    0.836670][    T1] PKRU: 55555554
[    0.837358][    T1] Kernel panic - not syncing: Fatal exception
[    0.838351][    T1] ---[ end Kernel panic - not syncing: Fatal exception ]---
#39 lore raw
Quoted 10 lines · Jakub Kicinski
Quoted 6 lines · On Mon, 9 Mar 2026 03:19:33 +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 provides little to no practical benefit today.

Have you tested this? Every single VM config we have in CI dies with:

Hi Jakub,

I did and I just booted a VM with the series. I just discovered that it dies with virtme-ng. Changing the fs_initcall() to device_initcall() fixes it so this is likely a race condition.. probably due to loopback?

Sorry about the noise. I do not understand why this didn't happen on my libvirt setup but it did happen on virtme-ng.

Well, if there is consensus that we want to go ahead with this, I will address this on the V2.

Thanks for letting me know.
Fernando.

Quoted 49 lines
[    0.774671][    T1] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000187: 0000 [#1] SMP KASAN
[    0.775165][    T1] KASAN: null-ptr-deref in range [0x0000000000000c38-0x0000000000000c3f]
[    0.775165][    T1] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 7.0.0-rc2-virtme #1 PREEMPT(full)
[    0.775165][    T1] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[    0.775165][    T1] RIP: 0010:ipv6_add_dev+0x32/0x1e0
[    0.775165][    T1] Code: fb 48 83 ec 08 e8 0e 48 a8 ff 85 c0 0f 84 65 01 00 00 48 8d bb 39 0c 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 48 89 fa 83 e2 07 38 d0 7f 08 84 c0 0f 85 54 01 00 00
[    0.775165][    T1] RSP: 0018:ffa0000000017d10 EFLAGS: 00010216
[    0.775165][    T1] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000001
[    0.775165][    T1] RDX: 0000000000000187 RSI: 0000000000000008 RDI: 0000000000000c39
[    0.775165][    T1] RBP: 0000000000000100 R08: ffffffffa3eed8dc R09: fffffbfff4f10288
[    0.775165][    T1] R10: fffffbfff4f10289 R11: 0000000000000001 R12: dffffc0000000000
[    0.775165][    T1] R13: dffffc0000000000 R14: ff11000001f1cc00 R15: ffffffffa8216a90
[    0.775165][    T1] FS:  0000000000000000(0000) GS:ff1100008707a000(0000) knlGS:0000000000000000
[    0.775165][    T1] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    0.775165][    T1] CR2: ff11000036a1e000 CR3: 000000003453b001 CR4: 0000000000771ef0
[    0.775165][    T1] PKRU: 55555554
[    0.775165][    T1] Call Trace:
[    0.775165][    T1]  <TASK>
[    0.775165][    T1]  addrconf_init+0xa9/0x160
[    0.775165][    T1]  inet6_init+0x287/0x410
[    0.775165][    T1]  do_one_initcall+0xd7/0x4a0
[    0.775165][    T1]  ? trace_event_raw_event_initcall_level+0x210/0x210
[    0.775165][    T1]  ? __kmalloc_noprof+0x2c5/0x730
[    0.775165][    T1]  kernel_init_freeable+0x57d/0x620
[    0.775165][    T1]  ? rest_init+0x200/0x200
[    0.775165][    T1]  kernel_init+0x1e/0x170
[    0.775165][    T1]  ? _raw_spin_unlock_irq+0x33/0x50
[    0.775165][    T1]  ret_from_fork+0x472/0x6b0
[    0.775165][    T1]  ? arch_exit_to_user_mode_prepare.isra.0+0x140/0x140
[    0.775165][    T1]  ? __switch_to+0x538/0xcf0
[    0.775165][    T1]  ? rest_init+0x200/0x200
[    0.775165][    T1]  ret_from_fork_asm+0x11/0x20
[    0.775165][    T1]  </TASK>
[    0.775165][    T1] Modules linked in:
[    0.816998][    T1] ---[ end trace 0000000000000000 ]---
[    0.818082][    T1] RIP: 0010:ipv6_add_dev+0x32/0x1e0
[    0.819103][    T1] Code: fb 48 83 ec 08 e8 0e 48 a8 ff 85 c0 0f 84 65 01 00 00 48 8d bb 39 0c 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 48 89 fa 83 e2 07 38 d0 7f 08 84 c0 0f 85 54 01 00 00
[    0.822985][    T1] RSP: 0018:ffa0000000017d10 EFLAGS: 00010216
[    0.824176][    T1] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000001
[    0.825749][    T1] RDX: 0000000000000187 RSI: 0000000000000008 RDI: 0000000000000c39
[    0.827317][    T1] RBP: 0000000000000100 R08: ffffffffa3eed8dc R09: fffffbfff4f10288
[    0.828892][    T1] R10: fffffbfff4f10289 R11: 0000000000000001 R12: dffffc0000000000
[    0.830460][    T1] R13: dffffc0000000000 R14: ff11000001f1cc00 R15: ffffffffa8216a90
[    0.832037][    T1] FS:  0000000000000000(0000) GS:ff1100008707a000(0000) knlGS:0000000000000000
[    0.833800][    T1] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    0.835095][    T1] CR2: ff11000036a1e000 CR3: 000000003453b001 CR4: 0000000000771ef0
[    0.836670][    T1] PKRU: 55555554
[    0.837358][    T1] Kernel panic - not syncing: Fatal exception
[    0.838351][    T1] ---[ end Kernel panic - not syncing: Fatal exception ]---
maintainer
#21 lore raw
In reply to Krzysztof Kozlowski
Quoted 2 lines · On Mon, 9 Mar 2026 11:26:08 +0100 Krzysztof Kozlowski wrote:

Heh, I just checked, that's 6 MB module on arm64 which apparently you want to put into the kernel!

Pretty sure you get 6MB because you have DEBUG_INFO enabled? IMO "I have full debug info but I care about kernel size" is internally inconsistent.

Here is the top line of bloatometer without debug info:

add/remove: 1769/7 grow/shrink: 86/0 up/down: 374521/-228 (374293)

The vmlinux increases by 200kB with IPv6 built in. Not a very dramatic increase.

Please note that opening any dual-stack socket will cause the IPv6 module to get loaded. And opening a dual-stack socket will fail if IPv6 is blacklisted. So I find it quite hard to believe that other that deeply embedded systems with custom configs there are systems out there which don't end up with IPv6 loaded. Whether they have a single IPv6 address configured or not.

And if we stop supporting =m we can actually turn a bunch of indirect calls into static inlines so in practice the memory use on real system will be lower!

Please be reasonable, this is objectively the right move.

#3 lore raw

Re: [PATCH 01/10 net-next] ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs

In reply to Krzysztof Kozlowski
Quoted 10 lines · Krzysztof Kozlowski
Quoted 9 lines · Fernando Fernandez Mancera

Configuring IPV6 as a module provides little or no benefit and requires time and resources to maintain. Therefore, drop the support for it.

Change CONFIG_IPV6 from tristate to bool. Remove all Kconfig dependencies across the tree that explicitly checked for IPV6=m. Adjust all the default configurations from CONFIG_IPV6=m to CONFIG_IPV6=y. In addition, remove MODULE_DESCRIPTION(), MODULE_ALIAS(), MODULE_AUTHOR() and MODULE_LICENSE().

Quoted 4 lines
Quoted 4 lines

This is also replacing module_init() by fs_initcall().

---

-->8--

Quoted 7 lines

No, I don't want IPV6. It is allowed as module if some users need, but it's heavy bloat added to each person's build testing setup. Kernel image is already huge and barely fits boot partitions when built with KASAN and I do want a generic image with KASAN.

It must stay module for me. Alternatively, drop it, but then some users will be really affected.

I agree. If anything I would prefer to see IPv4 be made optional (and modular) as well, and not as something IPv6 depends on, it's (AFAIK) impossible today to build an IPv6-only Linux kernel.

-- kolla

#4 lore raw

Re: [PATCH 01/10 net-next] ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs

Quoted 9 lines · Kolbjørn Barmen
Quoted 4 lines · Krzysztof Kozlowski

On 09/03/2026 03:19, Fernando Fernandez Mancera wrote:

It must stay module for me. Alternatively, drop it, but then some users will be really affected.

I agree. If anything I would prefer to see IPv4 be made optional (and modular) as well, and not as something IPv6 depends on, it's (AFAIK) impossible today to build an IPv6-only Linux kernel.

My first feeling was that this is a bad idea as well. On the other hand I found that the default changed from =m to -y over 10 years ago, all recent distros listed in https://github.com/nyrahul/linux-kernel-configs
use that default (the only two exceptions are board specific builds of Debian and Ubuntu for linux-5.x).

The list does not include openwrt though, and I know that in previous releases, there was an optional kmod-ipv6 package that could be left out of an install without rebuilding the kernel. Configurations under 128MB are only partially supported there these days, so maybe it's no longer important for openwrt either, but it would be good to get a confirmation from someone doing the packaging.

For optional IPv4 support, I would expect that it's possible to make it a loadable module, with a significant amount of work and little benefit. Loading an ipv6 module without also loading ipv4 sounds completely unrealistic though, given the way the code is structured today.

Arnd

#22 lore raw
In reply to Jakub Kicinski
Quoted 5 lines · Jakub Kicinski
Quoted 2 lines · On Mon, 9 Mar 2026 11:26:08 +0100 Krzysztof Kozlowski wrote:

Heh, I just checked, that's 6 MB module on arm64 which apparently you want to put into the kernel!

Pretty sure you get 6MB because you have DEBUG_INFO enabled?

Yeah, that was defconfig with KASAN, not full debug info. defconfig comes with deduced debug info. In one of other email threads I corrected that actual size on distro kernel is much smaller, e.g. 200-400 kB depending on arch or distro settings.

Quoted 2 lines

IMO "I have full debug info but I care about kernel size" is internally inconsistent.

My argument is that many of arm64 devices I work with have fixed partition sizes, come with their own bootloader which uses separate fixed-size boot partition. I still want to be able to load arm64 defconfig into that boot partition. If it does not fit, I need to tweak defconfig, e.g. disable some options.

I find it valid usecase and I was disagreeing here with that cloud-only or big-machines-only approach.

Quoted 8 lines

Here is the top line of bloatometer without debug info:

add/remove: 1769/7 grow/shrink: 86/0 up/down: 374521/-228 (374293)

The vmlinux increases by 200kB with IPv6 built in. Not a very dramatic increase.

Quoted 6 lines

Please note that opening any dual-stack socket will cause the IPv6 module to get loaded. And opening a dual-stack socket will fail if IPv6 is blacklisted. So I find it quite hard to believe that other that deeply embedded systems with custom configs there are systems out there which don't end up with IPv6 loaded. Whether they have a single IPv6 address configured or not.

Yes, Ubuntu for that reasons does not have it even as module.

This should be used as *the* argument for these changes.

Quoted 6 lines

And if we stop supporting =m we can actually turn a bunch of indirect calls into static inlines so in practice the memory use on real system will be lower!

Please be reasonable, this is objectively the right move.

I am very reasonable, just need to hear reasons. Just to remind - none of the machines I have, none of the routers, none of the mobile phones on 4G and 5G receive IPv6 so they don't actually need it. Not having IPv6 built-in is therefore a valid use case.

Best regards,
Krzysztof

#5 lore raw

Re: [PATCH 01/10 net-next] ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs

In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Kolbjørn Barmen
Quoted 4 lines · Krzysztof Kozlowski

On 09/03/2026 03:19, Fernando Fernandez Mancera wrote:

It must stay module for me. Alternatively, drop it, but then some users will be really affected.

I agree. If anything I would prefer to see IPv4 be made optional (and modular) as well, and not as something IPv6 depends on, it's (AFAIK) impossible today to build an IPv6-only Linux kernel.

[...]

Quoted 5 lines

For optional IPv4 support, I would expect that it's possible to make it a loadable module, with a significant amount of work and little benefit. Loading an ipv6 module without also loading ipv4 sounds completely unrealistic though, given the way the code is structured today.

I played with building IPv6-only kernels some years ago. It was possible (at least for the reduced config I was using as a start), but yes, a fair amount of investigation and churn, to find all the IPv4 common code and turn it into "generic" common code.

IPv4 as a module would get us in the same mess with have with IPv6, let's not do that.

But even IPV4=n, I abandonned the idea because of the work/churn vs benefit ratio.

Signature · 1 line
Sabrina
#6 lore raw

Re: [PATCH 01/10 net-next] ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs

In reply to Arnd Bergmann
Quoted 4 lines · Arnd Bergmann

The list does not include openwrt though, and I know that in previous releases, there was an optional kmod-ipv6 package that could be left out of an install without rebuilding the kernel.

The kmod-ipv6 package was dropped in 2016:
https://github.com/openwrt/openwrt/commit/33beafa8d88e51907acba6fdece5a35f509934df

And IPv6 was unconditionally enabled in OpenWrt in 2022:
https://github.com/openwrt/openwrt/commit/832e7b817221d288df76b763ca12c585365db5d8

Bjørn

maintainer
#23 lore raw
In reply to Krzysztof Kozlowski
Quoted 14 lines · On Tue, 10 Mar 2026 21:02:40 +0100 Krzysztof Kozlowski wrote:
Quoted 7 lines

Here is the top line of bloatometer without debug info:

add/remove: 1769/7 grow/shrink: 86/0 up/down: 374521/-228 (374293)

The vmlinux increases by 200kB with IPv6 built in. Not a very dramatic increase.

Quoted 6 lines

Please note that opening any dual-stack socket will cause the IPv6 module to get loaded. And opening a dual-stack socket will fail if IPv6 is blacklisted. So I find it quite hard to believe that other that deeply embedded systems with custom configs there are systems out there which don't end up with IPv6 loaded. Whether they have a single IPv6 address configured or not.

Quoted 3 lines

Yes, Ubuntu for that reasons does not have it even as module.

This should be used as *the* argument for these changes.

Completely fair, the submission is severely lacking in motivation and impact analysis :(

#24 lore raw
Quoted 15 lines · Jakub Kicinski
Quoted 14 lines · On Tue, 10 Mar 2026 21:02:40 +0100 Krzysztof Kozlowski wrote:
Quoted 13 lines

Here is the top line of bloatometer without debug info:

   add/remove: 1769/7 grow/shrink: 86/0 up/down: 374521/-228 (374293)

The vmlinux increases by 200kB with IPv6 built in. Not a very dramatic increase.

Please note that opening any dual-stack socket will cause the IPv6 module to get loaded. And opening a dual-stack socket will fail if IPv6 is blacklisted. So I find it quite hard to believe that other that deeply embedded systems with custom configs there are systems out there which don't end up with IPv6 loaded. Whether they have a single IPv6 address configured or not.

Quoted 7 lines
Quoted 3 lines

Yes, Ubuntu for that reasons does not have it even as module.

This should be used as *the* argument for these changes.

Completely fair, the submission is severely lacking in motivation and impact analysis :(

Yes it is. Sorry. I did handle that partially on v2 but will included as much arguments as possible in v3 and greater.

Thanks,
Fernando.

#7 lore raw

Re: [PATCH 01/10 net-next] ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs

In reply to Bjørn Mork
Quoted 7 lines · Bjørn Mork
Quoted 4 lines · Arnd Bergmann

The list does not include openwrt though, and I know that in previous releases, there was an optional kmod-ipv6 package that could be left out of an install without rebuilding the kernel.

Quoted 5 lines

The kmod-ipv6 package was dropped in 2016:
https://github.com/openwrt/openwrt/commit/33beafa8d88e51907acba6fdece5a35f509934df

And IPv6 was unconditionally enabled in OpenWrt in 2022:
https://github.com/openwrt/openwrt/commit/832e7b817221d288df76b763ca12c585365db5d8

Thanks for checking!

Not sure what the commit log for the second one is trying to say, as there generally was no build failure in mainline for a long time

But if nobody has bothered to revert the patch, it doesn't seem to have caused any problems.

Arnd

#8 lore raw

Re: [PATCH 01/10 net-next] ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs

In reply to Arnd Bergmann
Quoted 4 lines · Arnd Bergmann
Quoted 3 lines · Kolbjørn Barmen
Quoted 2 lines · Krzysztof Kozlowski

On 09/03/2026 03:19, Fernando Fernandez Mancera wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

It must stay module for me. Alternatively, drop it, but then some users will be really affected.

I agree. If anything I would prefer to see IPv4 be made optional (and modular) as well, and not as something IPv6 depends on, it's (AFAIK) impossible today to build an IPv6-only Linux kernel.

My first feeling was that this is a bad idea as well. On the other hand

Exactly my feeling. That's why I stayed quiet for a while, and gave it some thought...

Quoted 4 lines

I found that the default changed from =m to -y over 10 years ago, all recent distros listed in https://github.com/nyrahul/linux-kernel-configs
use that default (the only two exceptions are board specific builds of Debian and Ubuntu for linux-5.x).

Thanks, that is something I was wondering too.

Obviously the world is moving the IPv6 (but having IPv6=m doesn't preclude that!). From the other side, there is a trend to have as much as possible in modules instead of built-in. A larger base kernel not only has impact on memory usage (and loading modules has, too), but also on e.g. boot partitions. Various platform-specific limitations may be at play (boot loader size limits, boot partition size limits, base kernel must fit in the first memory block on systems with many small discontiguous memory blocks, ...).

But apparently even the Android gki_defconfig (which is not on the page mentioned above?) has IPv6 built-in.

Back to the numbers:
- base kernel: atari_defconfig (CONFIG_IPv6=m)
- with this series, CONFIG_IPv6=n: -22 KiB
- with this series, CONFIG_IPv6=y: +246 KiB
Note that I ignored any defconfig changes in these series. The size impact is almost the same for v1 and v2, but only v2 boots.

Each new kernel release increases kernel size by ca. 30-40 KiB on average. So a one-time increase of 246 KiB is not unsurmountable, and slightly less than the increase between v6.14 and v6.19...

Gr{oetje,eeting}s,

Geert

--
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

#31 lore raw
In reply to Krzysztof Kozlowski
Quoted 4 lines · Krzysztof Kozlowski
Quoted 1 line

Are you talking about [0]? That's legacy hardware and in this case just

Dunno what is legacy there...

Is this satire?

I'm not sure why you're being quite so aggressive in your response overall here, but Amiga is ABSOLUTELY legacy and you are delusional if you think otherwise?

I think the kernel should absolutely drop support for it, museum pieces like this cause undue maintenance burden, and sorry not sorry - if you own hardware that old, live with using older kernels.

In any case this kind of facecious engagement, especially in response to somebody as lovely as Fernando, is really unhelpful.

If I'm wrong and somehow Amiga isn't legacy in 2026, then SAY SO instead of giving an unnecessarily mean, dismissive and frankly embarassing response like the above.

[snip]

Quoted 2 lines
Quoted 2 lines
   [0] https://en.wikipedia.org/wiki/Amiga

Thanks, Lorenzo

#32 lore raw
Quoted 12 lines · Lorenzo Stoakes (Oracle)
Quoted 4 lines · Krzysztof Kozlowski
Quoted 1 line

Are you talking about [0]? That's legacy hardware and in this case just

Dunno what is legacy there...

Is this satire?

I'm not sure why you're being quite so aggressive in your response overall here, but Amiga is ABSOLUTELY legacy and you are delusional if you think otherwise?

Quoted 6 lines

I think the kernel should absolutely drop support for it, museum pieces like this cause undue maintenance burden, and sorry not sorry - if you own hardware that old, live with using older kernels.

In any case this kind of facecious engagement, especially in response to somebody as lovely as Fernando, is really unhelpful.

Response was to Daniel. You come late to the thread, pick up one thing and poke... great.

Quoted 4 lines

If I'm wrong and somehow Amiga isn't legacy in 2026, then SAY SO instead of giving an unnecessarily mean, dismissive and frankly embarassing response like the above.

Calling something legacy in this thread is not really appropriate because it is diminishing its important or requirements.

Till we support given hardware, we are supposed to consider its requirements. If you do not consider these requirements, then you do not consider that hardware as worth being supported and this means you should first propose patch to remove that hardware.

If you do not want to care about that hardware, don't use arguments "legacy" in discussions, but simply drop it. We do such with "legacy" architectures.

Best regards,
Krzysztof

#33 lore raw
Quoted 17 lines · Krzysztof Kozlowski
Quoted 16 lines · Lorenzo Stoakes (Oracle)
Quoted 4 lines · Krzysztof Kozlowski
Quoted 1 line

Are you talking about [0]? That's legacy hardware and in this case just

Dunno what is legacy there...

Is this satire?

I'm not sure why you're being quite so aggressive in your response overall here, but Amiga is ABSOLUTELY legacy and you are delusional if you think otherwise?

I think the kernel should absolutely drop support for it, museum pieces like this cause undue maintenance burden, and sorry not sorry - if you own hardware that old, live with using older kernels.

Quoted 5 lines
Quoted 2 lines

In any case this kind of facecious engagement, especially in response to somebody as lovely as Fernando, is really unhelpful.

Response was to Daniel. You come late to the thread, pick up one thing and poke... great.

I call out unpleasant/bullying behaviour when I see it, and I'm not going to apologise for that, especially when it comes from an experienced maintainer.

And sure, s/Fernando/Daniel/, but I'm not sure that's the incredible riposte you seem to think it is.

I'm not going to belabour the point, being civil to people when they are not being unreasonable should be a default, it's sad that it's not always the case in the kernel.

Quoted 9 lines
Quoted 5 lines

If I'm wrong and somehow Amiga isn't legacy in 2026, then SAY SO instead of giving an unnecessarily mean, dismissive and frankly embarassing response like the above.

Calling something legacy in this thread is not really appropriate because it is diminishing its important or requirements.

Quoted 8 lines

Till we support given hardware, we are supposed to consider its requirements. If you do not consider these requirements, then you do not consider that hardware as worth being supported and this means you should first propose patch to remove that hardware.

If you do not want to care about that hardware, don't use arguments "legacy" in discussions, but simply drop it. We do such with "legacy" architectures.

Perhaps you could have replied with this instead of rudely making the ludicrious claim that Amiga isn't legacy in 2026?

Quoted 3 lines

Best regards,
Krzysztof

Thanks, Lorenzo

#34 lore raw
Quoted 14 lines · Lorenzo Stoakes (Oracle)
Quoted 14 lines
Quoted 5 lines

If I'm wrong and somehow Amiga isn't legacy in 2026, then SAY SO instead of giving an unnecessarily mean, dismissive and frankly embarassing response like the above.

Calling something legacy in this thread is not really appropriate because it is diminishing its important or requirements.

Till we support given hardware, we are supposed to consider its requirements. If you do not consider these requirements, then you do not consider that hardware as worth being supported and this means you should first propose patch to remove that hardware.

Quoted 6 lines
Quoted 3 lines

If you do not want to care about that hardware, don't use arguments "legacy" in discussions, but simply drop it. We do such with "legacy" architectures.

Perhaps you could have replied with this instead of rudely making the ludicrious claim that Amiga isn't legacy in 2026?

Initial comment about "legacy" lacked any arguments why it is legacy, thus I don't see what is rude in response "Dunno what is legacy there..." except that it is not that helpful to understand the point. Just like the original comment wasn't helpful.

Best regards,
Krzysztof

#35 lore raw
In reply to Krzysztof Kozlowski
Quoted 6 lines · Krzysztof Kozlowski
Quoted 4 lines · Lorenzo Stoakes (Oracle)

If I'm wrong and somehow Amiga isn't legacy in 2026, then SAY SO instead of giving an unnecessarily mean, dismissive and frankly embarassing response like the above.

Quoted 7 lines

Calling something legacy in this thread is not really appropriate because it is diminishing its important or requirements.

Till we support given hardware, we are supposed to consider its requirements. If you do not consider these requirements, then you do not consider that hardware as worth being supported and this means you should first propose patch to remove that hardware.

I don't think it's so binary. AFAIU (and recall also Linus saying that) it's ok to make things less optimal for older/less common hardware, if that's the cost to make the kernel better for the major ones. So that's why we're e.g. discussing removing CONFIG_HIMEM which could limit how much physical RAM some 32bit architectures can use. Or we can have new features e.g. 64-bit only.

We can call that older/less common hardware "legacy" or "museum" or whatever, I wouldn't say it's diminishing it, just stating a fact.

Of course the devil is in the details so that probably to some extent depends on what exactly you mean as "requirements" above. AFAIU the conclusion here was already that ipv6=m isn't consired one for Amiga to stay, and it's enough to have ipv6=n there.

Quoted 7 lines

If you do not want to care about that hardware, don't use arguments "legacy" in discussions, but simply drop it. We do such with "legacy" architectures.

Best regards,
Krzysztof

#36 lore raw
Quoted 15 lines · Vlastimil Babka
Quoted 6 lines · Krzysztof Kozlowski
Quoted 4 lines · Lorenzo Stoakes (Oracle)

If I'm wrong and somehow Amiga isn't legacy in 2026, then SAY SO instead of giving an unnecessarily mean, dismissive and frankly embarassing response like the above.

Quoted 7 lines

Calling something legacy in this thread is not really appropriate because it is diminishing its important or requirements.

Till we support given hardware, we are supposed to consider its requirements. If you do not consider these requirements, then you do not consider that hardware as worth being supported and this means you should first propose patch to remove that hardware.

Quoted 8 lines

I don't think it's so binary. AFAIU (and recall also Linus saying that) it's ok to make things less optimal for older/less common hardware, if that's the cost to make the kernel better for the major ones. So that's why we're e.g. discussing removing CONFIG_HIMEM which could limit how much physical RAM some 32bit architectures can use. Or we can have new features e.g. 64-bit only.

We can call that older/less common hardware "legacy" or "museum" or whatever, I wouldn't say it's diminishing it, just stating a fact.

Yes. Amiga was the first thing I poked to discuss affecting less capable hardware. But we could also talk about ARM 32-bit, which is not yet considered "legacy" because new hardware is being manufactured and sold. Legacy in a meaning we do consider its requirements/support.

Quoted 6 lines

Of course the devil is in the details so that probably to some extent depends on what exactly you mean as "requirements" above. AFAIU the conclusion here was already that ipv6=m isn't consired one for Amiga to stay, and it's enough to have ipv6=n there.

Yes, and other replies (parallel threads) also provide context and arguments why most, not all though, distros don't even use IPV6=m, while they are making everything else modules by default.

Best regards,
Krzysztof

#10 lore raw

Re: [PATCH 02/10 net-next] ipv6: replace IS_BUILTIN(CONFIG_IPV6) with IS_ENABLED(CONFIG_IPV6)

In reply to Fernando Fernandez Mancera

Review

Quoted 2 lines · Fernando Fernandez Mancera
(quoted diff) +1 -1
-#if IS_BUILTIN(CONFIG_IPV6)
+#if IS_ENABLED(CONFIG_IPV6)

Couldn't this just be #ifdef CONFIG_IPV6?