Netdev List
 help / color / mirror / Atom feed
* [PATCH 00/13 RFC net-next] Allow compiling an IPv6-only kernel network stack
@ 2026-07-12  1:38 Fernando Fernandez Mancera
  2026-07-12  1:38 ` [PATCH 01/13 RFC net-next] net: ipv4: introduce CONFIG_IPV4 to decouple the IPv4 stack Fernando Fernandez Mancera
                   ` (12 more replies)
  0 siblings, 13 replies; 20+ messages in thread
From: Fernando Fernandez Mancera @ 2026-07-12  1:38 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, dsahern, horms, idosch,
	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 on this series:

If this architectural direction is accepted, immediate follow-up work within
this series will focus on cleaning up header inclusions in files where code was
split, and resolving formatting warnings inherited from the moved code.
Additionally, work will be done to minimize function guarding churn and ensure
that IPv4-specific sysctls like IGMP are completely removed when CONFIG_IPV4=n.
Network drivers carrying hard IPv4 assumptions will also be adapted.

Follow-up out of the 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.

Open questions:

1. Would it be preferable to introduce a dedicated NIPA build job with an
   IPv6-only configuration to prevent future compilation regressions?
2. Where is the preferred architectural location for ip_generic_getfrag(),
   as it currently resides out-of-place in net/ipv4/af_inet.c?
3. To eliminate noise in this series, files like udp.c, tcp.c, and raw.c remain
   in net/ipv4/. Would you prefer to relocate these shared transport files to
   net/core/?

Conclusions:

Looking at the numbers we have so far, the overall change is positive in my
opinion. Having said so, the main burden it introduces is the noise in git
which will be cumbersome when trying to identify breaking commits or blames.

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
  net: cipso: guard IPv4 packet manipulation functions
  netfilter: ipv4: guard ip_route_me_harder() with CONFIG_IPV4
  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                          |   43 +
 include/net/route.h                           |   14 +
 include/net/tcp.h                             |   16 +-
 net/Kconfig                                   |    6 +-
 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                           |  146 ++
 net/core/filter.c                             |   22 +-
 net/core/neighbour.c                          |    4 +
 net/ipv4/Kconfig                              |   29 +-
 net/ipv4/Makefile                             |   24 +-
 net/ipv4/af_inet.c                            |  114 +-
 net/ipv4/cipso_ipv4.c                         |   10 +
 net/ipv4/fib_semantics.c                      |  142 --
 net/ipv4/icmp.c                               | 1407 +------------
 net/ipv4/icmp_ipv4.c                          | 1425 +++++++++++++
 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                            |    2 +-
 net/ipv4/ping.c                               |  215 +-
 net/ipv4/ping_ipv4.c                          |  225 +++
 net/ipv4/proc.c                               |    2 +
 net/ipv4/raw.c                                |  844 --------
 net/ipv4/raw_diag.c                           |    4 +
 net/ipv4/raw_ipv4.c                           |  875 ++++++++
 net/ipv4/sysctl_net_ipv4.c                    |    2 +
 net/ipv4/tcp.c                                | 1291 ++++++++++++
 net/ipv4/tcp_bpf.c                            |    2 +
 net/ipv4/tcp_ipv4.c                           | 1299 +-----------
 net/ipv4/udp.c                                | 1733 ----------------
 net/ipv4/udp_bpf.c                            |    6 +
 net/ipv4/udp_diag.c                           |   12 +
 net/ipv4/udp_ipv4.c                           | 1773 +++++++++++++++++
 net/ipv4/udp_offload.c                        |   10 +
 net/ipv6/Kconfig                              |   17 +-
 net/ipv6/af_inet6.c                           |    5 +
 net/ipv6/datagram.c                           |   14 +
 net/ipv6/ip6_fib.c                            |    2 +
 net/ipv6/ipv6_sockglue.c                      |    5 +
 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 +-
 97 files changed, 6314 insertions(+), 5750 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.54.0


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

end of thread, other threads:[~2026-07-13 14:57 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-12  1:38 [PATCH 00/13 RFC net-next] Allow compiling an IPv6-only kernel network stack Fernando Fernandez Mancera
2026-07-12  1:38 ` [PATCH 01/13 RFC net-next] net: ipv4: introduce CONFIG_IPV4 to decouple the IPv4 stack Fernando Fernandez Mancera
2026-07-12 11:01   ` Arnd Bergmann
2026-07-13 14:00     ` Fernando Fernandez Mancera
2026-07-13 14:22       ` Arnd Bergmann
2026-07-13 14:57         ` Fernando Fernandez Mancera
2026-07-12  1:39 ` [PATCH 02/13 RFC net-next] net: core: add IPv4 fallback stubs and guards for CONFIG_IPV4=n Fernando Fernandez Mancera
2026-07-12  1:39 ` [PATCH 03/13 RFC net-next] net: inet: relocate ip_generic_getfrag and guard IPv4 socket logic Fernando Fernandez Mancera
2026-07-12  1:39 ` [PATCH 04/13 RFC net-next] net: tcp: move protocol agnostic TCP functions out of tcp_ipv4.c Fernando Fernandez Mancera
2026-07-12  1:39 ` [PATCH 05/13 RFC net-next] net: raw: split IPv4 specific logic into raw_ipv4.c Fernando Fernandez Mancera
2026-07-12  1:39 ` [PATCH 06/13 RFC net-next] net: udp: split IPv4 specific logic into udp_ipv4.c Fernando Fernandez Mancera
2026-07-12  1:39 ` [PATCH 07/13 RFC net-next] net: icmp: split IPv4 specific logic into icmp_ipv4.c Fernando Fernandez Mancera
2026-07-12  1:39 ` [PATCH 08/13 RFC net-next] net: ping: split IPv4 specific logic into ping_ipv4.c Fernando Fernandez Mancera
2026-07-12  1:39 ` [PATCH 09/13 RFC net-next] net: fib: split common nexthop logic to fib_core.c Fernando Fernandez Mancera
2026-07-12  1:39 ` [PATCH 10/13 RFC net-next] net: tunnel: guard IPv4 tunnel functions with CONFIG_IPV4 Fernando Fernandez Mancera
2026-07-12  1:39 ` [PATCH 11/13 RFC net-next] net: cipso: guard IPv4 packet manipulation functions Fernando Fernandez Mancera
2026-07-12 16:22   ` Paul Moore
2026-07-13 14:03     ` Fernando Fernandez Mancera
2026-07-12  1:39 ` [PATCH 12/13 RFC net-next] netfilter: ipv4: guard ip_route_me_harder() with CONFIG_IPV4 Fernando Fernandez Mancera
2026-07-12  1:39 ` [PATCH 13/13 RFC net-next] net: ipv4: make CONFIG_IPV4 boolean Fernando Fernandez Mancera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox