netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13 net-next] Allow compiling an IPv6-only kernel network stack
@ 2026-09-10 14:48 Fernando Fernandez Mancera
  2026-09-10 14:48 ` [PATCH 01/13 net-next] net: ipv4: introduce CONFIG_IPV4 to decouple the IPv4 stack Fernando Fernandez Mancera
                   ` (13 more replies)
  0 siblings, 14 replies; 28+ messages in thread
From: Fernando Fernandez Mancera @ 2026-09-10 14:48 UTC (permalink / raw)
  To: netdev; +Cc: horms, kuba, pabeni, edumazet, davem, Fernando Fernandez Mancera

The primary goal of this patch series is to enable the compilation of an
IPv6-only kernel by decoupling the core networking infrastructure from the IPv4
protocol.

Historically, IPv4 has been intertwined with the generic socket and transport
layers. By untangling these dependencies, this series allows systems to be
built with CONFIG_IPV4 disabled. This configuration targets strict IPv6-only
deployments, constrained environments, and specialized appliances where
removing the IPv4 subsystem reduces the network attack surface.

To achieve this, subsystems with hard dependencies on IPv4 were modified to use
conditional compilation guards. When CONFIG_IPV4 is disabled, the affected
packet manipulation routines and routing hooks evaluate to stubs returning
standard error codes. The INDIRECT_CALL_INET macros within the transport layer
were adapted to safely bypass IPv4 function pointers without penalizing the
dual-stack fast paths. In addition, there has been several code splits for UDP,
RAW, ICMP or Ping isolating the IPv4 specific code.

Finally, CONFIG_IPV4 is exposed in Kconfig as an explicit boolean, defaulting
to 'y' to preserve existing configurations.

The bloat-o-meter diff for x86_64 with dualstack and IPv6 disabled:
   
   text    data     bss     dec     hex filename 
31211950        8946390 1121076 41279416        275dfb8 vmlinux.dual 
27464679        8008670 1069040 36542389        22d97b5 vmlinux.ipv6

add/remove: 52/25057 grow/shrink: 58/565 up/down: 937258/-4632671 (-3695413)

Performance testing:

Basic TCP performance validation was conducted using iperf3 on an AMD Ryzen 9
9950X between two bridged virtual machines. These benchmarks verify that there
are no obvious performance regressions.

Kernel / Configuration            Traffic Type    Offloads ON     Offloads OFF
-------------------------------------------------------------------------------
net-next (Dual-Stack Baseline)     IPv4            20.8 Gbps       7.22 Gbps
net-next (Dual-Stack Baseline)     IPv6            20.4 Gbps       7.55 Gbps
net-next (IPv4-Only Baseline)      IPv4            20.9 Gbps       7.86 Gbps

Patched (Dual-Stack)               IPv4            21.8 Gbps       7.77 Gbps
Patched (Dual-Stack)               IPv6            21.7 Gbps       7.35 Gbps
Patched (IPv4-Only)                IPv4            20.9 Gbps       7.91 Gbps
Patched (IPv6-Only)                IPv6            21.1 Gbps       8.06 Gbps

Follow-up for this series:

Future work decoupled from this initial series includes expanding Kconfig
adaptations across remaining kernel subsystems to support an IPv6-only
environment. This includes patches for network bonding modes that assume
dual-stack availability and analyze Netfilter nftables expressions and
connection tracking to ensure pure IPv6 operations are fully independent.

The main burden the series introduce is the noise in git which will be
cumbersome when trying to identify breaking commits or blames and the
risks of regressions.

Fernando Fernandez Mancera (13):
  net: ipv4: introduce CONFIG_IPV4 to decouple the IPv4 stack
  net: core: add IPv4 fallback stubs and guards for CONFIG_IPV4=n
  net: inet: relocate ip_generic_getfrag and guard IPv4 socket logic
  net: tcp: move protocol agnostic TCP functions out of tcp_ipv4.c
  net: raw: split IPv4 specific logic into raw_ipv4.c
  net: udp: split IPv4 specific logic into udp_ipv4.c
  net: icmp: split IPv4 specific logic into icmp_ipv4.c
  net: ping: split IPv4 specific logic into ping_ipv4.c
  net: fib: split common nexthop logic to fib_core.c
  net: tunnel: guard IPv4 tunnel functions with CONFIG_IPV4
  netfilter: ipv4: guard ip_route_me_harder() with CONFIG_IPV4
  net: ipv4: disable IPv4-only sysctls when CONFIG_IPV4=n
  net: ipv4: make CONFIG_IPV4 boolean

 drivers/infiniband/Kconfig                    |    2 +-
 drivers/net/Kconfig                           |   24 +-
 drivers/net/ethernet/broadcom/Kconfig         |    2 +
 drivers/net/ethernet/chelsio/Kconfig          |    2 +-
 drivers/net/ethernet/intel/Kconfig            |    2 +
 drivers/net/ethernet/marvell/prestera/Kconfig |    1 +
 .../net/ethernet/mellanox/mlx5/core/Kconfig   |    3 +-
 drivers/net/ethernet/mellanox/mlxsw/Kconfig   |    1 +
 drivers/net/ethernet/netronome/Kconfig        |    1 +
 drivers/net/ethernet/qlogic/Kconfig           |    2 +
 drivers/net/ethernet/sfc/Kconfig              |    1 +
 drivers/net/ethernet/stmicro/stmmac/Kconfig   |    1 +
 drivers/net/ethernet/via/Kconfig              |    1 +
 drivers/net/ppp/Kconfig                       |    1 +
 .../broadcom/brcm80211/brcmfmac/Kconfig       |    1 +
 drivers/net/wireless/intel/iwlwifi/Kconfig    |    1 +
 drivers/nvme/host/Kconfig                     |    2 +-
 drivers/nvme/target/Kconfig                   |    2 +-
 drivers/scsi/bnx2fc/Kconfig                   |    1 +
 drivers/scsi/bnx2i/Kconfig                    |    1 +
 drivers/scsi/cxgbi/cxgb3i/Kconfig             |    2 +-
 drivers/scsi/cxgbi/cxgb4i/Kconfig             |    2 +-
 drivers/target/iscsi/Kconfig                  |    2 +-
 fs/Kconfig                                    |    1 +
 fs/afs/Kconfig                                |    2 +-
 fs/nfs/Kconfig                                |    2 +-
 fs/nfsd/Kconfig                               |    2 +-
 include/linux/indirect_call_wrapper.h         |    8 +-
 include/net/icmp.h                            |    1 +
 include/net/ip.h                              |  104 +-
 include/net/ip_fib.h                          |   27 +-
 include/net/route.h                           |   14 +
 include/net/tcp.h                             |   16 +-
 net/Kconfig                                   |   11 +-
 net/batman-adv/Kconfig                        |    1 +
 net/bridge/Kconfig                            |    3 +-
 net/bridge/netfilter/Kconfig                  |    6 +-
 net/core/Makefile                             |    2 +-
 net/core/dev_ioctl.c                          |    4 +
 net/core/fib_core.c                           |  307 +++
 net/core/filter.c                             |   24 +-
 net/core/neighbour.c                          |    5 +
 net/ipv4/Kconfig                              |   29 +-
 net/ipv4/Makefile                             |   24 +-
 net/ipv4/af_inet.c                            |  124 +-
 net/ipv4/fib_frontend.c                       |   96 -
 net/ipv4/fib_semantics.c                      |  205 --
 net/ipv4/icmp.c                               | 1419 +------------
 net/ipv4/icmp_ipv4.c                          | 1445 +++++++++++++
 net/ipv4/inet_connection_sock.c               |    2 +-
 net/ipv4/inet_hashtables.c                    |    4 +
 net/ipv4/ip_output.c                          |   18 -
 net/ipv4/ip_tunnel_core.c                     |   11 +
 net/ipv4/netfilter.c                          |    4 +
 net/ipv4/netfilter/Kconfig                    |    2 +-
 net/ipv4/netlink.c                            |    2 +
 net/ipv4/nexthop.c                            |    9 +-
 net/ipv4/ping.c                               |  215 +-
 net/ipv4/ping_ipv4.c                          |  228 +++
 net/ipv4/proc.c                               |   38 +-
 net/ipv4/raw.c                                |  853 --------
 net/ipv4/raw_diag.c                           |    4 +
 net/ipv4/raw_ipv4.c                           |  883 ++++++++
 net/ipv4/sysctl_net_ipv4.c                    |   32 +-
 net/ipv4/tcp.c                                | 1299 ++++++++++++
 net/ipv4/tcp_bpf.c                            |    2 +
 net/ipv4/tcp_ipv4.c                           | 1307 +-----------
 net/ipv4/udp.c                                | 1781 +---------------
 net/ipv4/udp_bpf.c                            |    6 +
 net/ipv4/udp_diag.c                           |   12 +
 net/ipv4/udp_ipv4.c                           | 1790 +++++++++++++++++
 net/ipv4/udp_offload.c                        |   10 +
 net/ipv6/Kconfig                              |   17 +-
 net/ipv6/af_inet6.c                           |    5 +
 net/ipv6/datagram.c                           |   14 +
 net/ipv6/netfilter/Kconfig                    |    2 +-
 net/ipv6/tcp_ipv6.c                           |   25 +-
 net/ipv6/udp.c                                |   18 +
 net/l2tp/Kconfig                              |    2 +-
 net/mac80211/Kconfig                          |    2 +-
 net/mpls/Kconfig                              |    1 +
 net/mptcp/Kconfig                             |    2 +-
 net/netfilter/Kconfig                         |    2 +-
 net/netfilter/ipset/Kconfig                   |    2 +-
 net/netfilter/ipvs/Kconfig                    |    2 +-
 net/openvswitch/Kconfig                       |    2 +-
 net/packet/Kconfig                            |    1 +
 net/rds/Kconfig                               |    2 +-
 net/rxrpc/Kconfig                             |    2 +-
 net/sched/Kconfig                             |    2 +-
 net/sctp/Kconfig                              |    2 +-
 net/smc/Kconfig                               |    2 +-
 net/sunrpc/Kconfig                            |    2 +-
 net/tipc/Kconfig                              |    2 +-
 net/xfrm/Kconfig                              |   12 +-
 security/smack/Kconfig                        |    1 +
 96 files changed, 6585 insertions(+), 5991 deletions(-)
 create mode 100644 net/core/fib_core.c
 create mode 100644 net/ipv4/icmp_ipv4.c
 create mode 100644 net/ipv4/ping_ipv4.c
 create mode 100644 net/ipv4/raw_ipv4.c
 create mode 100644 net/ipv4/udp_ipv4.c

-- 
2.55.0


^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2026-09-15  0:25 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-10 14:48 [PATCH 00/13 net-next] Allow compiling an IPv6-only kernel network stack Fernando Fernandez Mancera
2026-09-10 14:48 ` [PATCH 01/13 net-next] net: ipv4: introduce CONFIG_IPV4 to decouple the IPv4 stack Fernando Fernandez Mancera
2026-09-10 15:11   ` Nicolai Buchwitz
2026-09-10 15:32     ` Fernando Fernandez Mancera
2026-09-10 15:36     ` Arnd Bergmann
2026-09-10 16:22   ` Fernando Fernandez Mancera
2026-09-10 16:30     ` Fernando Fernandez Mancera
2026-09-10 16:56   ` Sven Eckelmann
2026-09-11 18:39     ` Fernando Fernandez Mancera
2026-09-10 18:55   ` Chuck Lever
2026-09-11 17:46   ` Casey Schaufler
2026-09-11 18:31     ` Fernando Fernandez Mancera
2026-09-11 18:59       ` Casey Schaufler
2026-09-10 14:48 ` [PATCH 02/13 net-next] net: core: add IPv4 fallback stubs and guards for CONFIG_IPV4=n Fernando Fernandez Mancera
2026-09-10 14:48 ` [PATCH 03/13 net-next] net: inet: relocate ip_generic_getfrag and guard IPv4 socket logic Fernando Fernandez Mancera
2026-09-10 21:19   ` Stanislav Fomichev
2026-09-11 18:41     ` Fernando Fernandez Mancera
2026-09-10 14:48 ` [PATCH 04/13 net-next] net: tcp: move protocol agnostic TCP functions out of tcp_ipv4.c Fernando Fernandez Mancera
2026-09-10 14:48 ` [PATCH 05/13 net-next] net: raw: split IPv4 specific logic into raw_ipv4.c Fernando Fernandez Mancera
2026-09-10 14:48 ` [PATCH 06/13 net-next] net: udp: split IPv4 specific logic into udp_ipv4.c Fernando Fernandez Mancera
2026-09-10 14:48 ` [PATCH 07/13 net-next] net: icmp: split IPv4 specific logic into icmp_ipv4.c Fernando Fernandez Mancera
2026-09-10 14:48 ` [PATCH 08/13 net-next] net: ping: split IPv4 specific logic into ping_ipv4.c Fernando Fernandez Mancera
2026-09-10 14:48 ` [PATCH 09/13 net-next] net: fib: split common nexthop logic to fib_core.c Fernando Fernandez Mancera
2026-09-10 14:48 ` [PATCH 10/13 net-next] net: tunnel: guard IPv4 tunnel functions with CONFIG_IPV4 Fernando Fernandez Mancera
2026-09-10 14:48 ` [PATCH 11/13 net-next] netfilter: ipv4: guard ip_route_me_harder() " Fernando Fernandez Mancera
2026-09-10 14:48 ` [PATCH 12/13 net-next] net: ipv4: disable IPv4-only sysctls when CONFIG_IPV4=n Fernando Fernandez Mancera
2026-09-10 14:48 ` [PATCH 13/13 net-next] net: ipv4: make CONFIG_IPV4 boolean Fernando Fernandez Mancera
2026-09-15  0:24 ` [PATCH 00/13 net-next] Allow compiling an IPv6-only kernel network stack Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).