Allow compiling an IPv6-only kernel network stack
Subsystems (47)
v3 cover Allow compiling an IPv6-only kernel network stack
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 provide some numbers, 0.3% (32) of the released CVEs since 2025 were strictly related to IPv4 code. While the number is low, it is good for users to be able to disable it if they do not depend on it.
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.
Every Kconfig symbol that gained a new depends on IPV4 was audited against the code it guards, distinguishing genuine hard link-time dependencies from options that were only conservatively gated. Where a symbol never depended on CONFIG_INET before, depends on IPV4 || !INET is used instead of a bare dependency, so pre-existing CONFIG_INET=n configurations remain buildable as before.
Finally, CONFIG_IPV4 is exposed in Kconfig as an explicit boolean, defaulting to 'y' to preserve existing configurations.
The bloat-o-meter diff and size output for x86_64 with dualstack and IPv6 disabled:
text data bss dec hex filename
31608053 8913174 1145484 41666711 27bc897 vmlinux.dual
28809691 8183494 1101724 38094909 245483d vmlinux.ipv6
add/remove: 53/19751 grow/shrink: 65/601 up/down: 740100/-3490467 (-2750367)
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 structural cost of this series is the code movement from splitting IPv4-specific logic into new files, which will make git blame and bisection across the affected files more cumbersome than a purely additive change. Where possible, IPv4-only branches were expressed as runtime IS_ENABLED() checks relying on dead-code elimination rather than ifdef blocks, to keep the preprocessor-guard footprint as small as possible.
Changes:
v3:
Patch 1: Mark SMC as depends on IPV4 too
Patch 3: Make sure inetsw isn't accessible from other modules when
IPV4=n by using runtime checks
Patch 5: Included missing <linux/compat.h>
Patch 6: Fixed wrong removal of udp_get_len() due to a wrong rebase. Patch 13: Fixed building with INET=n
v2: https://lore.kernel.org/netdev/[email protected]/
Fernando Fernandez Mancera (16):
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
tcp: move protocol agnostic TCP functions out of tcp_ipv4.c
ipv4: raw: split IPv4 specific logic into raw_ipv4.c
ipv4: udp: split IPv4 specific logic into udp_ipv4.c
ipv4: icmp: split IPv4 specific logic into icmp_ipv4.c
ipv4: ping: split IPv4 specific logic into ping_ipv4.c
ipv4: fib: split common nexthop logic to fib_core.c
tunnels: guard IPv4 tunnel functions with CONFIG_IPV4
ipv4: disable IPv4-only sysctls when CONFIG_IPV4=n
netfilter: ipv4: guard ip_route_me_harder() with CONFIG_IPV4
net: bridge: guard ARP/RARP proxy and suppression with CONFIG_IPV4
wifi: mac80211: replace CONFIG_INET with CONFIG_IPV4 guards
netlabel: cipso: introduce CONFIG_CIPSO to decouple IPv4 dependency
ipv4: make CONFIG_IPV4 boolean
drivers/infiniband/Kconfig | 2 +- drivers/infiniband/sw/rxe/Kconfig | 2 +- drivers/net/Kconfig | 23 +- 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/qlogic/Kconfig | 2 + drivers/net/ethernet/rocker/Kconfig | 1 + 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/cxgbi/cxgb3i/Kconfig | 2 +- drivers/scsi/cxgbi/cxgb4i/Kconfig | 2 +- drivers/target/iscsi/Kconfig | 2 +- drivers/target/iscsi/cxgbit/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/cipso_ipv4.h | 18 +- include/net/icmp.h | 1 + include/net/ip.h | 111 +- include/net/ip_fib.h | 27 +- include/net/route.h | 14 + include/net/tcp.h | 16 +- include/net/udp.h | 11 + net/Kconfig | 9 +- net/batman-adv/Kconfig | 6 +- net/bridge/Kconfig | 2 +- net/bridge/br_arp_nd_proxy.c | 2 + net/bridge/br_device.c | 2 +- net/bridge/br_input.c | 2 +- net/bridge/netfilter/Kconfig | 3 +- net/core/Makefile | 2 +- net/core/dev_ioctl.c | 3 + net/core/fib_core.c | 307 +++ net/core/filter.c | 20 +- net/core/neighbour.c | 4 + net/ipv4/Kconfig | 29 +- net/ipv4/Makefile | 24 +- net/ipv4/af_inet.c | 132 +- net/ipv4/fib_frontend.c | 96 - net/ipv4/fib_semantics.c | 205 -- net/ipv4/icmp.c | 1418 +------------ net/ipv4/icmp_ipv4.c | 1448 +++++++++++++ net/ipv4/inet_connection_sock.c | 2 +- net/ipv4/inet_hashtables.c | 3 + net/ipv4/ip_output.c | 18 - net/ipv4/ip_tunnel_core.c | 11 + net/ipv4/netfilter.c | 3 + net/ipv4/netfilter/Kconfig | 2 +- net/ipv4/nexthop.c | 5 +- net/ipv4/ping.c | 210 +- net/ipv4/ping_ipv4.c | 228 +++ net/ipv4/proc.c | 45 +- net/ipv4/raw.c | 853 -------- net/ipv4/raw_diag.c | 3 +- net/ipv4/raw_ipv4.c | 884 ++++++++ net/ipv4/sysctl_net_ipv4.c | 413 ++-- net/ipv4/tcp.c | 1300 +++++++++++- net/ipv4/tcp_bpf.c | 3 +- net/ipv4/tcp_ipv4.c | 1307 +----------- net/ipv4/udp.c | 1817 +---------------- net/ipv4/udp_bpf.c | 5 +- net/ipv4/udp_ipv4.c | 1790 ++++++++++++++++ net/ipv4/udp_offload.c | 3 + net/ipv6/Kconfig | 17 +- net/ipv6/af_inet6.c | 5 + net/ipv6/datagram.c | 4 +- net/ipv6/netfilter/Kconfig | 2 +- net/ipv6/tcp_ipv6.c | 23 +- net/ipv6/udp.c | 11 +- net/l2tp/Kconfig | 2 +- net/mac80211/main.c | 10 +- net/mptcp/Kconfig | 2 +- net/netfilter/Kconfig | 2 +- net/netfilter/ipset/Kconfig | 2 +- net/netfilter/ipvs/Kconfig | 2 +- net/netlabel/Kconfig | 4 + net/netlabel/Makefile | 2 +- net/netlabel/netlabel_cipso_v4.h | 7 + net/netlabel/netlabel_kapi.c | 3 + net/rds/Kconfig | 1 + net/rxrpc/Kconfig | 2 +- net/sched/Kconfig | 2 +- net/sctp/Kconfig | 2 +- net/smc/Kconfig | 2 +- net/sunrpc/Kconfig | 2 +- net/tipc/Kconfig | 1 + net/xfrm/Kconfig | 10 +- 98 files changed, 6747 insertions(+), 6262 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
Signature · 1 line
2.55.0
PATCH v3 1/16 ipv4: introduce CONFIG_IPV4 to decouple the IPv4 stack
Historically, the IPv4 protocol has been linked to the core INET subsystem. Because shared infrastructure like the TCP/UDP engine, routing or INET hashtables live inside net/ipv4/, it has been impossible to compile a kernel with only IPv6 support.
This patch introduces the CONFIG_IPV4 Kconfig symbol, which is set to 'def_bool y' for now. This does not allow to completely disable the IPv4 stack yet but it lays the necessary build-system work for that goal.
In addition, multiple subsystems Kconfig symbols across networking features like tunnels, drivers and filesystems have been adjusted to depend on IPv4. Keep on mind that follow-up work is required to convert the Kconfig symbol to bool and remove the dependency on IPv4 where it makes sense.
---
Sashiko: Marking the Kconfig symbols to depend on IPV4 is intentional, plenty of features won't work without IPv4 for now. Follow-up patches are required to support IPv4=n for those symbols.
--- drivers/infiniband/Kconfig | 2 +- drivers/infiniband/sw/rxe/Kconfig | 2 +- drivers/net/Kconfig | 23 ++++++++++--------- 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/qlogic/Kconfig | 2 ++ drivers/net/ethernet/rocker/Kconfig | 1 + 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/cxgbi/cxgb3i/Kconfig | 2 +- drivers/scsi/cxgbi/cxgb4i/Kconfig | 2 +- drivers/target/iscsi/Kconfig | 2 +- drivers/target/iscsi/cxgbit/Kconfig | 2 +- fs/Kconfig | 1 + fs/afs/Kconfig | 2 +- fs/nfs/Kconfig | 2 +- fs/nfsd/Kconfig | 2 +- net/Kconfig | 12 ++++++---- net/batman-adv/Kconfig | 6 ++--- net/bridge/Kconfig | 2 +- net/bridge/netfilter/Kconfig | 3 ++- net/ipv4/Kconfig | 21 ++++++++++++++--- net/ipv4/Makefile | 21 ++++++++--------- net/ipv4/netfilter/Kconfig | 2 +- net/ipv6/Kconfig | 17 ++++++++++---- net/ipv6/netfilter/Kconfig | 2 +- net/l2tp/Kconfig | 2 +- net/mptcp/Kconfig | 2 +- net/netfilter/Kconfig | 2 +- net/netfilter/ipset/Kconfig | 2 +- net/netfilter/ipvs/Kconfig | 2 +- net/rds/Kconfig | 1 + net/rxrpc/Kconfig | 2 +- net/sched/Kconfig | 2 +- net/sctp/Kconfig | 2 +- net/smc/Kconfig | 2 +- net/sunrpc/Kconfig | 2 +- net/tipc/Kconfig | 1 + net/xfrm/Kconfig | 10 ++++++-- security/smack/Kconfig | 1 + 49 files changed, 118 insertions(+), 65 deletions(-)
drivers/infiniband/Kconfig +1 -1
@@ -3,7 +3,7 @@ menuconfig INFINIBAND tristate "InfiniBand support" depends on HAS_IOMEM && HAS_DMA depends on NET - depends on INET + depends on INET && IPV4 depends on !ALPHA select DMA_SHARED_BUFFER select IRQ_POLL
drivers/infiniband/sw/rxe/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config RDMA_RXE tristate "Software RDMA over Ethernet (RoCE) driver" - depends on INET && PCI && INFINIBAND && 64BIT + depends on INET && IPV4 && PCI && INFINIBAND && 64BIT depends on INFINIBAND_VIRT_DMA select NET_UDP_TUNNEL select CRC32
drivers/net/Kconfig +12 -11
@@ -40,7 +40,7 @@ if NET_CORE config BONDING tristate "Bonding driver support" - depends on INET + depends on INET && IPV4 depends on TLS || TLS_DEVICE=n help Say 'Y' or 'M' if you wish to be able to 'bond' multiple Ethernet
@@ -73,7 +73,7 @@ config DUMMY config WIREGUARD tristate "WireGuard secure network tunnel" - depends on NET && INET + depends on NET && INET && IPV4 select NET_UDP_TUNNEL select DST_CACHE select CRYPTO_LIB_CURVE25519
@@ -102,7 +102,7 @@ config WIREGUARD_DEBUG config OVPN tristate "OpenVPN data channel offload" - depends on NET && INET + depends on NET && INET && IPV4 select DST_CACHE select NET_UDP_TUNNEL select CRYPTO
@@ -198,7 +198,7 @@ config IPVLAN_L3S config IPVLAN tristate "IP-VLAN support" - depends on INET + depends on INET && IPV4 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)
@@ -229,7 +229,7 @@ config IPVTAP config VXLAN tristate "Virtual eXtensible Local Area Network (VXLAN)" - depends on INET + depends on INET && IPV4 select NET_UDP_TUNNEL select GRO_CELLS help
@@ -244,7 +244,7 @@ config VXLAN config GENEVE tristate "Generic Network Virtualization Encapsulation" - depends on INET + depends on INET && IPV4 select NET_UDP_TUNNEL select GRO_CELLS help
@@ -259,7 +259,7 @@ config GENEVE config BAREUDP tristate "Bare UDP Encapsulation" - depends on INET + depends on INET && IPV4 select NET_UDP_TUNNEL select GRO_CELLS help
@@ -271,7 +271,7 @@ config BAREUDP config GTP tristate "GPRS Tunneling Protocol datapath (GTP-U)" - depends on INET + depends on INET && IPV4 select NET_UDP_TUNNEL help This allows one to create gtp virtual interfaces that provide
@@ -288,7 +288,7 @@ config GTP config PFCP tristate "Packet Forwarding Control Protocol (PFCP)" - depends on INET + depends on INET && IPV4 select NET_UDP_TUNNEL help This allows one to create PFCP virtual interfaces that allows to
@@ -301,7 +301,7 @@ config PFCP config AMT tristate "Automatic Multicast Tunneling (AMT)" - depends on INET && IP_MULTICAST + depends on INET && IP_MULTICAST && IPV4 select NET_UDP_TUNNEL help This allows one to create AMT(Automatic Multicast Tunneling)
@@ -471,6 +471,7 @@ config NETKIT config NET_VRF tristate "Virtual Routing and Forwarding (Lite)" + depends on IPV4 depends on IP_MULTIPLE_TABLES depends on NET_L3_MASTER_DEV depends on IPV6_MULTIPLE_TABLES || IPV6=n
@@ -604,7 +605,7 @@ source "drivers/net/hyperv/Kconfig" config NETDEVSIM tristate "Simulated networking device" depends on DEBUG_FS - depends on INET + depends on INET && IPV4 depends on PSAMPLE || PSAMPLE=n depends on PTP_1588_CLOCK_MOCK || PTP_1588_CLOCK_MOCK=n select NET_DEVLINK
drivers/net/ethernet/chelsio/Kconfig +1 -1
@@ -48,7 +48,7 @@ config CHELSIO_T1_1G config CHELSIO_T3 tristate "Chelsio Communications T3 10Gb Ethernet support" - depends on PCI && INET + depends on PCI && INET && IPV4 select FW_LOADER select MDIO help
drivers/net/ethernet/intel/Kconfig +2 -0
@@ -195,6 +195,7 @@ config IXGBE_IPSEC bool "IPSec XFRM cryptography-offload acceleration" depends on IXGBE depends on XFRM_OFFLOAD + depends on IPV4 || !INET default y select XFRM_ALGO help
@@ -221,6 +222,7 @@ config IXGBEVF_IPSEC bool "IPSec XFRM cryptography-offload acceleration" depends on IXGBEVF depends on XFRM_OFFLOAD + depends on IPV4 || !INET default y select XFRM_ALGO help
drivers/net/ethernet/marvell/prestera/Kconfig +1 -0
@@ -7,6 +7,7 @@ config PRESTERA tristate "Marvell Prestera Switch ASICs support" depends on NET_SWITCHDEV && VLAN_8021Q depends on BRIDGE || BRIDGE=n + depends on IPV4 || !INET select NET_DEVLINK select PHYLINK help
drivers/net/ethernet/mellanox/mlx5/core/Kconfig +2 -1
@@ -12,6 +12,7 @@ config MLX5_CORE depends on PTP_1588_CLOCK_OPTIONAL depends on PCI_HYPERV_INTERFACE || !PCI_HYPERV_INTERFACE depends on HWMON || !HWMON + depends on IPV4 || !INET help Core driver for low level functionality of the ConnectX-4 and Connect-IB cards by Mellanox Technologies.
@@ -28,7 +29,7 @@ config MLX5_FPGA config MLX5_CORE_EN bool "Mellanox 5th generation network adapters (ConnectX series) Ethernet support" - depends on NETDEVICES && ETHERNET && INET && PCI && MLX5_CORE + depends on NETDEVICES && ETHERNET && INET && PCI && MLX5_CORE && IPV4 select PAGE_POOL select PAGE_POOL_STATS select DIMLIB
drivers/net/ethernet/mellanox/mlxsw/Kconfig +1 -0
@@ -53,6 +53,7 @@ config MLXSW_I2C config MLXSW_SPECTRUM tristate "Mellanox Technologies Spectrum family support" + depends on IPV4 || !INET depends on MLXSW_CORE && MLXSW_PCI && NET_SWITCHDEV && VLAN_8021Q depends on PSAMPLE || PSAMPLE=n depends on BRIDGE || BRIDGE=n
drivers/net/ethernet/qlogic/Kconfig +2 -0
@@ -29,6 +29,7 @@ config QLA3XXX config QLCNIC tristate "QLOGIC QLCNIC 1/10Gb Converged Ethernet NIC Support" depends on PCI + depends on IPV4 || !INET select FW_LOADER help This driver supports QLogic QLE8240 and QLE8242 Converged Ethernet
@@ -68,6 +69,7 @@ config QLCNIC_HWMON config NETXEN_NIC tristate "NetXen Multi port (1/10) Gigabit Ethernet NIC" + depends on IPV4 || !INET depends on PCI select FW_LOADER help
drivers/net/ethernet/rocker/Kconfig +1 -0
@@ -19,6 +19,7 @@ if NET_VENDOR_ROCKER config ROCKER tristate "Rocker switch driver (EXPERIMENTAL)" depends on PCI && NET_SWITCHDEV && BRIDGE + depends on IPV4 || !INET select CRC32 help This driver supports Rocker switch device.
drivers/net/ethernet/sfc/Kconfig +1 -0
@@ -18,6 +18,7 @@ if NET_VENDOR_SOLARFLARE config SFC tristate "Solarflare SFC9100/EF100-family support" + depends on IPV4 || !INET depends on PCI depends on PTP_1588_CLOCK_OPTIONAL select MDIO
drivers/net/ethernet/stmicro/stmmac/Kconfig +1 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config STMMAC_ETH tristate "STMicroelectronics Multi-Gigabit Ethernet driver" + depends on IPV4 || !INET depends on HAS_IOMEM && HAS_DMA depends on PTP_1588_CLOCK_OPTIONAL depends on ETHTOOL_NETLINK
drivers/net/ethernet/via/Kconfig +1 -0
@@ -45,6 +45,7 @@ config VIA_RHINE_MMIO config VIA_VELOCITY tristate "VIA Velocity support" + depends on IPV4 || !INET depends on (PCI || (OF_ADDRESS && OF_IRQ)) depends on HAS_DMA select CRC32
drivers/net/ppp/Kconfig +1 -0
@@ -160,6 +160,7 @@ config PPPOE_HASH_BITS config PPTP tristate "PPP over IPv4 (PPTP)" + depends on IPV4 || !INET depends on NET_IPGRE_DEMUX select PPPOX help
drivers/net/wireless/broadcom/brcm80211/brcmfmac/Kconfig +1 -0
@@ -1,6 +1,7 @@ config BRCMFMAC tristate "Broadcom FullMAC WLAN driver" depends on CFG80211 + depends on IPV4 || !INET select BRCMUTIL help This module adds support for wireless adapters based on Broadcom
drivers/net/wireless/intel/iwlwifi/Kconfig +1 -0
@@ -2,6 +2,7 @@ config IWLWIFI tristate "Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi) " depends on PCI && HAS_IOMEM && CFG80211 + depends on IPV4 || !INET depends on IWLMEI || !IWLMEI select FW_LOADER help
drivers/nvme/host/Kconfig +1 -1
@@ -82,7 +82,7 @@ config NVME_FC config NVME_TCP tristate "NVM Express over Fabrics TCP host driver" - depends on INET + depends on INET && IPV4 depends on BLOCK select CRC32 select NET_CRC32C
drivers/nvme/target/Kconfig +1 -1
@@ -86,7 +86,7 @@ config NVME_TARGET_FCLOOP config NVME_TARGET_TCP tristate "NVMe over Fabrics TCP target support" - depends on INET + depends on INET && IPV4 depends on NVME_TARGET help This enables the NVMe TCP target support, which allows exporting NVMe
drivers/scsi/cxgbi/cxgb3i/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config SCSI_CXGB3_ISCSI tristate "Chelsio T3 iSCSI support" - depends on PCI && INET + depends on PCI && INET && IPV4 select NETDEVICES select ETHERNET select NET_VENDOR_CHELSIO
drivers/scsi/cxgbi/cxgb4i/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config SCSI_CXGB4_ISCSI tristate "Chelsio T4 iSCSI support" - depends on PCI && INET + depends on PCI && INET && IPV4 depends on PTP_1588_CLOCK_OPTIONAL depends on THERMAL || !THERMAL depends on ETHERNET
drivers/target/iscsi/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config ISCSI_TARGET tristate "SCSI Target Mode Stack" - depends on INET + depends on INET && IPV4 select CRC32 select CRYPTO select CRYPTO_HASH
drivers/target/iscsi/cxgbit/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config ISCSI_TARGET_CXGB4 tristate "Chelsio iSCSI target offload driver" - depends on ISCSI_TARGET && CHELSIO_T4 && INET + depends on ISCSI_TARGET && CHELSIO_T4 && INET && IPV4 select CHELSIO_LIB help To compile this driver as module, choose M here: the module
fs/Kconfig +1 -0
@@ -358,6 +358,7 @@ config GRACE_PERIOD config LOCKD tristate + depends on IPV4 || !INET depends on FILE_LOCKING select CRC32 select GRACE_PERIOD
fs/afs/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config AFS_FS tristate "Andrew File System support (AFS)" - depends on INET + depends on INET && IPV4 select AF_RXRPC select DNS_RESOLVER select NETFS_SUPPORT
fs/nfs/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config NFS_FS tristate "NFS client support" - depends on INET && FILE_LOCKING && MULTIUSER + depends on INET && FILE_LOCKING && MULTIUSER && IPV4 select CRC32 select LOCKD select SUNRPC
fs/nfsd/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config NFSD tristate "NFS server support" - depends on INET + depends on INET && IPV4 depends on FILE_LOCKING depends on FSNOTIFY select CRC32
net/Kconfig +8 -4
@@ -135,9 +135,12 @@ config INET if INET source "net/ipv4/Kconfig" source "net/ipv6/Kconfig" -source "net/netlabel/Kconfig" source "net/mptcp/Kconfig" +if IPV4 +source "net/netlabel/Kconfig" +endif # if IPV4 + endif # if INET config NETWORK_SECMARK
@@ -232,6 +235,7 @@ config BRIDGE_NETFILTER depends on BRIDGE depends on NETFILTER && INET depends on NETFILTER_ADVANCED + depends on IPV4 select NETFILTER_FAMILY_BRIDGE select SKB_EXTENSIONS help
@@ -384,7 +388,7 @@ menu "Network testing" config NET_PKTGEN tristate "Packet Generator (USE WITH CAUTION)" - depends on INET && PROC_FS + depends on INET && IPV4 && PROC_FS help This module will inject preconfigured packets, at a configurable rate, out of a given interface. It is used for network interface
@@ -451,7 +455,7 @@ config LWTUNNEL config LWTUNNEL_BPF bool "Execute BPF program as route nexthop action" - depends on LWTUNNEL && INET + depends on LWTUNNEL && INET && IPV4 default y if LWTUNNEL=y help Allows to run BPF programs as a nexthop action following a route
@@ -473,7 +477,7 @@ config NET_IEEE8021Q_HELPERS config NET_SELFTESTS def_tristate PHYLIB - depends on PHYLIB && INET + depends on PHYLIB && INET && IPV4 config NET_SOCK_MSG bool
net/batman-adv/Kconfig +3 -3
@@ -33,7 +33,7 @@ config BATMAN_ADV_BATMAN_V config BATMAN_ADV_BLA bool "Bridge Loop Avoidance" - depends on BATMAN_ADV && INET + depends on BATMAN_ADV && INET && IPV4 select CRC16 select NET_CRC32C default y
@@ -46,7 +46,7 @@ config BATMAN_ADV_BLA config BATMAN_ADV_DAT bool "Distributed ARP Table" - depends on BATMAN_ADV && INET + depends on BATMAN_ADV && INET && IPV4 default y help This option enables DAT (Distributed ARP Table), a DHT based
@@ -56,7 +56,7 @@ config BATMAN_ADV_DAT config BATMAN_ADV_MCAST bool "Multicast optimisation" - depends on BATMAN_ADV && INET && !(BRIDGE=m && BATMAN_ADV=y) + depends on BATMAN_ADV && INET && !(BRIDGE=m && BATMAN_ADV=y) && IPV4 default y help This option enables the multicast optimisation which aims to
net/bridge/Kconfig +1 -1
@@ -36,7 +36,7 @@ config BRIDGE config BRIDGE_IGMP_SNOOPING bool "IGMP/MLD snooping" depends on BRIDGE - depends on INET + depends on INET && IPV4 default y help If you say Y here, then the Ethernet bridge will be able selectively
net/bridge/netfilter/Kconfig +2 -1
@@ -28,6 +28,7 @@ endif # NF_TABLES_BRIDGE config NF_CONNTRACK_BRIDGE tristate "IPv4/IPV6 bridge connection tracking support" depends on NF_CONNTRACK + depends on IPV4 || !INET default n help Connection tracking keeps a record of what packets have passed
@@ -188,7 +189,7 @@ config BRIDGE_EBT_VLAN # config BRIDGE_EBT_ARPREPLY tristate "ebt: arp reply target support" - depends on BRIDGE_NF_EBTABLES && INET + depends on BRIDGE_NF_EBTABLES && INET && IPV4 help This option adds the arp reply target, which allows automatically sending arp replies to arp requests.
net/ipv4/Kconfig +18 -3
@@ -2,6 +2,9 @@ # # IP configuration # +config IPV4 + def_bool y + config IP_MULTICAST bool "IP: multicasting" help
@@ -62,7 +65,7 @@ config IP_FIB_TRIE_STATS config IP_MULTIPLE_TABLES bool "IP: policy routing" - depends on IP_ADVANCED_ROUTER + depends on IPV4 && IP_ADVANCED_ROUTER select FIB_RULES help Normally, a router decides what to do with a received packet based
@@ -105,6 +108,7 @@ config IP_ROUTE_CLASSID config IP_PNP bool "IP: kernel level autoconfiguration" + depends on IPV4 help This enables automatic configuration of IP addresses of devices and of the routing table during kernel boot, based on either information
@@ -161,6 +165,7 @@ config IP_PNP_RARP config NET_IPIP tristate "IP: tunneling" + depends on IPV4 select INET_TUNNEL select NET_IP_TUNNEL help
@@ -185,12 +190,14 @@ config NET_IPGRE_DEMUX config NET_IP_TUNNEL tristate + depends on IPV4 select DST_CACHE select GRO_CELLS default n config NET_IPGRE tristate "IP: GRE tunnels over IP" + depends on IPV4 depends on NET_IPGRE_DEMUX select NET_IP_TUNNEL help
@@ -219,7 +226,7 @@ config IP_MROUTE_COMMON config IP_MROUTE bool "IP: multicast routing" - depends on IP_MULTICAST + depends on IP_MULTICAST && IPV4 select IP_MROUTE_COMMON help This is used if you want your machine to act as a router for IP
@@ -267,6 +274,7 @@ config IP_PIMSM_V2 config SYN_COOKIES bool "IP: TCP syncookie support" + depends on IPV4 help Normal TCP/IP networking is open to an attack known as "SYN flooding". This denial-of-service attack prevents legitimate remote
@@ -303,6 +311,7 @@ config SYN_COOKIES config NET_IPVTI tristate "Virtual (secure) IP: tunneling" + depends on IPV4 select INET_TUNNEL select NET_IP_TUNNEL select XFRM
@@ -315,11 +324,13 @@ config NET_IPVTI config NET_UDP_TUNNEL tristate + depends on IPV4 select NET_IP_TUNNEL default n config NET_FOU tristate "IP: Foo (IP protocols) over UDP" + depends on IPV4 select NET_UDP_TUNNEL help Foo over UDP allows any IP protocol to be directly encapsulated
@@ -338,6 +349,7 @@ config NET_FOU_IP_TUNNELS config INET_AH tristate "IP: AH transformation" + depends on IPV4 select XFRM_AH help Support for IPsec AH (Authentication Header).
@@ -353,6 +365,7 @@ config INET_AH config INET_ESP tristate "IP: ESP transformation" + depends on IPV4 select XFRM_ESP help Support for IPsec ESP (Encapsulating Security Payload).
@@ -393,6 +406,7 @@ config INET_ESPINTCP config INET_IPCOMP tristate "IP: IPComp transformation" + depends on IPV4 select INET_XFRM_TUNNEL select XFRM_IPCOMP help
@@ -747,7 +761,7 @@ config TCP_AO select CRYPTO_LIB_SHA1 select CRYPTO_LIB_SHA256 select CRYPTO_LIB_UTILS - depends on 64BIT # seq-number extension needs WRITE_ONCE(u64) + depends on IPV4 && 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
@@ -758,6 +772,7 @@ config TCP_AO config TCP_MD5SIG bool "TCP: MD5 Signature Option support (RFC2385)" + depends on IPV4 select CRYPTO_LIB_MD5 select CRYPTO_LIB_UTILS help
net/ipv4/Makefile +10 -11
@@ -3,18 +3,17 @@ # Makefile for the Linux TCP/IP (INET) layer. # -obj-y := route.o inetpeer.o protocol.o \ - ip_input.o ip_fragment.o ip_forward.o ip_options.o \ - ip_output.o ip_sockglue.o inet_hashtables.o \ - inet_timewait_sock.o inet_connection_sock.o \ - tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o \ +obj-y := inetpeer.o protocol.o inet_hashtables.o inet_timewait_sock.o \ + inet_connection_sock.o tcp.o tcp_input.o tcp_output.o tcp_timer.o \ tcp_minisocks.o tcp_cong.o tcp_metrics.o tcp_fastopen.o \ - tcp_recovery.o tcp_ulp.o \ - tcp_offload.o tcp_plb.o datagram.o raw.o udp.o \ - udp_offload.o arp.o icmp.o devinet.o af_inet.o igmp.o \ - fib_frontend.o fib_semantics.o fib_trie.o fib_notifier.o \ - inet_fragment.o ping.o ip_tunnel_core.o gre_offload.o \ - metrics.o netlink.o nexthop.o udp_tunnel_stub.o + tcp_recovery.o tcp_ulp.o tcp_offload.o tcp_plb.o raw.o udp.o \ + udp_offload.o af_inet.o inet_fragment.o ping.o ip_tunnel_core.o \ + gre_offload.o metrics.o netlink.o nexthop.o udp_tunnel_stub.o + +obj-$(CONFIG_IPV4) += route.o ip_input.o ip_fragment.o ip_forward.o ip_options.o \ + ip_sockglue.o tcp_ipv4.o datagram.o icmp.o arp.o devinet.o \ + igmp.o fib_notifier.o ip_output.o fib_frontend.o \ + fib_semantics.o fib_trie.o obj-$(CONFIG_NET_IP_TUNNEL) += ip_tunnel.o obj-$(CONFIG_SYSCTL) += sysctl_net_ipv4.o
net/ipv4/netfilter/Kconfig +1 -1
@@ -4,7 +4,7 @@ # menu "IP: Netfilter Configuration" - depends on INET && NETFILTER + depends on INET && NETFILTER && IPV4 config NF_DEFRAG_IPV4 tristate
net/ipv6/Kconfig +13 -4
@@ -47,6 +47,7 @@ config IPV6_OPTIMISTIC_DAD config INET6_AH tristate "IPv6: AH transformation" select XFRM_AH + depends on IPV4 help Support for IPsec AH (Authentication Header).
@@ -61,6 +62,7 @@ config INET6_AH config INET6_ESP tristate "IPv6: ESP transformation" + depends on IPV4 select XFRM_ESP help Support for IPsec ESP (Encapsulating Security Payload).
@@ -101,6 +103,7 @@ config INET6_ESPINTCP config INET6_IPCOMP tristate "IPv6: IPComp transformation" + depends on IPV4 select INET6_XFRM_TUNNEL select XFRM_IPCOMP help
@@ -111,6 +114,7 @@ config INET6_IPCOMP config IPV6_MIP6 tristate "IPv6: Mobility" + depends on IPV4 select XFRM help Support for IPv6 Mobility described in RFC 3775.
@@ -119,6 +123,7 @@ config IPV6_MIP6 config IPV6_ILA tristate "IPv6: Identifier Locator Addressing (ILA)" + depends on IPV4 depends on NETFILTER select DST_CACHE select LWTUNNEL
@@ -149,6 +154,7 @@ config INET6_TUNNEL config IPV6_VTI tristate "Virtual (secure) IPv6: tunneling" + depends on IPV4 select IPV6_TUNNEL select NET_IP_TUNNEL select XFRM
@@ -161,6 +167,7 @@ config IPV6_VTI config IPV6_SIT tristate "IPv6: IPv6-in-IPv4 tunnel (SIT driver)" + depends on IPV4 select INET_TUNNEL select NET_IP_TUNNEL select IPV6_NDISC_NODETYPE
@@ -198,6 +205,7 @@ config IPV6_NDISC_NODETYPE config IPV6_TUNNEL tristate "IPv6: IP-in-IPv6 tunnel (RFC2473)" + depends on IPV4 select INET6_TUNNEL select DST_CACHE select GRO_CELLS
@@ -209,6 +217,7 @@ config IPV6_TUNNEL config IPV6_GRE tristate "IPv6: GRE tunnel" + depends on IPV4 select IPV6_TUNNEL select NET_IP_TUNNEL depends on NET_IPGRE_DEMUX
@@ -256,7 +265,7 @@ config IPV6_SUBTREES config IPV6_MROUTE bool "IPv6: multicast routing" - depends on IPV6 + depends on IPV4 && IPV6 select IP_MROUTE_COMMON help Support for IPv6 multicast forwarding.
@@ -285,7 +294,7 @@ config IPV6_PIMSM_V2 config IPV6_SEG6_LWTUNNEL bool "IPv6: Segment Routing Header encapsulation support" - depends on IPV6 + depends on IPV4 && IPV6 select LWTUNNEL select DST_CACHE select IPV6_MULTIPLE_TABLES
@@ -316,7 +325,7 @@ config IPV6_SEG6_BPF config IPV6_RPL_LWTUNNEL bool "IPv6: RPL Source Routing Header support" - depends on IPV6 + depends on IPV4 && IPV6 select LWTUNNEL select DST_CACHE help
@@ -327,7 +336,7 @@ config IPV6_RPL_LWTUNNEL config IPV6_IOAM6_LWTUNNEL bool "IPv6: IOAM Pre-allocated Trace insertion support" - depends on IPV6 + depends on IPV4 && IPV6 select LWTUNNEL select DST_CACHE help
net/ipv6/netfilter/Kconfig +1 -1
@@ -4,7 +4,7 @@ # menu "IPv6: Netfilter Configuration" - depends on INET && IPV6 && NETFILTER + depends on INET && IPV6 && NETFILTER && IPV4 # old sockopt interface and eval loop config IP6_NF_IPTABLES_LEGACY
net/l2tp/Kconfig +1 -1
@@ -5,7 +5,7 @@ menuconfig L2TP tristate "Layer Two Tunneling Protocol (L2TP)" - depends on INET + depends on INET && IPV4 select NET_UDP_TUNNEL help Layer Two Tunneling Protocol
net/mptcp/Kconfig +1 -1
@@ -1,7 +1,7 @@ config MPTCP bool "MPTCP: Multipath TCP" - depends on INET + depends on INET && IPV4 select SKB_EXTENSIONS select CRYPTO_LIB_SHA256 select CRYPTO_LIB_UTILS
net/netfilter/Kconfig +1 -1
@@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only menu "Core Netfilter Configuration" - depends on INET && NETFILTER + depends on INET && IPV4 && NETFILTER config NETFILTER_INGRESS bool "Netfilter ingress support"
net/netfilter/ipset/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only menuconfig IP_SET tristate "IP set support" - depends on INET && NETFILTER + depends on INET && IPV4 && NETFILTER select NETFILTER_NETLINK help This option adds IP set support to the kernel.
net/netfilter/ipvs/Kconfig +1 -1
@@ -4,7 +4,7 @@ # menuconfig IP_VS tristate "IP virtual server support" - depends on INET && NETFILTER + depends on INET && NETFILTER && IPV4 depends on (NF_CONNTRACK || NF_CONNTRACK=n) help IP Virtual Server support will let you build a high-performance
net/rds/Kconfig +1 -0
@@ -17,6 +17,7 @@ config RDS_RDMA config RDS_TCP tristate "RDS over TCP" depends on RDS + depends on IPV4 depends on IPV6 || !IPV6 help Allow RDS to use TCP as a transport.
net/rxrpc/Kconfig +1 -1
@@ -5,7 +5,7 @@ config AF_RXRPC tristate "RxRPC session sockets" - depends on INET + depends on INET && IPV4 select CRYPTO select CRYPTO_LIB_DES if RXKAD select KEYS
net/sched/Kconfig +1 -1
@@ -807,7 +807,7 @@ config NET_ACT_SKBEDIT config NET_ACT_CSUM tristate "Checksum Updating" - depends on NET_CLS_ACT && INET + depends on NET_CLS_ACT && INET && IPV4 select NET_CRC32C help Say Y here to update some common checksum after some direct
net/sctp/Kconfig +1 -1
@@ -5,7 +5,7 @@ menuconfig IP_SCTP tristate "The SCTP Protocol" - depends on INET + depends on INET && IPV4 select CRYPTO_LIB_SHA1 select CRYPTO_LIB_SHA256 select CRYPTO_LIB_UTILS
net/smc/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config SMC tristate "SMC socket protocol family" - depends on INET && INFINIBAND && DIBS + depends on INET && IPV4 && INFINIBAND && DIBS help SMC-R provides a "sockets over RDMA" solution making use of RDMA over Converged Ethernet (RoCE) technology to upgrade
net/sunrpc/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config SUNRPC tristate - depends on MULTIUSER + depends on MULTIUSER && IPV4 config SUNRPC_GSS tristate
net/tipc/Kconfig +1 -0
@@ -30,6 +30,7 @@ config TIPC_MEDIA_IB config TIPC_MEDIA_UDP bool "IP/UDP media type support" depends on TIPC + depends on IPV4 select NET_UDP_TUNNEL default y help
net/xfrm/Kconfig +8 -2
@@ -4,7 +4,7 @@ # config XFRM bool - depends on INET + depends on INET && IPV4 select GRO_CELLS select SKB_EXTENSIONS
@@ -13,6 +13,7 @@ config XFRM_OFFLOAD config XFRM_ALGO tristate + depends on IPV4 select XFRM select CRYPTO select CRYPTO_AEAD
@@ -23,6 +24,7 @@ if INET config XFRM_USER tristate "Transformation user configuration interface" select XFRM_ALGO + depends on IPV4 help Support for Transformation(XFRM) user configuration interface like IPsec used by native Linux tools.
@@ -42,7 +44,7 @@ config XFRM_USER_COMPAT config XFRM_INTERFACE tristate "Transformation virtual interface" - depends on XFRM && IPV6 + depends on XFRM && IPV4 && IPV6 help This provides a virtual interface to route IPsec traffic.
@@ -83,6 +85,7 @@ config XFRM_STATISTICS # RFC 8221 lists as MUST be implemented. config XFRM_AH tristate + depends on IPV4 select XFRM_ALGO select CRYPTO select CRYPTO_HMAC
@@ -92,6 +95,7 @@ config XFRM_AH # algorithms that RFC 8221 lists as MUST be implemented. config XFRM_ESP tristate + depends on IPV4 select XFRM_ALGO select CRYPTO select CRYPTO_AES
@@ -105,12 +109,14 @@ config XFRM_ESP config XFRM_IPCOMP tristate + depends on IPV4 select XFRM_ALGO select CRYPTO select CRYPTO_DEFLATE config NET_KEY tristate "PF_KEY sockets (deprecated)" + depends on IPV4 select XFRM_ALGO help PF_KEYv2 socket family, compatible to KAME ones.
security/smack/Kconfig +1 -0
@@ -3,6 +3,7 @@ config SECURITY_SMACK bool "Simplified Mandatory Access Control Kernel Support" depends on NET depends on INET + depends on IPV4 depends on SECURITY select NETLABEL select SECURITY_NETWORK
Signature · 1 line
2.55.0
PATCH v3 4/16 tcp: move protocol agnostic TCP functions out of tcp_ipv4.c
In reply to Fernando Fernandez ManceraAs the tcp_ipv4.c file isn't compile anymore with CONFIG_IPV4=n, the generic TCP function must be moved out of tcp_ipv4.c file and they should be placed in tcp.c file.
As part of this migration, rename tcp_v4_destroy_sock() to tcp_destroy_sock() to reflect its shared usage by IPv4 and IPv6.
In addition, guard IPv4 code around IPv6 TCP implementation. This ensures that IPv4-mapped IPv6 sockects are rejected with a proper error code when IPv4 stack is disabled.
Please note that this commit also addresses how /proc/net/sockstat output is handled for all protocols. The implementation now force the inuse attrtibute to be zero when CONFIG_IPV4=n but the shared stats are represented correctly.
--- include/net/tcp.h | 16 +- net/ipv4/inet_connection_sock.c | 2 +- net/ipv4/proc.c | 45 +- net/ipv4/tcp.c | 1300 +++++++++++++++++++++++++++++- net/ipv4/tcp_bpf.c | 3 +- net/ipv4/tcp_ipv4.c | 1307 +------------------------------ net/ipv6/tcp_ipv6.c | 23 +- 7 files changed, 1363 insertions(+), 1333 deletions(-)
include/net/tcp.h +15 -1
@@ -2437,7 +2437,7 @@ struct tcp_iter_state {extern struct request_sock_ops tcp_request_sock_ops;extern struct request_sock_ops tcp6_request_sock_ops; -void tcp_v4_destroy_sock (struct sock *sk); +void tcp_destroy_sock (struct sock *sk);struct sk_buff *tcp_gso_segment (struct sk_buff *skb,netdev_features_t features);
@@ -2855,6 +2855,20 @@ struct sk_psock;#ifdef CONFIG_BPF_SYSCALL int tcp_bpf_update_proto (struct sock *sk,struct sk_psock *psock,bool restore);void tcp_bpf_clone (const struct sock *sk,struct sock *newsk); + +union bpf_tcp_iter_batch_item { +struct sock *sk; +__u64 cookie; +}; + +struct bpf_tcp_iter_state { +struct tcp_iter_state state; +unsigned int cur_sk; +unsigned int end_sk; +unsigned int max_sk; +union bpf_tcp_iter_batch_item *batch; +}; +#ifdef CONFIG_BPF_STREAM_PARSER struct strparser ; int tcp_bpf_strp_read_sock(struct strparser *strp, read_descriptor_t *desc,
net/ipv4/inet_connection_sock.c +1 -1
@@ -1384,7 +1384,7 @@ static void inet_child_forget(struct sock *sk, struct request_sock *req,* an inbound pkt destined for child is * blocked by sock lock in tcp_v4_rcv(). * Also to satisfy an assertion in -* tcp_v4_destroy_sock(). +* tcp_destroy_sock(). */ RCU_INIT_POINTER (tcp_sk (child)->fastopen_rsk,NULL ); }
net/ipv4/proc.c +28 -17
85 lines not on this page · raw message
net/ipv4/tcp.c +1299 -1
1,330 lines not on this page · raw message
net/ipv4/tcp_bpf.c +2 -1
@@ -671,7 +671,8 @@ static void tcp_bpf_check_v6_needs_rebuild(struct proto *ops)static int __init tcp_bpf_v4_build_proto (void ) { -tcp_bpf_rebuild_protos (tcp_bpf_prots[TCP_BPF_IPV4 ], &tcp_prot); +if (IS_ENABLED (CONFIG_IPV4 )) +tcp_bpf_rebuild_protos (tcp_bpf_prots[TCP_BPF_IPV4 ], &tcp_prot);return 0 ; }late_initcall (tcp_bpf_v4_build_proto);
net/ipv4/tcp_ipv4.c +1 -1306
1,372 lines not on this page · raw message
net/ipv6/tcp_ipv6.c +17 -6
@@ -220,7 +220,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr_unsized *uaddr,u32 exthdrlen = icsk->icsk_ext_hdr_len;struct sockaddr_in sin; -if (ipv6_only_sock (sk)) +if (!IS_ENABLED (CONFIG_IPV4 ) ||ipv6_only_sock (sk))return -ENETUNREACH ; sin.sin_family =AF_INET ;
@@ -1315,8 +1315,11 @@ u16 tcp_v6_get_syncookie(struct sock *sk, struct ipv6hdr *iph,static int tcp_v6_conn_request (struct sock *sk,struct sk_buff *skb) { -if (skb->protocol ==htons (ETH_P_IP )) +if (skb->protocol ==htons (ETH_P_IP )) { +if (!IS_ENABLED (CONFIG_IPV4 )) + goto drop;return tcp_v4_conn_request (sk, skb); + }if (!ipv6_unicast_destination (skb)) goto drop;
@@ -1401,10 +1404,14 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *#endif struct flowi6 fl6; -if (skb->protocol ==htons (ETH_P_IP )) +if (skb->protocol ==htons (ETH_P_IP )) { +if (!IS_ENABLED (CONFIG_IPV4 )) +return NULL ;return tcp_v4_syn_recv_sock (sk, skb, req, dst, req_unhash, own_req, tcp_v6_mapped_child_init); + } + ireq =inet_rsk (req);if (sk_acceptq_is_full (sk))
@@ -1579,8 +1586,12 @@ int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)tcp_v6_hnd_req and tcp_v6_send_reset(). --ANK */ -if (skb->protocol ==htons (ETH_P_IP )) -return tcp_v4_do_rcv (sk, skb); +if (skb->protocol ==htons (ETH_P_IP )) { +if (IS_ENABLED (CONFIG_IPV4 )) +return tcp_v4_do_rcv (sk, skb); +kfree_skb (skb); +return 0 ; + } reason =psp_sk_rx_policy_check (sk, skb);if (reason)
@@ -2284,7 +2295,7 @@ struct proto tcpv6_prot = { .accept = inet_csk_accept, .ioctl = tcp_ioctl, .init = tcp_v6_init_sock, - .destroy = tcp_v4_destroy_sock, + .destroy = tcp_destroy_sock, .shutdown = tcp_shutdown, .setsockopt = tcp_setsockopt, .getsockopt = tcp_getsockopt,
Signature · 1 line
2.55.0
PATCH v3 2/16 net: core: add IPv4 fallback stubs and guards for CONFIG_IPV4=n
In reply to Fernando Fernandez ManceraTo enable compiling the core network stack without IPv4, generic networking code must avoid referencing missing IPv4 symbols.
This patch provides static inline stubs in include/net/ip.h and include/net/route.h that return a proper error code when IPv4 is disabled. This behaves as IPv6 code does. In addition, it introduces guards around IPv4 specific code in generic implementations to prevent undefined reference errors while linking.
--- include/linux/indirect_call_wrapper.h | 8 +- include/net/ip.h | 111 ++++++++++++++++++++++---- include/net/route.h | 8 ++ net/core/dev_ioctl.c | 3 + net/core/filter.c | 20 ++--- net/core/neighbour.c | 4 + net/ipv4/inet_hashtables.c | 3 + 7 files changed, 127 insertions(+), 30 deletions(-)
include/linux/indirect_call_wrapper.h +5 -3
@@ -57,16 +57,18 @@* builtin, this macro simplify dealing with indirect calls with only ipv4/ipv6 * alternatives */ -#if IS_ENABLED (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV4 ) &&IS_ENABLED (CONFIG_IPV6 )#define INDIRECT_CALL_INET (f, f2, f1, ...) \ INDIRECT_CALL_2(f, f2, f1, __VA_ARGS__) -#elif IS_ENABLED (CONFIG_INET ) +#elif IS_ENABLED (CONFIG_IPV4 )#define INDIRECT_CALL_INET (f, f2, f1, ...) INDIRECT_CALL_1(f, f1, __VA_ARGS__) +#elif IS_ENABLED (CONFIG_IPV6 ) +#define INDIRECT_CALL_INET (f, f2, f1, ...) INDIRECT_CALL_1(f, f2, __VA_ARGS__)#else #define INDIRECT_CALL_INET (f, f2, f1, ...) f(__VA_ARGS__)#endif -#if IS_ENABLED (CONFIG_INET ) +#if IS_ENABLED (CONFIG_IPV4 )#define INDIRECT_CALL_INET_1 (f, f1, ...) INDIRECT_CALL_1(f, f1, __VA_ARGS__)#else #define INDIRECT_CALL_INET_1 (f, f1, ...) f(__VA_ARGS__)
include/net/ip.h +94 -17
166 lines not on this page · raw message
include/net/route.h +8 -0
@@ -169,8 +169,16 @@ static inline struct rtable *__ip_route_output_key(struct net *net,return ip_route_output_key_hash (net, flp,NULL ); } +#if IS_ENABLED (CONFIG_IPV4 )struct rtable *ip_route_output_flow (struct net *,struct flowi4 *flp,const struct sock *sk); +#else +static inline struct rtable *ip_route_output_flow (struct net *,struct flowi4 *flp, +const struct sock *sk) +{ +return ERR_PTR (-EAFNOSUPPORT ); +} +#endif struct dst_entry *ipv4_blackhole_route (struct net *net,struct dst_entry *dst_orig);
net/core/dev_ioctl.c +3 -0
@@ -44,6 +44,9 @@ int dev_ifconf(struct net *net, struct ifconf __user *uifc)size_t size;int len, total =0 , done; +if (!IS_ENABLED (CONFIG_IPV4 )) +return -EAFNOSUPPORT ; +/* both the ifconf and the ifreq structures are slightly different */ if (in_compat_syscall ()) {struct compat_ifconf ifc32;
net/core/filter.c +10 -10
@@ -2318,7 +2318,7 @@ static int __bpf_redirect_neigh_v6(struct sk_buff *skb, struct net_device *dev, }#endif /* CONFIG_IPV6 */ -#if IS_ENABLED (CONFIG_INET ) +#if IS_ENABLED (CONFIG_IPV4 )static int bpf_out_neigh_v4 (struct net *net,struct sk_buff *skb,struct net_device *dev,struct bpf_nh_params *nh) {
@@ -2427,7 +2427,7 @@ static int __bpf_redirect_neigh_v4(struct sk_buff *skb, struct net_device *dev,kfree_skb (skb); return NET_XMIT_DROP; } -#endif /* CONFIG_INET */ +#endif /* CONFIG_IPV4 */ static int __bpf_redirect_neigh (struct sk_buff *skb,struct net_device *dev,struct bpf_nh_params *nh)
@@ -5781,7 +5781,7 @@ static int __bpf_setsockopt(struct sock *sk, int level, int optname,if (level ==SOL_SOCKET )return sol_socket_sockopt (sk, optname, optval, &optlen, false); -else if (IS_ENABLED (CONFIG_INET ) && level ==SOL_IP ) +else if (IS_ENABLED (CONFIG_IPV4 ) && level ==SOL_IP )return sol_ip_sockopt (sk, optname, optval, &optlen, false);else if (IS_ENABLED (CONFIG_IPV6 ) && level ==SOL_IPV6 )return sol_ipv6_sockopt (sk, optname, optval, &optlen, false);
@@ -5818,7 +5818,7 @@ static int __bpf_getsockopt(struct sock *sk, int level, int optname, err =sol_socket_sockopt (sk, optname, optval, &optlen, true); else if (IS_ENABLED(CONFIG_INET) && level == SOL_TCP) err =sol_tcp_sockopt (sk, optname, optval, &optlen, true); - else if (IS_ENABLED(CONFIG_INET) && level == SOL_IP) + else if (IS_ENABLED(CONFIG_IPV4) && level == SOL_IP) err =sol_ip_sockopt (sk, optname, optval, &optlen, true); else if (IS_ENABLED(CONFIG_IPV6) && level == SOL_IPV6) err =sol_ipv6_sockopt (sk, optname, optval, &optlen, true);
@@ -6346,7 +6346,7 @@ static struct net_device *bpf_fib_vlan_input_dev(struct net_device *dev, }#endif -#if IS_ENABLED (CONFIG_INET ) +#if IS_ENABLED (CONFIG_IPV4 )static int bpf_ipv4_fib_lookup (struct net *net,struct bpf_fib_lookup *params,u32 flags,bool check_mtu) {
@@ -6678,7 +6678,7 @@ BPF_CALL_4(bpf_xdp_fib_lookup, struct xdp_buff *, ctx,return -EINVAL ;switch (params->family) { -#if IS_ENABLED (CONFIG_INET ) +#if IS_ENABLED (CONFIG_IPV4 )case AF_INET :return bpf_ipv4_fib_lookup (dev_net (ctx->rxq->dev), params, flags, true);
@@ -6722,7 +6722,7 @@ BPF_CALL_4(bpf_skb_fib_lookup, struct sk_buff *, skb, check_mtu = true;switch (params->family) { -#if IS_ENABLED (CONFIG_INET ) +#if IS_ENABLED (CONFIG_IPV4 )case AF_INET : rc =bpf_ipv4_fib_lookup (net, params, flags, check_mtu);break ;
@@ -12231,7 +12231,7 @@ BPF_CALL_1(bpf_skc_to_tcp_timewait_sock, struct sock *, sk)BTF_TYPE_EMIT (struct inet_timewait_sock );BTF_TYPE_EMIT (struct tcp_timewait_sock ); -#ifdef CONFIG_INET +#ifdef CONFIG_IPV4 if (sk && sk->sk_prot == &tcp_prot && sk->sk_state ==TCP_TIME_WAIT )return (unsigned long )sk;#endif
@@ -12254,7 +12254,7 @@ const struct bpf_func_proto bpf_skc_to_tcp_timewait_sock_proto = { BPF_CALL_1(bpf_skc_to_tcp_request_sock, struct sock *, sk) { -#ifdef CONFIG_INET +#ifdef CONFIG_IPV4 if (sk && sk->sk_prot == &tcp_prot && sk->sk_state ==TCP_NEW_SYN_RECV )return (unsigned long )sk;#endif
@@ -12736,7 +12736,7 @@ __bpf_kfunc int bpf_icmp_send(struct __sk_buff *skb_ctx, int type, int code)return -ENETUNREACH ;switch (skb->protocol) { -#if IS_ENABLED (CONFIG_INET ) +#if IS_ENABLED (CONFIG_IPV4 )case htons (ETH_P_IP ): {struct sk_buff *nskb;
net/core/neighbour.c +4 -0
@@ -3241,6 +3241,10 @@ int neigh_xmit(int index, struct net_device *dev,if (index ==NEIGH_ARP_TABLE ) {u32 key = *((u32 *)addr); +if (!IS_ENABLED (CONFIG_IPV4 )) { +rcu_read_unlock (); + goto out_kfree_skb; + } neigh =__ipv4_neigh_lookup_noref (dev, key); }else { neigh =__neigh_lookup_noref (tbl, addr, dev);
net/ipv4/inet_hashtables.c +3 -0
@@ -596,6 +596,9 @@ static int __inet_check_established(struct inet_timewait_death_row *death_row,struct sock *sk2;spinlock_t *lock; +if (!IS_ENABLED (CONFIG_IPV4 )) +return -EAFNOSUPPORT ; +if (rcu_lookup) {sk_nulls_for_each (sk2, node, &head->chain) { if (sk2->sk_hash != hash ||
Signature · 1 line
2.55.0
PATCH v3 3/16 net: inet: relocate ip_generic_getfrag and guard IPv4 socket logic
In reply to Fernando Fernandez ManceraTo enable compiling the INET subsystem without IPv4, shared generic utilities must be relocated and IPv4 socket logic must be guarded for CONFIG_IPV4.
This patch moves the generic ip_generec_getfrag() from ip_output.c to af_inet.c. It also introduces CONFIG_IPV4 guards around af_inet.c to reject IPv4-specific ioctls, protocol registrations and bind requests. The same guard is added to reject IPv4-mapped IPv6.
--- net/ipv4/af_inet.c | 122 ++++++++++++++++++++++++++++++++----------- net/ipv4/ip_output.c | 18 ------- net/ipv6/af_inet6.c | 5 ++ net/ipv6/datagram.c | 4 +- 4 files changed, 99 insertions(+), 50 deletions(-)
net/ipv4/af_inet.c +92 -30
@@ -129,6 +129,28 @@int disable_ipv6_mod;EXPORT_SYMBOL (disable_ipv6_mod); +/* Keep the function here for now as it is generic, it should be moved +* to a common L3 place +*/ +int +ip_generic_getfrag (void *from,char *to,int offset,int len,int odd,struct sk_buff *skb) +{ +struct msghdr *msg = from; + +if (skb->ip_summed ==CHECKSUM_PARTIAL ) { +if (!copy_from_iter_full (to, len, &msg->msg_iter)) +return -EFAULT ; + }else { +__wsum csum =0 ; + +if (!csum_and_copy_from_iter_full (to, len, &csum, &msg->msg_iter)) +return -EFAULT ; + skb->csum =csum_block_add (skb->csum, csum, odd); + } +return 0 ; +} +EXPORT_SYMBOL (ip_generic_getfrag); +/* The inetsw table contains everything that inet_create needs to * build a new socket. */
@@ -426,7 +448,8 @@ int inet_release(struct socket *sock)BPF_CGROUP_RUN_PROG_INET_SOCK_RELEASE (sk);/* Applications forget to leave groups before exiting */ -ip_mc_drop_socket (sk); +if (IS_ENABLED (CONFIG_IPV4 )) +ip_mc_drop_socket (sk);/* If linger is set, we don't return until the close * is complete. Otherwise we return immediately. The
@@ -486,6 +509,9 @@ int __inet_bind(struct sock *sk, struct sockaddr_unsized *uaddr, int addr_len,u32 tb_id =RT_TABLE_LOCAL ;int err; +if (!IS_ENABLED (CONFIG_IPV4 )) +return -EAFNOSUPPORT ; +if (addr->sin_family !=AF_INET ) {/* Compatibility games : accept AF_UNSPEC (mapped to AF_INET) * only if s_addr is INADDR_ANY.
@@ -968,6 +994,9 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)struct ifreq ifr;struct rtentry rt; +if (!IS_ENABLED (CONFIG_IPV4 )) +return -EOPNOTSUPP ; +switch (cmd) {case SIOCADDRT :case SIOCDELRT :
@@ -1023,6 +1052,9 @@ static int inet_compat_routing_ioctl(struct sock *sk, unsigned int cmd,compat_uptr_t rtdev;struct rtentry rt; +if (!IS_ENABLED (CONFIG_IPV4 )) +return -EOPNOTSUPP ; + if (copy_from_user(&rt.rt_dst, &ur->rt_dst, 3 * sizeof(struct sockaddr)) || get_user(rt.rt_flags, &ur->rt_flags) ||
@@ -1201,6 +1233,9 @@ void inet_register_protosw(struct inet_protosw *p)int protocol = p->protocol;struct list_head *last_perm; +if (!IS_ENABLED (CONFIG_IPV4 )) +return ; +spin_lock_bh (&inetsw_lock);if (p->type >=SOCK_MAX )
@@ -1243,6 +1278,9 @@ EXPORT_SYMBOL(inet_register_protosw);void inet_unregister_protosw (struct inet_protosw *p) { +if (!IS_ENABLED (CONFIG_IPV4 )) +return ; +if (INET_PROTOSW_PERMANENT & p->flags) {pr_err ("Attempt to unregister permanent protocol %d\n" , p->protocol);
@@ -1267,6 +1305,9 @@ static int inet_sk_reselect_saddr(struct sock *sk)struct ip_options_rcu *inet_opt;int err; +if (!IS_ENABLED (CONFIG_IPV4 )) +return -EAFNOSUPPORT ; + inet_opt =rcu_dereference_protected (inet->inet_opt,lockdep_sock_is_held (sk));if (inet_opt && inet_opt->opt.srr)
@@ -1371,6 +1412,9 @@ struct sk_buff *inet_gso_segment(struct sk_buff *skb,int ihl;int id; +if (!IS_ENABLED (CONFIG_IPV4 )) +return ERR_PTR (-EPROTONOSUPPORT ); +skb_reset_network_header (skb); nhoff =skb_network_header (skb) -skb_mac_header (skb);if (unlikely (!pskb_may_pull (skb,sizeof (*iph))))
@@ -1876,14 +1920,12 @@ static struct packet_type ip_packet_type __read_mostly = { .list_func = ip_list_rcv, }; -static int __init inet_init (void ) +static int __init inet4_init (void ) {struct inet_protosw *q;struct list_head *r;int rc; -sock_skb_cb_check_size (sizeof (struct inet_skb_parm )); -raw_hashinfo_init (&raw_v4_hashinfo); rc =proto_register (&tcp_prot,1 );
@@ -1959,6 +2001,45 @@ static int __init inet_init(void)ip_init (); +return 0 ; +out_unregister_raw_proto: +proto_unregister (&raw_prot); +out_unregister_udp_proto: +proto_unregister (&udp_prot); +out_unregister_tcp_proto: +proto_unregister (&tcp_prot); +out: +return rc; +} + +static void __init inet4_late_init (void ) +{ +/* +* Initialise the multicast router +*/ +#if defined(CONFIG_IP_MROUTE ) +if (ip_mr_init ()) +pr_crit ("%s: Cannot init ipv4 mroute\n" , __func__); +#endif +ipv4_proc_init (); + +ipfrag_init (); + +dev_add_pack (&ip_packet_type); +} + +static int __init inet_init (void ) +{ +int rc; + +sock_skb_cb_check_size (sizeof (struct inet_skb_parm )); + +if (IS_ENABLED (CONFIG_IPV4 )) { + rc =inet4_init (); +if (rc) +return rc; + } +/* Initialise per-cpu ipv4 mibs */ if (init_ipv4_mibs ())panic ("%s: Cannot init ipv4 mibs\n" , __func__);
@@ -1980,35 +2061,20 @@ static int __init inet_init(void)if (icmp_init () <0 )panic ("Failed to create the ICMP control socket.\n" ); -/* -* Initialise the multicast router -*/ -#if defined(CONFIG_IP_MROUTE ) -if (ip_mr_init ()) -pr_crit ("%s: Cannot init ipv4 mroute\n" , __func__); -#endif -if (init_inet_pernet_ops ())pr_crit ("%s: Cannot init ipv4 inet pernet ops\n" , __func__); -ipv4_proc_init (); - -ipfrag_init (); +#ifdef CONFIG_PROC_FS +if (ip_misc_proc_init ()) +pr_crit ("%s: Cannot init ipv4 misc proc\n" , __func__); +#endif -dev_add_pack (&ip_packet_type); +if (IS_ENABLED (CONFIG_IPV4 )) +inet4_late_init ();ip_tunnel_core_init (); - rc =0 ; -out: -return rc; -out_unregister_raw_proto: -proto_unregister (&raw_prot); -out_unregister_udp_proto: -proto_unregister (&udp_prot); -out_unregister_tcp_proto: -proto_unregister (&tcp_prot); - goto out; +return 0 ; }fs_initcall (inet_init);
@@ -2028,12 +2094,8 @@ static int __init ipv4_proc_init(void) goto out_udp;if (ping_proc_init ()) goto out_ping; -if (ip_misc_proc_init ()) - goto out_misc; out:return rc; -out_misc: -ping_proc_exit (); out_ping:udp4_proc_exit (); out_udp:
net/ipv4/ip_output.c +0 -18
@@ -932,24 +932,6 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, }EXPORT_SYMBOL (ip_do_fragment); -int -ip_generic_getfrag (void *from,char *to,int offset,int len,int odd,struct sk_buff *skb) -{ -struct msghdr *msg = from; - -if (skb->ip_summed ==CHECKSUM_PARTIAL ) { -if (!copy_from_iter_full (to, len, &msg->msg_iter)) -return -EFAULT ; - }else { -__wsum csum =0 ; -if (!csum_and_copy_from_iter_full (to, len, &csum, &msg->msg_iter)) -return -EFAULT ; - skb->csum =csum_block_add (skb->csum, csum, odd); - } -return 0 ; -} -EXPORT_SYMBOL (ip_generic_getfrag); - static int __ip_append_data(struct sock *sk, struct flowi4 *fl4, struct sk_buff_head *queue,
net/ipv6/af_inet6.c +5 -0
@@ -302,6 +302,11 @@ int __inet6_bind(struct sock *sk, struct sockaddr_unsized *uaddr, int addr_len,struct net_device *dev =NULL ;int chk_addr_ret; +if (!IS_ENABLED (CONFIG_IPV4 )) { + err = -EADDRNOTAVAIL ; + goto out; + } +/* Binding to v4-mapped address on a v6-only socket * makes no sense */
net/ipv6/datagram.c +2 -2
@@ -153,7 +153,7 @@ int __ip6_datagram_connect(struct sock *sk, struct sockaddr_unsized *uaddr,int err;if (usin->sin6_family ==AF_INET ) { -if (ipv6_only_sock (sk)) +if (!IS_ENABLED (CONFIG_IPV4 ) ||ipv6_only_sock (sk))return -EAFNOSUPPORT ; err =__ip4_datagram_connect (sk, uaddr, addr_len); goto ipv4_connected;
@@ -186,7 +186,7 @@ int __ip6_datagram_connect(struct sock *sk, struct sockaddr_unsized *uaddr,if (addr_type &IPV6_ADDR_MAPPED ) {struct sockaddr_in sin; -if (ipv6_only_sock (sk)) { +if (!IS_ENABLED (CONFIG_IPV4 ) ||ipv6_only_sock (sk)) { err = -ENETUNREACH ; goto out; }
Signature · 1 line
2.55.0
PATCH v3 5/16 ipv4: raw: split IPv4 specific logic into raw_ipv4.c
In reply to Fernando Fernandez ManceraTo enable compiling the INET subsystem without IPv4, RAW socket IPv4 specific functions must be isolated from the generic RAW socket infrastructure, similar to how it is done for TCP.
This patch creates raw_ipv4.c and move all the functions for packet matching, input/output processing, ICMP filtering and the AF_INET raw_prot definition from raw.c to the new file. The Makefile is updated to compile raw_ipv4.c only when CONFIG_IPV4 is enabled.
--- net/ipv4/Makefile | 2 +- net/ipv4/raw.c | 853 ------------------------------------------ net/ipv4/raw_diag.c | 3 +- net/ipv4/raw_ipv4.c | 884 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 887 insertions(+), 855 deletions(-) create mode 100644 net/ipv4/raw_ipv4.c
net/ipv4/Makefile +1 -1
@@ -13,7 +13,7 @@ obj-y := inetpeer.o protocol.o inet_hashtables.o inet_timewait_sock.o \ obj-$(CONFIG_IPV4) += route.o ip_input.o ip_fragment.o ip_forward.o ip_options.o \ ip_sockglue.o tcp_ipv4.o datagram.o icmp.o arp.o devinet.o \ igmp.o fib_notifier.o ip_output.o fib_frontend.o \ - fib_semantics.o fib_trie.o + fib_semantics.o fib_trie.o raw_ipv4.o obj-$(CONFIG_NET_IP_TUNNEL) += ip_tunnel.o obj-$(CONFIG_SYSCTL) += sysctl_net_ipv4.o
net/ipv4/raw.c +0 -853
896 lines not on this page · raw message
net/ipv4/raw_diag.c +2 -1
@@ -40,7 +40,8 @@ static bool raw_lookup(struct net *net, const struct sock *sk,struct inet_diag_req_raw *r = (void *)req;if (r->sdiag_family ==AF_INET ) -return raw_v4_match (net, sk, r->sdiag_raw_protocol, +return IS_ENABLED (CONFIG_IPV4 ) && +raw_v4_match (net, sk, r->sdiag_raw_protocol, r->id.idiag_dst[0 ], r->id.idiag_src[0 ], r->id.idiag_if,0 );
net/ipv4/raw_ipv4.c new file +884 -0
884 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v3 7/16 ipv4: icmp: split IPv4 specific logic into icmp_ipv4.c
In reply to Fernando Fernandez ManceraTo enable compiling INET subsystem withot IPv4, ICMP protocol IPv4 specific functions must be isolated from the generic ICMP protocol infrastructure.
This patch creates icmp_ipv4.c and move all the functions for packet processing, error handling, and other from icmp.c to a new file. The Makefile is updated to compile icmp_ipv4.c only when CONFIG_IPV4 is enabled.
--- include/net/icmp.h | 1 + net/ipv4/Makefile | 9 +- net/ipv4/icmp.c | 1418 +---------------------------------------- net/ipv4/icmp_ipv4.c | 1448 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1459 insertions(+), 1417 deletions(-) create mode 100644 net/ipv4/icmp_ipv4.c
include/net/icmp.h +1 -0
@@ -57,6 +57,7 @@ static inline void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __bint icmp_rcv (struct sk_buff *skb);int icmp_err (struct sk_buff *skb,u32 info); +int icmp_init_ipv4 (void );int icmp_init (void );void icmp_out_count (struct net *net,unsigned char type);bool icmp_build_probe (struct sk_buff *skb,struct icmphdr *icmphdr);
net/ipv4/Makefile +5 -4
@@ -8,12 +8,13 @@ obj-y := inetpeer.o protocol.o inet_hashtables.o inet_timewait_sock.o \ tcp_minisocks.o tcp_cong.o tcp_metrics.o tcp_fastopen.o \ tcp_recovery.o tcp_ulp.o tcp_offload.o tcp_plb.o raw.o udp.o \ udp_offload.o af_inet.o inet_fragment.o ping.o ip_tunnel_core.o \ - gre_offload.o metrics.o netlink.o nexthop.o udp_tunnel_stub.o + gre_offload.o metrics.o netlink.o nexthop.o udp_tunnel_stub.o \ + icmp.o obj-$(CONFIG_IPV4) += route.o ip_input.o ip_fragment.o ip_forward.o ip_options.o \ - ip_sockglue.o tcp_ipv4.o datagram.o icmp.o arp.o devinet.o \ - igmp.o fib_notifier.o ip_output.o fib_frontend.o \ - fib_semantics.o fib_trie.o raw_ipv4.o udp_ipv4.o + ip_sockglue.o tcp_ipv4.o datagram.o arp.o devinet.o igmp.o \ + fib_notifier.o ip_output.o fib_frontend.o fib_semantics.o \ + fib_trie.o raw_ipv4.o udp_ipv4.o icmp_ipv4.o obj-$(CONFIG_NET_IP_TUNNEL) += ip_tunnel.o obj-$(CONFIG_SYSCTL) += sysctl_net_ipv4.o
net/ipv4/icmp.c +5 -1413
1,462 lines not on this page · raw message
net/ipv4/icmp_ipv4.c new file +1448 -0
1,448 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v3 6/16 ipv4: udp: split IPv4 specific logic into udp_ipv4.c
In reply to Fernando Fernandez ManceraTo enable compiling the INET subsystem without IPv4, UDP socket IPv4 specific functions must be isolated from the generic UDP socket infrastructure, similar to how it is done for TCP.
This patch creates udp_ipv4.c and move all the functions for packet matching, input/output processing, multicast and the AF_INET udp_prot from udp.c to the new file. The Makefile is updated to compile udp_ipv4.c only when CONFIG_IPV4 is enabled.
--- include/net/udp.h | 11 + net/ipv4/Makefile | 2 +- net/ipv4/af_inet.c | 10 + net/ipv4/udp.c | 1817 +--------------------------------------- net/ipv4/udp_bpf.c | 5 +- net/ipv4/udp_ipv4.c | 1790 +++++++++++++++++++++++++++++++++++++++ net/ipv4/udp_offload.c | 3 + net/ipv6/udp.c | 11 +- 8 files changed, 1861 insertions(+), 1788 deletions(-) create mode 100644 net/ipv4/udp_ipv4.c
include/net/udp.h +11 -0
@@ -436,9 +436,20 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, int (*push_pending_frames)(struct sock *));struct sock *udp4_lib_lookup (const struct net *net,__be32 saddr,__be16 sport,__be32 daddr,__be16 dport,int dif); +#if IS_ENABLED (CONFIG_IPV4 )struct sock *__udp4_lib_lookup (const struct net *net,__be32 saddr,__be16 sport,__be32 daddr,__be16 dport,int dif,int sdif,struct sk_buff *skb); +#else +static inline struct sock *__udp4_lib_lookup (const struct net *net, +__be32 saddr,__be16 sport, +__be32 daddr,__be16 dport, +int dif,int sdif, +struct sk_buff *skb) +{ +return NULL ; +} +#endif struct sock *udp4_lib_lookup_skb (const struct sk_buff *skb,__be16 sport,__be16 dport); struct sock *udp6_lib_lookup(const struct net *net,
net/ipv4/Makefile +1 -1
@@ -13,7 +13,7 @@ obj-y := inetpeer.o protocol.o inet_hashtables.o inet_timewait_sock.o \ obj-$(CONFIG_IPV4) += route.o ip_input.o ip_fragment.o ip_forward.o ip_options.o \ ip_sockglue.o tcp_ipv4.o datagram.o icmp.o arp.o devinet.o \ igmp.o fib_notifier.o ip_output.o fib_frontend.o \ - fib_semantics.o fib_trie.o raw_ipv4.o + fib_semantics.o fib_trie.o raw_ipv4.o udp_ipv4.o obj-$(CONFIG_NET_IP_TUNNEL) += ip_tunnel.o obj-$(CONFIG_SYSCTL) += sysctl_net_ipv4.o
net/ipv4/af_inet.c +10 -0
@@ -886,8 +886,13 @@ int inet_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)return -EAGAIN ; prot =READ_ONCE (sk->sk_prot); +#if IS_ENABLED (CONFIG_IPV4 )return INDIRECT_CALL_2 (prot->sendmsg, tcp_sendmsg, udp_sendmsg, sk, msg, size); +#else +return INDIRECT_CALL_1 (prot->sendmsg, tcp_sendmsg, + sk, msg, size); +#endif }EXPORT_SYMBOL (inet_sendmsg);
@@ -914,8 +919,13 @@ int inet_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,sock_rps_record_flow (sk); prot =READ_ONCE (sk->sk_prot); +#if IS_ENABLED (CONFIG_IPV4 )return INDIRECT_CALL_2 (prot->recvmsg, tcp_recvmsg, udp_recvmsg, sk, msg, size, flags); +#else +return INDIRECT_CALL_1 (prot->recvmsg, tcp_recvmsg, + sk, msg, size, flags); +#endif }EXPORT_SYMBOL (inet_recvmsg);
net/ipv4/udp.c +35 -1782
1,925 lines not on this page · raw message
net/ipv4/udp_bpf.c +4 -1
@@ -16,6 +16,8 @@ static int sk_udp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,if (sk->sk_family ==AF_INET6 )return udpv6_prot_saved->recvmsg (sk, msg, len, flags);#endif +if (!IS_ENABLED (CONFIG_IPV4 )) +return -EAFNOSUPPORT ;return udp_prot.recvmsg (sk, msg, len, flags); }
@@ -155,7 +157,8 @@ static void udp_bpf_check_v6_needs_rebuild(struct proto *ops)static int __init udp_bpf_v4_build_proto (void ) { -udp_bpf_rebuild_protos (&udp_bpf_prots[UDP_BPF_IPV4 ], &udp_prot); +if (IS_ENABLED (CONFIG_IPV4 )) +udp_bpf_rebuild_protos (&udp_bpf_prots[UDP_BPF_IPV4 ], &udp_prot);return 0 ; }late_initcall (udp_bpf_v4_build_proto);
net/ipv4/udp_ipv4.c new file +1790 -0
1,004 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.55.0
Part of the diff is not shown here. View the raw message.
PATCH v3 9/16 ipv4: fib: split common nexthop logic to fib_core.c
In reply to Fernando Fernandez ManceraTo enable compiling INET subsystem without IPv4, shared FIB and nexthop logic must be accessible to IPv6 when IPv4 routing stack is omitted.
This patch creates fib_core.c and move all the functions for common nexthop initialization and release from fib_semantics.c to fib_core.c. Note that fib_core.c is under net/core.
--- include/net/ip_fib.h | 27 +++- include/net/route.h | 6 + net/core/Makefile | 2 +- net/core/fib_core.c | 307 +++++++++++++++++++++++++++++++++++++ net/ipv4/fib_frontend.c | 96 ------------ net/ipv4/fib_semantics.c | 205 ------------------------- net/ipv4/nexthop.c | 5 +- net/ipv4/sysctl_net_ipv4.c | 2 + 8 files changed, 345 insertions(+), 305 deletions(-) create mode 100644 net/core/fib_core.c
include/net/ip_fib.h +26 -1
@@ -250,7 +250,13 @@ int call_fib4_notifiers(struct net *net, enum fib_event_type event_type,int __net_init fib4_notifier_init (struct net *net); void __net_exit fib4_notifier_exit(struct net *net); +#if IS_ENABLED (CONFIG_IPV4 )void fib_info_notify_update (struct net *net,struct nl_info *info); +#else +static inline void fib_info_notify_update (struct net *net,struct nl_info *info) +{ +} +#endif int fib_notify (struct net *net,struct notifier_block *nb,struct netlink_ext_ack *extack);
@@ -442,7 +448,7 @@ static inline bool fib_dscp_masked_match(dscp_t dscp, const struct flowi4 *fl4)return dscp == (fl4->flowi4_dscp &INET_DSCP_LEGACY_TOS_MASK ); } -/* Exported by fib_frontend.c */ +/* Exported by net/core/fib_core.c */ extern const struct nla_policy rtm_ipv4_policy[];void ip_fib_init (void ); int fib_gw_from_via(struct fib_config *cfg, struct nlattr *nla,
@@ -578,10 +584,23 @@ void fib_select_multipath(struct fib_result *res, int hash,void fib_select_path (struct net *net,struct fib_result *res,struct flowi4 *fl4,const struct sk_buff *skb); +#if IS_ENABLED (CONFIG_IPV4 )int fib_nh_init (struct net *net,struct fib_nh *fib_nh,struct fib_config *cfg,int nh_weight,struct netlink_ext_ack *extack);void fib_nh_release (struct net *net,struct fib_nh *fib_nh); +#else +static inline int fib_nh_init (struct net *net,struct fib_nh *fib_nh, +struct fib_config *cfg,int nh_weight, +struct netlink_ext_ack *extack) +{ +return -EAFNOSUPPORT ; +} + +static inline void fib_nh_release (struct net *net,struct fib_nh *fib_nh) +{ +} +#endif int fib_nh_common_init(struct net *net, struct fib_nh_common *nhc, struct nlattr *fc_encap, u16 fc_encap_type, void *cfg, gfp_t gfp_flags,
@@ -620,7 +639,13 @@ static inline void fib_combine_itag(u32 *itag, const struct fib_result *res)#endif } +#if IS_ENABLED (CONFIG_IPV4 )void fib_flush (struct net *net); +#else +static inline void fib_flush (struct net *net) +{ +} +#endif void free_fib_info (struct fib_info *fi);static inline void fib_info_hold (struct fib_info *fi)
include/net/route.h +6 -0
@@ -128,7 +128,13 @@ extern struct ip_rt_acct __percpu *ip_rt_acct;struct in_device ;int ip_rt_init (void ); +#if IS_ENABLED (CONFIG_IPV4 )void rt_cache_flush (struct net *net); +#else +static inline void rt_cache_flush (struct net *net) +{ +} +#endif void rt_flush_dev (struct net_device *dev); static inline void inet_sk_init_flowi4(const struct inet_sock *inet,
net/core/Makefile +1 -1
@@ -12,7 +12,7 @@ obj-$(CONFIG_SYSCTL) += sysctl_net_core.o obj-y += dev.o dev_api.o dev_addr_lists.o dst.o netevent.o \ neighbour.o rtnetlink.o utils.o link_watch.o filter.o \ sock_diag.o dev_ioctl.o tso.o sock_reuseport.o \ - fib_notifier.o xdp.o flow_offload.o gro.o \ + fib_notifier.o fib_core.o xdp.o flow_offload.o gro.o \ netdev-genl.o netdev-genl-gen.o netdev_work.o gso.o obj-$(CONFIG_NETDEV_ADDR_LIST_TEST) += dev_addr_lists_test.o
net/core/fib_core.c new file +307 -0
307 lines not on this page · raw message
net/ipv4/fib_frontend.c +0 -96
108 lines not on this page · raw message
net/ipv4/fib_semantics.c +0 -205
223 lines not on this page · raw message
net/ipv4/nexthop.c +3 -2
@@ -1421,7 +1421,7 @@ static bool nexthop_is_good_nh(const struct nexthop *nh)switch (nhi->family) {case AF_INET : -return ipv4_good_nh (&nhi->fib_nh); +return IS_ENABLED (CONFIG_IPV4 ) &&ipv4_good_nh (&nhi->fib_nh);case AF_INET6 :return IS_ENABLED (CONFIG_IPV6 ) &&ipv6_good_nh (&nhi->fib6_nh); }
@@ -4005,7 +4005,8 @@ static int nh_netdev_event(struct notifier_block *this,break ;case NETDEV_CHANGEMTU : info_ext = ptr; -nexthop_sync_mtu (dev, info_ext->ext.mtu); +if (IS_ENABLED (CONFIG_IPV4 )) +nexthop_sync_mtu (dev, info_ext->ext.mtu);rt_cache_flush (dev_net (dev));break ; }
net/ipv4/sysctl_net_ipv4.c +2 -0
@@ -615,6 +615,7 @@ static struct ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = proc_doulongvec_minmax, }, +#if IS_ENABLED (CONFIG_IPV4 ) { .procname = "fib_sync_mem", .data = &sysctl_fib_sync_mem,
@@ -624,6 +625,7 @@ static struct ctl_table ipv4_table[] = { .extra1 = &sysctl_fib_sync_mem_min, .extra2 = &sysctl_fib_sync_mem_max, }, +#endif }; static const struct ctl_table ipv4_net_table[] = {
Signature · 1 line
2.55.0
PATCH v3 8/16 ipv4: ping: split IPv4 specific logic into ping_ipv4.c
In reply to Fernando Fernandez ManceraTo enable compiling INET subsystem withot IPv4, ping socket IPv4 specific functions must be isolated from the generic ping infrastructure.
This patch creates ping_ipv4.c and move all the functions for packet transmission and the AF_INET ping_prot definition from ping.c to the new file. The Makefile is updated to compile ping_ipv4.c only when CONFIG_IPV4 is enabled.
--- net/ipv4/Makefile | 2 +- net/ipv4/ping.c | 210 +-------------------------------------- net/ipv4/ping_ipv4.c | 228 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 234 insertions(+), 206 deletions(-) create mode 100644 net/ipv4/ping_ipv4.c
net/ipv4/Makefile +1 -1
@@ -14,7 +14,7 @@ obj-y := inetpeer.o protocol.o inet_hashtables.o inet_timewait_sock.o \ obj-$(CONFIG_IPV4) += route.o ip_input.o ip_fragment.o ip_forward.o ip_options.o \ ip_sockglue.o tcp_ipv4.o datagram.o arp.o devinet.o igmp.o \ fib_notifier.o ip_output.o fib_frontend.o fib_semantics.o \ - fib_trie.o raw_ipv4.o udp_ipv4.o icmp_ipv4.o + fib_trie.o raw_ipv4.o udp_ipv4.o icmp_ipv4.o ping_ipv4.o obj-$(CONFIG_NET_IP_TUNNEL) += ip_tunnel.o obj-$(CONFIG_SYSCTL) += sysctl_net_ipv4.o
net/ipv4/ping.c +5 -205
252 lines not on this page · raw message
net/ipv4/ping_ipv4.c new file +228 -0
228 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v3 11/16 ipv4: disable IPv4-only sysctls when CONFIG_IPV4=n
In reply to Fernando Fernandez ManceraTo avoid noise and unexpected problems, let's hide all the sysctls that are related to IPv4 only when the kernel is compiled without IPv4 support.
--- net/ipv4/sysctl_net_ipv4.c | 407 +++++++++++++++++++------------------ 1 file changed, 205 insertions(+), 202 deletions(-)
net/ipv4/sysctl_net_ipv4.c +205 -202
@@ -31,8 +31,8 @@ static int tcp_min_snd_mss_max = 65535;static int tcp_rto_max_max =TCP_RTO_MAX_SEC *MSEC_PER_SEC ;static int ip_privileged_port_min;static int ip_privileged_port_max =65535 ; -static int ip_ttl_min =1 ; -static int ip_ttl_max =255 ; +static int ip_ttl_min__maybe_unused =1 ; +static int ip_ttl_max__maybe_unused =255 ;static int tcp_syn_retries_min =1 ;static int tcp_syn_retries_max =MAX_TCP_SYNCNT ;static int tcp_syn_linear_timeouts_max =MAX_TCP_SYNCNT ;
@@ -48,7 +48,7 @@ static int tcp_plb_max_rounds = 31;static int tcp_plb_max_cong_thresh =256 ;static unsigned int tcp_tw_reuse_delay_max =TCP_PAWS_MSL *MSEC_PER_SEC ;static int tcp_ecn_mode_max =5 ; -static u32 icmp_errors_extension_mask_all = +static u32 icmp_errors_extension_mask_all__maybe_unused =GENMASK_U8 (ICMP_ERR_EXT_COUNT -1 ,0 );static int tcp_min_rcvbuf =4096 ;
@@ -201,8 +201,9 @@ static int ipv4_ping_group_range(const struct ctl_table *table, int write,return ret; } -static int ipv4_fwd_update_priority (const struct ctl_table *table,int write, -void *buffer,size_t *lenp,loff_t *ppos) +static int __maybe_unused +ipv4_fwd_update_priority (const struct ctl_table *table,int write, +void *buffer,size_t *lenp,loff_t *ppos) {struct net *net;int ret;
@@ -441,9 +442,9 @@ static int proc_udp_hash_entries(const struct ctl_table *table, int write, }#ifdef CONFIG_IP_ROUTE_MULTIPATH -static int proc_fib_multipath_hash_policy (const struct ctl_table *table,int write, -void *buffer,size_t *lenp, -loff_t *ppos) +static int __maybe_unused +proc_fib_multipath_hash_policy (const struct ctl_table *table,int write, +void *buffer,size_t *lenp,loff_t *ppos) { struct net *net = container_of(table->data, struct net, ipv4.sysctl_fib_multipath_hash_policy);
@@ -456,9 +457,9 @@ static int proc_fib_multipath_hash_policy(const struct ctl_table *table, int wrireturn ret; } -static int proc_fib_multipath_hash_fields (const struct ctl_table *table,int write, -void *buffer,size_t *lenp, -loff_t *ppos) +static int __maybe_unused +proc_fib_multipath_hash_fields (const struct ctl_table *table,int write, +void *buffer,size_t *lenp,loff_t *ppos) {struct net *net;int ret;
@@ -492,9 +493,9 @@ static void proc_fib_multipath_hash_set_seed(struct net *net, u32 user_seed)WRITE_ONCE (net->ipv4.sysctl_fib_multipath_hash_seed.mp_seed, new.mp_seed); } -static int proc_fib_multipath_hash_seed (const struct ctl_table *table,int write, -void *buffer,size_t *lenp, -loff_t *ppos) +static int __maybe_unused +proc_fib_multipath_hash_seed (const struct ctl_table *table,int write, +void *buffer,size_t *lenp,loff_t *ppos) {struct sysctl_fib_multipath_hash_seed *mphs;struct net *net = table->data;
@@ -636,15 +637,6 @@ static const struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, - { - .procname = "icmp_echo_ignore_all", - .data = &init_net.ipv4.sysctl_icmp_echo_ignore_all, - .maxlen = sizeof(u8), - .mode = 0644, - .proc_handler = proc_dou8vec_minmax, - .extra1 = SYSCTL_ZERO, - .extra2 =SYSCTL_ONE - }, { .procname = "icmp_echo_enable_probe", .data = &init_net.ipv4.sysctl_icmp_echo_enable_probe,
@@ -654,56 +646,6 @@ static const struct ctl_table ipv4_net_table[] = { .extra1 = SYSCTL_ZERO, .extra2 =SYSCTL_ONE }, - { - .procname = "icmp_echo_ignore_broadcasts", - .data = &init_net.ipv4.sysctl_icmp_echo_ignore_broadcasts, - .maxlen = sizeof(u8), - .mode = 0644, - .proc_handler = proc_dou8vec_minmax, - .extra1 = SYSCTL_ZERO, - .extra2 =SYSCTL_ONE - }, - { - .procname = "icmp_ignore_bogus_error_responses", - .data = &init_net.ipv4.sysctl_icmp_ignore_bogus_error_responses, - .maxlen = sizeof(u8), - .mode = 0644, - .proc_handler = proc_dou8vec_minmax, - .extra1 = SYSCTL_ZERO, - .extra2 =SYSCTL_ONE - }, - { - .procname = "icmp_errors_use_inbound_ifaddr", - .data = &init_net.ipv4.sysctl_icmp_errors_use_inbound_ifaddr, - .maxlen = sizeof(u8), - .mode = 0644, - .proc_handler = proc_dou8vec_minmax, - .extra1 = SYSCTL_ZERO, - .extra2 =SYSCTL_ONE - }, - { - .procname = "icmp_errors_extension_mask", - .data = &init_net.ipv4.sysctl_icmp_errors_extension_mask, - .maxlen = sizeof(u8), - .mode = 0644, - .proc_handler = proc_dou8vec_minmax, - .extra1 = SYSCTL_ZERO, - .extra2 = &icmp_errors_extension_mask_all, - }, - { - .procname = "icmp_ratelimit", - .data = &init_net.ipv4.sysctl_icmp_ratelimit, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_ms_jiffies, - }, - { - .procname = "icmp_ratemask", - .data = &init_net.ipv4.sysctl_icmp_ratemask, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec - }, { .procname = "icmp_msgs_per_sec", .data = &init_net.ipv4.sysctl_icmp_msgs_per_sec,
@@ -774,13 +716,6 @@ static const struct ctl_table ipv4_net_table[] = { .extra1 = SYSCTL_ZERO, .extra2 = SYSCTL_ONE, }, - { - .procname = "ip_dynaddr", - .data = &init_net.ipv4.sysctl_ip_dynaddr, - .maxlen = sizeof(u8), - .mode = 0644, - .proc_handler = proc_dou8vec_minmax, - }, { .procname = "ip_early_demux", .data = &init_net.ipv4.sysctl_ip_early_demux,
@@ -811,15 +746,6 @@ static const struct ctl_table ipv4_net_table[] = { .extra1 = SYSCTL_ZERO, .extra2 = SYSCTL_ONE, }, - { - .procname = "ip_default_ttl", - .data = &init_net.ipv4.sysctl_ip_default_ttl, - .maxlen = sizeof(u8), - .mode = 0644, - .proc_handler = proc_dou8vec_minmax, - .extra1 = &ip_ttl_min, - .extra2 = &ip_ttl_max, - }, { .procname = "ip_local_port_range", .maxlen = 0,
@@ -841,36 +767,6 @@ static const struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_do_large_bitmap, }, - { - .procname = "ip_no_pmtu_disc", - .data = &init_net.ipv4.sysctl_ip_no_pmtu_disc, - .maxlen = sizeof(u8), - .mode = 0644, - .proc_handler = proc_dou8vec_minmax, - }, - { - .procname = "ip_forward_use_pmtu", - .data = &init_net.ipv4.sysctl_ip_fwd_use_pmtu, - .maxlen = sizeof(u8), - .mode = 0644, - .proc_handler = proc_dou8vec_minmax, - }, - { - .procname = "ip_forward_update_priority", - .data = &init_net.ipv4.sysctl_ip_fwd_update_priority, - .maxlen = sizeof(u8), - .mode = 0644, - .proc_handler = ipv4_fwd_update_priority, - .extra1 = SYSCTL_ZERO, - .extra2 = SYSCTL_ONE, - }, - { - .procname = "ip_nonlocal_bind", - .data = &init_net.ipv4.sysctl_ip_nonlocal_bind, - .maxlen = sizeof(u8), - .mode = 0644, - .proc_handler = proc_dou8vec_minmax, - }, { .procname = "ip_autobind_reuse", .data = &init_net.ipv4.sysctl_ip_autobind_reuse,
@@ -880,13 +776,6 @@ static const struct ctl_table ipv4_net_table[] = { .extra1 = SYSCTL_ZERO, .extra2 = SYSCTL_ONE, }, - { - .procname = "fwmark_reflect", - .data = &init_net.ipv4.sysctl_fwmark_reflect, - .maxlen = sizeof(u8), - .mode = 0644, - .proc_handler = proc_dou8vec_minmax, - }, { .procname = "tcp_fwmark_accept", .data = &init_net.ipv4.sysctl_tcp_fwmark_accept,
@@ -952,37 +841,6 @@ static const struct ctl_table ipv4_net_table[] = { .proc_handler = proc_douintvec_minmax, .extra2 = &u32_max_div_HZ, }, - { - .procname = "igmp_link_local_mcast_reports", - .data = &init_net.ipv4.sysctl_igmp_llm_reports, - .maxlen = sizeof(u8), - .mode = 0644, - .proc_handler = proc_dou8vec_minmax, - }, - { - .procname = "igmp_max_memberships", - .data = &init_net.ipv4.sysctl_igmp_max_memberships, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec - }, - { - .procname = "igmp_max_msf", - .data = &init_net.ipv4.sysctl_igmp_max_msf, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec - }, -#ifdef CONFIG_IP_MULTICAST - { - .procname = "igmp_qrv", - .data = &init_net.ipv4.sysctl_igmp_qrv, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = SYSCTL_ONE - }, -#endif { .procname = "tcp_congestion_control", .data = &init_net.ipv4.tcp_congestion_control,
@@ -1154,42 +1012,6 @@ static const struct ctl_table ipv4_net_table[] = { .proc_handler = proc_tfo_blackhole_detect_timeout, .extra1 = SYSCTL_ZERO, }, -#ifdef CONFIG_IP_ROUTE_MULTIPATH - { - .procname = "fib_multipath_use_neigh", - .data = &init_net.ipv4.sysctl_fib_multipath_use_neigh, - .maxlen = sizeof(u8), - .mode = 0644, - .proc_handler = proc_dou8vec_minmax, - .extra1 = SYSCTL_ZERO, - .extra2 = SYSCTL_ONE, - }, - { - .procname = "fib_multipath_hash_policy", - .data = &init_net.ipv4.sysctl_fib_multipath_hash_policy, - .maxlen = sizeof(u8), - .mode = 0644, - .proc_handler = proc_fib_multipath_hash_policy, - .extra1 = SYSCTL_ZERO, - .extra2 = SYSCTL_THREE, - }, - { - .procname = "fib_multipath_hash_fields", - .data = &init_net.ipv4.sysctl_fib_multipath_hash_fields, - .maxlen = sizeof(u32), - .mode = 0644, - .proc_handler = proc_fib_multipath_hash_fields, - .extra1 = SYSCTL_ONE, - .extra2 = &fib_multipath_hash_fields_all_mask, - }, - { - .procname = "fib_multipath_hash_seed", - .data = &init_net, - .maxlen = sizeof(u32), - .mode = 0644, - .proc_handler = proc_fib_multipath_hash_seed, - }, -#endif { .procname = "ip_unprivileged_port_start", .maxlen = sizeof(int),
@@ -1563,15 +1385,6 @@ static const struct ctl_table ipv4_net_table[] = { .proc_handler = proc_dointvec_minmax, .extra1 =SYSCTL_ONE }, - { - .procname = "fib_notify_on_flag_change", - .data = &init_net.ipv4.sysctl_fib_notify_on_flag_change, - .maxlen = sizeof(u8), - .mode = 0644, - .proc_handler = proc_dou8vec_minmax, - .extra1 = SYSCTL_ZERO, - .extra2 = SYSCTL_TWO, - }, { .procname = "tcp_plb_enabled", .data = &init_net.ipv4.sysctl_tcp_plb_enabled,
@@ -1656,6 +1469,196 @@ static const struct ctl_table ipv4_net_table[] = { .extra1 = SYSCTL_ONE_THOUSAND, .extra2 = &tcp_rto_max_max, }, +#if IS_ENABLED(CONFIG_IPV4) + { + .procname = "icmp_echo_ignore_all", + .data = &init_net.ipv4.sysctl_icmp_echo_ignore_all, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = proc_dou8vec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE + }, + { + .procname = "icmp_echo_ignore_broadcasts", + .data = &init_net.ipv4.sysctl_icmp_echo_ignore_broadcasts, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = proc_dou8vec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE + }, + { + .procname = "icmp_ignore_bogus_error_responses", + .data = &init_net.ipv4.sysctl_icmp_ignore_bogus_error_responses, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = proc_dou8vec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE + }, + { + .procname = "icmp_errors_use_inbound_ifaddr", + .data = &init_net.ipv4.sysctl_icmp_errors_use_inbound_ifaddr, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = proc_dou8vec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE + }, + { + .procname = "icmp_errors_extension_mask", + .data = &init_net.ipv4.sysctl_icmp_errors_extension_mask, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = proc_dou8vec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = &icmp_errors_extension_mask_all, + }, + { + .procname = "icmp_ratelimit", + .data = &init_net.ipv4.sysctl_icmp_ratelimit, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_ms_jiffies, + }, + { + .procname = "icmp_ratemask", + .data = &init_net.ipv4.sysctl_icmp_ratemask, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, + { + .procname = "ip_dynaddr", + .data = &init_net.ipv4.sysctl_ip_dynaddr, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = proc_dou8vec_minmax, + }, + { + .procname = "ip_default_ttl", + .data = &init_net.ipv4.sysctl_ip_default_ttl, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = proc_dou8vec_minmax, + .extra1 = &ip_ttl_min, + .extra2 = &ip_ttl_max, + }, + { + .procname = "ip_no_pmtu_disc", + .data = &init_net.ipv4.sysctl_ip_no_pmtu_disc, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = proc_dou8vec_minmax, + }, + { + .procname = "ip_forward_use_pmtu", + .data = &init_net.ipv4.sysctl_ip_fwd_use_pmtu, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = proc_dou8vec_minmax, + }, + { + .procname = "ip_forward_update_priority", + .data = &init_net.ipv4.sysctl_ip_fwd_update_priority, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = ipv4_fwd_update_priority, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, + }, + { + .procname = "ip_nonlocal_bind", + .data = &init_net.ipv4.sysctl_ip_nonlocal_bind, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = proc_dou8vec_minmax, + }, + { + .procname = "fwmark_reflect", + .data = &init_net.ipv4.sysctl_fwmark_reflect, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = proc_dou8vec_minmax, + }, + { + .procname = "igmp_link_local_mcast_reports", + .data = &init_net.ipv4.sysctl_igmp_llm_reports, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = proc_dou8vec_minmax, + }, + { + .procname = "igmp_max_memberships", + .data = &init_net.ipv4.sysctl_igmp_max_memberships, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, + { + .procname = "igmp_max_msf", + .data = &init_net.ipv4.sysctl_igmp_max_msf, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, +#ifdef CONFIG_IP_MULTICAST + { + .procname = "igmp_qrv", + .data = &init_net.ipv4.sysctl_igmp_qrv, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ONE + }, +#endif +#ifdef CONFIG_IP_ROUTE_MULTIPATH + { + .procname = "fib_multipath_use_neigh", + .data = &init_net.ipv4.sysctl_fib_multipath_use_neigh, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = proc_dou8vec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, + }, + { + .procname = "fib_multipath_hash_policy", + .data = &init_net.ipv4.sysctl_fib_multipath_hash_policy, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = proc_fib_multipath_hash_policy, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_THREE, + }, + { + .procname = "fib_multipath_hash_fields", + .data = &init_net.ipv4.sysctl_fib_multipath_hash_fields, + .maxlen = sizeof(u32), + .mode = 0644, + .proc_handler = proc_fib_multipath_hash_fields, + .extra1 = SYSCTL_ONE, + .extra2 = &fib_multipath_hash_fields_all_mask, + }, + { + .procname = "fib_multipath_hash_seed", + .data = &init_net, + .maxlen = sizeof(u32), + .mode = 0644, + .proc_handler = proc_fib_multipath_hash_seed, + }, +#endif + { + .procname = "fib_notify_on_flag_change", + .data = &init_net.ipv4.sysctl_fib_notify_on_flag_change, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = proc_dou8vec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_TWO, + }, +#endif }; static const struct ctl_table *ipv4_net_table_dup(struct net *net)
Signature · 1 line
2.55.0
PATCH v3 10/16 tunnels: guard IPv4 tunnel functions with CONFIG_IPV4
In reply to Fernando Fernandez ManceraTo enable compiling INET subsystem withou IPv4, IPv4 specific IP tunnel core functions must be bypassed when the protocol is disabled.
--- net/ipv4/ip_tunnel_core.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
net/ipv4/ip_tunnel_core.c +11 -0
@@ -58,6 +58,14 @@ void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,struct iphdr *iph;int err; +if (!IS_ENABLED (CONFIG_IPV4 )) { +if (dev) +DEV_STATS_INC (dev, tx_errors); +ip_rt_put (rt); +kfree_skb (skb); +return ; + } +if (unlikely (dev_recursion_level () >IP_TUNNEL_RECURSION_LIMIT )) {if (dev) { net_crit_ratelimited("Dead loop on virtual device %s (net %llu), fix it urgently!\n",
@@ -218,6 +226,9 @@ static int iptunnel_pmtud_build_icmp(struct sk_buff *skb, int mtu)struct ethhdr eh;int len, err; +if (!IS_ENABLED (CONFIG_IPV4 )) +return -EOPNOTSUPP ; +if (!pskb_may_pull (skb,ETH_HLEN +sizeof (struct iphdr )))return -EINVAL ;
Signature · 1 line
2.55.0
PATCH v3 15/16 netlabel: cipso: introduce CONFIG_CIPSO to decouple IPv4 dependency
In reply to Fernando Fernandez ManceraCurrently, the Commercial IP Security Option (CIPSO) is unconditionally tied to CONFIG_NETLABEL. Because CIPSO is inherently an IPv4 protocol feature, this creates a transitive dependency where subsystems relying on NetLabel (such as Smack) are forced to depend on CONFIG_IPV4, even if the user only wants to utilize IPv6/CALIPSO.
This patch introduces a new CONFIG_CIPSO boolean that is automatically enabled only when both NETLABEL and IPV4 are selected. It abstracts the CIPSO-specific Makefile targets, sysctls, and kernel APIs behind this new config.
By safely stubbing out the CIPSO netlabel_kapi functions to return -ENOSYS when disabled, this allows NetLabel and Smack to be successfully built and used on IPv6-only kernels.
--- include/net/cipso_ipv4.h | 18 +++++++++++------- net/Kconfig | 3 --- net/ipv4/Makefile | 2 +- net/ipv4/sysctl_net_ipv4.c | 4 ++-- net/netlabel/Kconfig | 4 ++++ net/netlabel/Makefile | 2 +- net/netlabel/netlabel_cipso_v4.h | 7 +++++++ net/netlabel/netlabel_kapi.c | 3 +++ security/smack/Kconfig | 1 - 9 files changed, 29 insertions(+), 15 deletions(-)
include/net/cipso_ipv4.h +11 -7
@@ -100,7 +100,7 @@ struct cipso_v4_std_map_tbl {* Sysctl Variables */ -#ifdef CONFIG_NETLABEL +#ifdef CONFIG_CIPSO extern int cipso_v4_cache_enabled;extern int cipso_v4_cache_bucketsize;extern int cipso_v4_rbm_optfmt;
@@ -111,7 +111,7 @@ extern int cipso_v4_rbm_strictvalid;* DOI List Functions */ -#ifdef CONFIG_NETLABEL +#ifdef CONFIG_CIPSO int cipso_v4_doi_add (struct cipso_v4_doi *doi_def,struct netlbl_audit *audit_info);void cipso_v4_doi_free (struct cipso_v4_doi *doi_def);
@@ -144,19 +144,23 @@ static inline struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi) return NULL; } +static inline void cipso_v4_doi_putdef (struct cipso_v4_doi *doi_def) +{ +} +static inline int cipso_v4_doi_walk (u32 *skip_cnt,int (*callback) (struct cipso_v4_doi *doi_def,void *arg),void *cb_arg) {return 0 ; } -#endif /* CONFIG_NETLABEL */ +#endif /* CONFIG_CIPSO */ /* * Label Mapping Cache Functions */ -#ifdef CONFIG_NETLABEL +#ifdef CONFIG_CIPSO void cipso_v4_cache_invalidate (void );int cipso_v4_cache_add (const unsigned char *cipso_ptr,const struct netlbl_lsm_secattr *secattr);
@@ -171,13 +175,13 @@ static inline int cipso_v4_cache_add(const unsigned char *cipso_ptr, {return 0 ; } -#endif /* CONFIG_NETLABEL */ +#endif /* CONFIG_CIPSO */ /* * Protocol Handling Functions */ -#ifdef CONFIG_NETLABEL +#ifdef CONFIG_CIPSO void cipso_v4_error (struct sk_buff *skb,int error,u32 gateway);int cipso_v4_getattr (const unsigned char *cipso,struct netlbl_lsm_secattr *secattr);
@@ -303,6 +307,6 @@ static inline int cipso_v4_validate(const struct sk_buff *skb,return err_offset; } -#endif /* CONFIG_NETLABEL */ +#endif /* CONFIG_CIPSO */ #endif /* _CIPSO_IPV4_H */
net/Kconfig +0 -3
@@ -136,10 +136,7 @@ if INET source "net/ipv4/Kconfig" source "net/ipv6/Kconfig" source "net/mptcp/Kconfig" - -if IPV4 source "net/netlabel/Kconfig" -endif # if IPV4 endif # if INET
net/ipv4/Makefile +1 -1
@@ -62,7 +62,7 @@ obj-$(CONFIG_TCP_CONG_YEAH) += tcp_yeah.o obj-$(CONFIG_TCP_CONG_ILLINOIS) += tcp_illinois.o obj-$(CONFIG_NET_SOCK_MSG) += tcp_bpf.o obj-$(CONFIG_BPF_SYSCALL) += udp_bpf.o -obj-$(CONFIG_NETLABEL) += cipso_ipv4.o +obj-$(CONFIG_CIPSO) += cipso_ipv4.o obj-$(CONFIG_XFRM) += xfrm4_policy.o xfrm4_state.o xfrm4_input.o \ xfrm4_output.o xfrm4_protocol.o
net/ipv4/sysctl_net_ipv4.c +2 -2
@@ -573,7 +573,7 @@ static struct ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, -#ifdef CONFIG_NETLABEL +#ifdef CONFIG_CIPSO { .procname = "cipso_cache_enable", .data = &cipso_v4_cache_enabled,
@@ -602,7 +602,7 @@ static struct ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = proc_dointvec, }, -#endif /* CONFIG_NETLABEL */ +#endif /* CONFIG_CIPSO */ { .procname = "tcp_available_ulp", .maxlen = TCP_ULP_BUF_MAX,
net/netlabel/Kconfig +4 -0
@@ -17,3 +17,7 @@ config NETLABEL * https://github.com/netlabel/netlabel_tools If you are unsure, say N. + +config CIPSO + def_bool y + depends on NETLABEL && IPV4
net/netlabel/Makefile +1 -1
@@ -12,5 +12,5 @@ obj-y += netlabel_mgmt.o # protocol modules obj-y += netlabel_unlabeled.o -obj-y += netlabel_cipso_v4.o +obj-$(CONFIG_CIPSO) += netlabel_cipso_v4.o obj-$(subst m,y,$(CONFIG_IPV6)) += netlabel_calipso.o
net/netlabel/netlabel_cipso_v4.h +7 -0
@@ -147,6 +147,13 @@ enum {#define NLBL_CIPSOV4_A_MAX (__NLBL_CIPSOV4_A_MAX - 1)/* NetLabel protocol functions */ +#if IS_ENABLED (CONFIG_CIPSO )int netlbl_cipsov4_genl_init (void ); +#else +static inline int netlbl_cipsov4_genl_init (void ) +{ +return 0 ; +} +#endif #endif
net/netlabel/netlabel_kapi.c +3 -0
@@ -332,6 +332,9 @@ int netlbl_cfg_cipsov4_map_add(u32 doi,struct netlbl_domaddr_map *addrmap =NULL ;struct netlbl_domaddr4_map *addrinfo =NULL ; +if (!IS_ENABLED (CONFIG_CIPSO )) +return -ENOSYS ; + doi_def =cipso_v4_doi_getdef (doi);if (doi_def ==NULL )return -ENOENT ;
security/smack/Kconfig +0 -1
@@ -3,7 +3,6 @@ config SECURITY_SMACK bool "Simplified Mandatory Access Control Kernel Support" depends on NET depends on INET - depends on IPV4 depends on SECURITY select NETLABEL select SECURITY_NETWORK
Signature · 1 line
2.55.0
PATCH v3 16/16 ipv4: make CONFIG_IPV4 boolean
In reply to Fernando Fernandez ManceraChange CONFIG_IPV4 from hidden 'def_bool y' into an exposed boolean. This allows users to explicitly disable IPv4 via Kconfig to build IPv6-only. The default is kept at 'INET' to prevent breaking existing configurations.
---
Sashiko: the point of this is to provide a minimal build. There plenty of features that do not work without IPv4 for now. Follow-up patches will be sent to fix that in the future.
--- net/ipv4/Kconfig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
net/ipv4/Kconfig +9 -1
@@ -3,7 +3,15 @@ # IP configuration # config IPV4 - def_bool y + bool "The IPv4 protocol" if IPV6 + default INET + help + Support for IP version 4 (IPv4). + + Disabling this option compiles the kernel networking stack without + IPv4 support, resulting in a IPv6-only system. + + If unsure, say Y. config IP_MULTICAST bool "IP: multicasting"
Signature · 1 line
2.55.0
PATCH v3 12/16 netfilter: ipv4: guard ip_route_me_harder() with CONFIG_IPV4
In reply to Fernando Fernandez ManceraTo enable compiling the network stack without IPv4, IPv4 specific packet rerouting logic inside netfilter must be bypassed. Therefore, guard ip_route_me_harder() with IS_ENABLED(CONFIG_IPV4) so it returns -EPROTONOSUPPORT when IPv4 is disabled.
--- net/ipv4/netfilter.c | 3 +++ 1 file changed, 3 insertions(+)
net/ipv4/netfilter.c +3 -0
@@ -30,6 +30,9 @@ int ip_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb, unstruct flow_keys flkeys;unsigned int hh_len; +if (!IS_ENABLED (CONFIG_IPV4 )) +return -EPROTONOSUPPORT ; + sk =sk_to_full_sk (sk); flags = sk ?inet_sk_flowi_flags (sk) :0 ;
Signature · 1 line
2.55.0
PATCH v3 13/16 net: bridge: guard ARP/RARP proxy and suppression with CONFIG_IPV4
In reply to Fernando Fernandez ManceraHistorically, the bridge subsystem relied on CONFIG_INET to guard ARP and RARP proxy and suppression routines. As CONFIG_IPV4 is decoupled from the core stack and made optional, relying on CONFIG_INET is no longer accurate, as ARP and RARP are exclusively IPv4 protocols.
--- net/bridge/br_arp_nd_proxy.c | 2 ++ net/bridge/br_device.c | 2 +- net/bridge/br_input.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-)
net/bridge/br_arp_nd_proxy.c +2 -0
@@ -56,7 +56,9 @@ br_is_neigh_suppress_enabled_vid(const struct net_bridge_port *p, u16 vid)return br_is_neigh_suppress_enabled (p, v); } +#endif /* CONFIG_INET */ +#if IS_ENABLED (CONFIG_IPV4 ) static void br_arp_send(struct net_bridge *br, struct net_bridge_port *p, struct net_device *dev, __be32 dest_ip, __be32 src_ip, const unsigned char *dest_hw,
net/bridge/br_device.c +1 -1
@@ -69,7 +69,7 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) &state, &vlan)) goto out; -if (IS_ENABLED (CONFIG_INET ) && +if (IS_ENABLED (CONFIG_IPV4 ) && (eth_hdr (skb)->h_proto ==htons (ETH_P_ARP ) ||eth_hdr (skb)->h_proto ==htons (ETH_P_RARP )) &&br_opt_get (br,BROPT_NEIGH_SUPPRESS_ENABLED )) {
net/bridge/br_input.c +1 -1
@@ -166,7 +166,7 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skbBR_INPUT_SKB_CB (skb)->brdev = br->dev;BR_INPUT_SKB_CB (skb)->src_port_isolated =test_bit (BR_ISOLATED_BIT , &p->flags); -if (IS_ENABLED (CONFIG_INET ) && +if (IS_ENABLED (CONFIG_IPV4 ) && (skb->protocol ==htons (ETH_P_ARP ) || skb->protocol ==htons (ETH_P_RARP ))) {br_do_proxy_suppress_arp (skb, br, vid, p);
Signature · 1 line
2.55.0
PATCH v3 14/16 wifi: mac80211: replace CONFIG_INET with CONFIG_IPV4 guards
In reply to Fernando Fernandez ManceraHistorically, the mac80211 subsystem used CONFIG_INET to guard IPv4-specific address notifiers, assuming that if IP networking was enabled, IPv4 was guaranteed to be present. As part of the effort to make CONFIG_IPV4 optional, this assumption is no longer valid.
Update the conditional compilation guards around the IPv4 address change notifier and its associated registration routines to explicitly check for IS_ENABLED(CONFIG_IPV4). This ensures the mac80211 subsystem compiles successfully without undefined references when building an IPv6-only kernel.
--- net/mac80211/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/mac80211/main.c +5 -5
@@ -558,7 +558,7 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw) }EXPORT_SYMBOL (ieee80211_restart_hw); -#ifdef CONFIG_INET +#if IS_ENABLED (CONFIG_IPV4 )static int ieee80211_ifa_changed (struct notifier_block *nb,unsigned long data,void *arg) {
@@ -1655,7 +1655,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)wiphy_unlock (hw->wiphy);rtnl_unlock (); -#ifdef CONFIG_INET +#if IS_ENABLED (CONFIG_IPV4 ) local->ifa_notifier.notifier_call = ieee80211_ifa_changed; result =register_inetaddr_notifier (&local->ifa_notifier);if (result)
@@ -1673,11 +1673,11 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)#if IS_ENABLED (CONFIG_IPV6 ) fail_ifa6: -#ifdef CONFIG_INET +#if IS_ENABLED (CONFIG_IPV4 )unregister_inetaddr_notifier (&local->ifa_notifier);#endif #endif -#if defined(CONFIG_INET ) || defined(CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_IPV4 ) fail_ifa:#endif wiphy_unregister (local->hw.wiphy);
@@ -1705,7 +1705,7 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)tasklet_kill (&local->tx_pending_tasklet);tasklet_kill (&local->tasklet); -#ifdef CONFIG_INET +#if IS_ENABLED (CONFIG_IPV4 )unregister_inetaddr_notifier (&local->ifa_notifier);#endif #if IS_ENABLED (CONFIG_IPV6 )
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 01/16 net-next v3] ipv4: introduce CONFIG_IPV4 to decouple the IPv4 stack
In reply to Fernando Fernandez ManceraSashiko has reviewed this patch and found no issues. It looks great!
Quoted 10 lines
Historically, the IPv4 protocol has been linked to the core INET subsystem. Because shared infrastructure like the TCP/UDP engine, routing or INET hashtables live inside
net/ipv4/, it has been impossible to compile a kernel with only IPv6 support.This patch introduces the
CONFIG_IPV4Kconfigsymbol, which is set to 'def_booly' for now. This does not allow to completely disable the IPv4 stack yet but it lays the necessary build-system work for that goal.
Quoted 8 lines
In addition, multiple subsystems
Kconfigsymbols across networking features like tunnels, drivers and filesystems have been adjusted to depend on IPv4. Keep on mind that follow-up work is required to convert theKconfigsymbol to bool and remove the dependency on IPv4 where it makes sense.Acked-by Chuck Lever <[email protected]>Signed-off-by Fernando Fernandez Mancera <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
[email protected]
AI reviewRe: [PATCH 09/16 net-next v3] ipv4: fib: split common nexthop logic to fib_core.c
In reply to Fernando Fernandez ManceraThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] net: build failure due to missing IPv4 nexthop stubs --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] net: build failure due to missing IPv4 nexthop stubs
--
commit 37eb694c7118e7af349ed67aa655f6c7aa572300
Author: Fernando Fernandez Mancera <[email protected]>
ipv4: fib: split common nexthop logic to fib_core.c
To enable compiling INET subsystem without IPv4, shared FIB and nexthop logic must be accessible to IPv6 when IPv4 routing stack is omitted.
This patch creates fib_core.c and move all the functions for common nexthop initialization and release from fib_semantics.c to fib_core.c. Note that fib_core.c is under net/core.
Quoted 4 lines
include/net/ip_fib.h +0
-0
[ ... ]
Quoted 11 lines
include/net/ip_fib.h +3
-0@@ -578,10 +584,23 @@ void fib_select_multipath(struct fib_result *res, int hash,void fib_select_path (struct net *net,struct fib_result *res,struct flowi4 *fl4,const struct sk_buff *skb); +#if IS_ENABLED (CONFIG_IPV4 )int fib_nh_init (struct net *net,struct fib_nh *fib_nh,struct fib_config *cfg,int nh_weight,struct netlink_ext_ack *extack);void fib_nh_release (struct net *net,struct fib_nh *fib_nh); +#else +static inline int fib_nh_init(struct net *net, struct fib_nh *fib_nh,
include/net/ip_fib.h void fib_select_multipath(struct fib_result *res, int hash, · line 603
Quoted 10 lines
include/net/ip_fib.h +10
-0+ struct fib_config *cfg, int nh_weight, + struct netlink_ext_ack *extack) +{ + return -EAFNOSUPPORT; +} + +static inline void fib_nh_release (struct net *net,struct fib_nh *fib_nh) +{ +} +#endif
[Severity: Low]
When CONFIG_IPV4 is disabled, fib_check_nh() and fib_info_update_nhc_saddr() are missing fallbacks.
Because net/ipv4/nexthop.c is unconditionally built for CONFIG_INET, its nh_create_ipv4() function still references these functions, causing a build failure at link time:
net/ipv4/nexthop.c:nh_create_ipv4() {
...
/* sets nh_dev if successful */
err = fib_check_nh(net, fib_nh, tb_id, 0, extack);
if (!err) {
nh->nh_flags = fib_nh->fib_nh_flags;
fib_info_update_nhc_saddr(net, &fib_nh->nh_common,
!fib_nh->fib_nh_scope ? 0 : fib_nh->fib_nh_scope - 1);
...
}Should we add fallback stubs for these functions here in ip_fib.h, similar to fib_nh_init() and fib_nh_release(), when CONFIG_IPV4 is disabled?
Quoted 3 lines
include/net/ip_fib.h +0
-0int fib_nh_common_init(struct net *net, struct fib_nh_common *nhc, struct nlattr *fc_encap, u16 fc_encap_type, void *cfg, gfp_t gfp_flags,
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=9
[email protected]
AI reviewRe: [PATCH 15/16 net-next v3] netlabel: cipso: introduce CONFIG_CIPSO to decouple IPv4 dependency
In reply to Fernando Fernandez ManceraSashiko has reviewed this patch and found no issues. It looks great!
Quoted 11 lines
Currently, the Commercial IP Security Option (CIPSO) is unconditionally tied to
CONFIG_NETLABEL. Because CIPSO is inherently an IPv4 protocol feature, this creates a transitive dependency where subsystems relying on NetLabel (such as Smack) are forced to depend onCONFIG_IPV4, even if the user only wants to utilize IPv6/CALIPSO.This patch introduces a new
CONFIG_CIPSOboolean that is automatically enabled only when both NETLABEL and IPV4 are selected. It abstracts the CIPSO-specificMakefiletargets, sysctls, and kernel APIs behind this new config.
Quoted 6 lines
By safely stubbing out the CIPSO
netlabel_kapifunctions to return-ENOSYSwhen disabled, this allows NetLabel and Smack to be successfully built and used on IPv6-only kernels.Acked-by Paul Moore <[email protected]>Signed-off-by Fernando Fernandez Mancera <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=15
[email protected]
AI reviewRe: [PATCH 02/16 net-next v3] net: core: add IPv4 fallback stubs and guards for CONFIG_IPV4=n
In reply to Fernando Fernandez ManceraThank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider.
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 3
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [Medium] With CONFIG_IPV4=n, the new ip_setsockopt()/ip_getsockopt() stubs make every SOL_IP option return -EAFNOSUPPORT.
- [Medium] The patch adds if (!IS_ENABLED(CONFIG_IPV4)) return -EAFNOSUPPORT; at the top of dev_ifconf() (net/core/dev_ioctl.c).
- [Low] Baseline decision: false (not a real bug by the end of the series).
- [Low] The patch changes the INDIRECT_CALL_INET_1() gate in include/linux/indirect_call_wrapper.h from CONFIG_INET to CONFIG_IPV4.
- [Low] The CONFIG_IPV4=n stub of ip_route_output_flow() in include/net/route.h is a function definition with an unnamed first…
--
net: core: add IPv4 fallback stubs and guards for CONFIG_IPV4=n
This commit adds static inline stubs to include/net/ip.h and include/net/route.h for use when CONFIG_IPV4 is disabled. It also adds IS_ENABLED(CONFIG_IPV4) guards to generic networking code so that code links without IPv4. Finally, it gates the INDIRECT_CALL_INET() and INDIRECT_CALL_INET_1() helpers on CONFIG_IPV4 instead of CONFIG_INET.
Quoted 4 lines
include/linux/indirect_call_wrapper.h +0
-0
[ ... ]
include/linux/indirect_call_wrapper.h line 74
Quoted 5 lines
include/linux/indirect_call_wrapper.h +1
-1-#if IS_ENABLED (CONFIG_INET ) +#if IS_ENABLED (CONFIG_IPV4 )#define INDIRECT_CALL_INET_1 (f, f1, ...) INDIRECT_CALL_1(f, f1, __VA_ARGS__)#else #define INDIRECT_CALL_INET_1 (f, f1, ...) f(__VA_ARGS__)
[Severity: Low]
Does INDIRECT_CALL_INET_1() need to be gated on CONFIG_IPV4?
Every f1 passed to this macro is a TCP core function that is still built when IPV4=n: tcp_release_cb, tcp_leave_memory_pressure, tcp_stream_memory_free and tcp_bpf_bypass_getsockopt. tcpv6_prot uses all of them as well.
For example, release_sock() in net/core/sock.c has:
INDIRECT_CALL_INET_1(sk->sk_prot->release_cb, tcp_release_cb, sk);
Consider a CONFIG_IPV4=n, CONFIG_IPV6=y kernel with retpolines. There, release_sock(), sk_leave_memory_pressure(), sk_stream_memory_free() and BPF_CGROUP_RUN_PROG_GETSOCKOPT would make an indirect call instead of the direct tcp_* call.
INDIRECT_CALL_INET() above keeps an IPv6 fast path, but INDIRECT_CALL_INET_1() loses it. Could this macro stay gated on CONFIG_INET?
Quoted 4 lines
include/net/ip.h +0
-0
[ ... ]
Quoted 1 line
include/net/ip.h +0
-0@@ -225,27 +235,58 @@ int ip_append_data(struct sock *sk, struct flowi4 *fl4,
[ ... ]
include/net/ip.h int ip_append_data(struct sock *sk, struct flowi4 *fl4, · line 278
Quoted 4 lines
include/net/ip.h +4
-0+static inline struct sk_buff *ip_finish_skb (struct sock *sk,struct flowi4 *fl4) +{ +return ERR_PTR (-EAFNOSUPPORT ); +}
[Severity: Low]
The real ip_finish_skb() calls __ip_make_skb(), which only returns NULL or a valid skb. Its callers check only for NULL:
skb = ip_finish_skb(sk, fl4); if (!skb) goto out;
Later in the series, both callers, udp_push_pending_frames() and ip_push_pending_frames(), end up in objects that are built only with CONFIG_IPV4. udp_v6_push_pending_frames() also guards its call with IS_ENABLED(CONFIG_IPV4).
So this stub looks unreachable. At this commit CONFIG_IPV4 is still def_bool y, so the stub isn't compiled at all.
Should the stub return NULL to match the return contract of the real function?
[ ... ]
Quoted 1 line
include/net/ip.h +0
-0@@ -813,24 +854,60 @@ int ip_options_rcv_srr(struct sk_buff *skb, struct net_device *dev);
[ ... ]
include/net/ip.h int ip_options_rcv_srr(struct sk_buff *skb, struct net_device *dev); · line 902
Quoted 12 lines
include/net/ip.h +12
-0+static inline int ip_setsockopt (struct sock *sk,int level,int optname, +sockptr_t optval,unsigned int optlen) +{ +return -EAFNOSUPPORT ; +} + +static inline int ip_getsockopt (struct sock *sk,int level,int optname, +char __user *optval,int __user *optlen) +{ +return -EAFNOSUPPORT ; +} +#endif
[Severity: Medium]
With CONFIG_IPV4=n, do these stubs remove SOL_IP options that IPv6 sockets rely on?
ipv6_setsockopt() and ipv6_getsockopt() forward SOL_IP to these functions for AF_INET6 sockets:
net/ipv6/ipv6_sockglue.c:ipv6_setsockopt() {
...
if (level == SOL_IP && sk->sk_type != SOCK_RAW)
return ip_setsockopt(sk, level, optname, optval, optlen);
...
}MPTCP also calls ip_setsockopt() directly, from mptcp_setsockopt_sol_ip_set() and mptcp_setsockopt_v4_set_tos().
Some of these options work for any address family and have no SOL_IPV6 equivalent, such as IP_BIND_ADDRESS_NO_PORT and IP_LOCAL_PORT_RANGE. The only code that sets INET_FLAGS_BIND_ADDRESS_NO_PORT and the per-socket local_port_range is in ip_sockglue.c. By the end of the series that file is built only with CONFIG_IPV4. However, __inet6_bind() and the port range selection still read that state for IPv6 sockets.
On an IPv6-only kernel, this call would then fail with EAFNOSUPPORT:
setsockopt(fd6, SOL_IP, IP_BIND_ADDRESS_NO_PORT, ...)
The commit message says:
This behaves as IPv6 code does.
However, CONFIG_IPV6=n doesn't remove any options from IPv4 sockets. Is this loss of IPv6 socket functionality intended?
Quoted 8 lines
include/net/route.h +0
-0@@ -169,8 +169,16 @@ static inline struct rtable *__ip_route_output_key(struct net *net,return ip_route_output_key_hash (net, flp,NULL ); }
include/net/route.h static inline struct rtable *__ip_route_output_key(struct net *net, · line 181
Quoted 10 lines
include/net/route.h +8
-0+#if IS_ENABLED (CONFIG_IPV4 )struct rtable *ip_route_output_flow (struct net *,struct flowi4 *flp,const struct sock *sk); +#else +static inline struct rtable *ip_route_output_flow (struct net *,struct flowi4 *flp, +const struct sock *sk) +{ +return ERR_PTR (-EAFNOSUPPORT ); +} +#endif
[Severity: Low]
Will this stub build with all supported compilers once the later patch in the series makes CONFIG_IPV4=n selectable?
The stub is a function definition whose first parameter has no name. gnu11 doesn't allow that; only C23 does. GCC 8 through 10 reject it with "parameter name omitted", and Documentation/process/changes.rst lists GCC 8.1 as the minimum version. Clang warns that this is a C23 extension, which breaks CONFIG_WERROR builds.
Naming the parameter (struct net *net) would avoid this.
net/core/dev_ioctl.c int dev_ifconf(struct net *net, struct ifconf __user *uifc) · line 49
Quoted 11 lines
net/core/dev_ioctl.c +3
-0@@ -44,6 +44,9 @@ int dev_ifconf(struct net *net, struct ifconf __user *uifc)size_t size;int len, total =0 , done; +if (!IS_ENABLED (CONFIG_IPV4 )) +return -EAFNOSUPPORT ; +
[Severity: Medium]
Does this early return change SIOCGIFCONF behaviour on existing CONFIG_INET=n kernels?
CONFIG_IPV4 is only defined inside "if INET" in net/Kconfig. That means IS_ENABLED(CONFIG_IPV4) evaluates to 0 whenever CONFIG_INET=n.
Before this patch, those kernels used the !CONFIG_INET stub in include/linux/inetdevice.h:
static inline int inet_gifconf(struct net_device *dev, char __user *buf,
int len, int size)
{
return 0;
}So SIOCGIFCONF succeeded and returned ifc_len = 0.
sock_ioctl() passes SIOCGIFCONF to dev_ifconf() for any socket family, for example AF_UNIX, AF_PACKET or AF_NETLINK. On CONFIG_INET=n kernels the ioctl now fails with EAFNOSUPPORT. The inet_gifconf() stub also becomes unreachable.
Could the inet_gifconf() stub be gated on CONFIG_IPV4 instead, and this early return dropped? That would keep the existing result of success with an empty list.
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260930135334.4739-1-fmancera%40suse.de
[email protected]
AI reviewRe: [PATCH 03/16 net-next v3] net: inet: relocate ip_generic_getfrag and guard IPv4 socket logic
In reply to Fernando Fernandez ManceraThank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider.
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider.
Critical: 1 · High: 0 · Medium: 1 · Low: 3
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [Critical] This patch makes inet_init() skip inet4_init() when CONFIG_IPV4=n.
- [Medium] When CONFIG_IPV4=n, inet_gso_segment() now always returns ERR_PTR(-EPROTONOSUPPORT).
- [Low] The commit message does not describe the boot-time init restructuring, which changes behaviour on every kernel because…
- [Low] Baseline decision: false (resolved later in the series).
- [Low] Baseline decision: false (resolved later in the series).
--
net: inet: relocate ip_generic_getfrag and guard IPv4 socket logic
This patch moves ip_generic_getfrag() from ip_output.c to af_inet.c and adds CONFIG_IPV4 guards in af_inet.c for IPv4 ioctls, protocol registration, bind, release and GSO. It splits inet_init() into inet4_init() and inet4_late_init() so the IPv4-only parts can be skipped. It also rejects IPv4-mapped IPv6 addresses in __inet6_bind() and __ip6_datagram_connect() when IPv4 is disabled.
Quoted 4 lines
net/ipv4/af_inet.c +0
-0
[ ... ]
net/ipv4/af_inet.c struct sk_buff *inet_gso_segment(struct sk_buff *skb, · line 1420
Quoted 10 lines
net/ipv4/af_inet.c +3
-0@@ -1371,6 +1412,9 @@ struct sk_buff *inet_gso_segment(struct sk_buff *skb,int ihl;int id; +if (!IS_ENABLED (CONFIG_IPV4 )) +return ERR_PTR (-EPROTONOSUPPORT ); +skb_reset_network_header (skb); nhoff =skb_network_header (skb) -skb_mac_header (skb);if (unlikely (!pskb_may_pull (skb,sizeof (*iph))))
[Severity: Medium]
With CONFIG_IPV4=n, this rejects all IPv4 GSO. However, ipv4_offload_init() still registers the IPv4 GRO callbacks without any guard:
net_hotdata.ip_packet_offload = (struct packet_offload) {
.type = cpu_to_be16(ETH_P_IP),
.callbacks = {
.gso_segment = inet_gso_segment,
.gro_receive = inet_gro_receive,
.gro_complete = inet_gro_complete,
},
};An IPv6-only kernel can still forward IPv4 frames at L2, for example through a bridge, OVS, tc redirect, VXLAN/Geneve over an IPv6 underlay, or ip4ip6 via ip4ip6_gso_segment(). In that case IPv4 TCP/UDP traffic still gets GRO-merged. TSO skbs from tap, virtio and packet sockets are also still accepted.
If the egress device needs software GSO, are these packets dropped?
validate_xmit_skb()
skb_gso_segment()
skb_mac_gso_segment()
inet_gso_segment()
return ERR_PTR(-EPROTONOSUPPORT);The guard seems to be needed only because ip_send_check() is out of line in ip_output.c. Would moving ip_send_check() into shared code avoid this?
This is still present at the end of the series. The commit message also doesn't mention the GSO change.
[ ... ]
Quoted 5 lines
net/ipv4/af_inet.c +1
-0@@ -1959,6 +2001,45 @@ static int __init inet_init(void)ip_init (); +return 0 ;
[ ... ]
net/ipv4/af_inet.c static int __init inet_init(void) · line 2042
Quoted 12 lines
net/ipv4/af_inet.c +12
-0+static int __init inet_init (void ) +{ +int rc; + +sock_skb_cb_check_size (sizeof (struct inet_skb_parm )); + +if (IS_ENABLED (CONFIG_IPV4 )) { + rc =inet4_init (); +if (rc) +return rc; + } +
[Severity: Critical]
With CONFIG_IPV4=n, is the inet_peer slab cache ever created?
The only way to reach ip_init() is through inet4_init(). ip_init() is also the only caller of inet_initpeers():
net/ipv4/ip_output.c:ip_init() {
ip_rt_init();
inet_initpeers();
...
}inet_initpeers() is the only place that sets peer_cachep:
net/ipv4/inetpeer.c:inet_initpeers() {
...
peer_cachep = KMEM_CACHE(inet_peer, SLAB_HWCACHE_ALIGN | SLAB_PANIC);
}inetpeer.o is built as obj-y and IPv6 still uses it. For example, a remote host that sends a UDP datagram to a closed IPv6 port ends up here:
icmpv6_send()
icmp6_send()
icmpv6_xrlim_allow()
inet_getpeer_v6(net->ipv6.peers, &fl6->daddr)
inet_getpeer()
kmem_cache_alloc(peer_cachep, GFP_ATOMIC)On a lookup miss, peer_cachep is NULL at this point. Would that cause a NULL pointer dereference in softirq context?
ip6_forward() redirect handling and ndisc_send_redirect() reach the same allocation through inet_getpeer_v6().
CONFIG_IPV4 is still def_bool y at this commit. The problem remains at the end of the series, where the final patch makes CONFIG_IPV4 selectable. Should inet_initpeers() be moved out of the IPv4-only init path?
Quoted 15 lines
net/ipv4/af_inet.c +0
-8/* Initialise per-cpu ipv4 mibs */ if (init_ipv4_mibs ())panic ("%s: Cannot init ipv4 mibs\n" , __func__);@@ -1980,35 +2061,20 @@ static int __init inet_init(void)if (icmp_init () <0 )panic ("Failed to create the ICMP control socket.\n" ); -/* -* Initialise the multicast router -*/ -#if defined(CONFIG_IP_MROUTE ) -if (ip_mr_init ()) -pr_crit ("%s: Cannot init ipv4 mroute\n" , __func__); -#endif -
net/ipv4/af_inet.c static int __init inet_init(void) · line 2070
Quoted 10 lines
net/ipv4/af_inet.c +4
-3if (init_inet_pernet_ops ())pr_crit ("%s: Cannot init ipv4 inet pernet ops\n" , __func__); -ipv4_proc_init (); - -ipfrag_init (); +#ifdef CONFIG_PROC_FS +if (ip_misc_proc_init ()) +pr_crit ("%s: Cannot init ipv4 misc proc\n" , __func__); +#endif
[Severity: Low]
ip_misc_proc_init() now runs even when CONFIG_IPV4=n. In that configuration, net->ipv4.fqdir (set up through ipfrag_init()) and net->ipv4.devconf_all (set up by devinet) are never initialized.
Would reading /proc/net/sockstat or /proc/net/snmp make sockstat_seq_show() or snmp_seq_show_ipstats() dereference NULL?
This looks resolved later in the series. The patch "tcp: move protocol agnostic TCP functions out of tcp_ipv4.c" wraps two things in IS_ENABLED(CONFIG_IPV4):
- the FRAG line in sockstat_seq_show()
- the snmp_seq_show_ipstats(), icmp_put() and icmpmsg_put() calls in snmp_seq_show()
netstat_seq_show() only reads net->mib counters, which init_ipv4_mibs() always allocates. Since CONFIG_IPV4 is def_bool y at this commit, the intermediate state can't be reached.
Quoted 5 lines
net/ipv4/af_inet.c +2
-1-dev_add_pack (&ip_packet_type); +if (IS_ENABLED (CONFIG_IPV4 )) +inet4_late_init ();
[ ... ]
net/ipv4/af_inet.c static int __init ipv4_proc_init(void) · line 2101
Quoted 13 lines
net/ipv4/af_inet.c +0
-4@@ -2028,12 +2094,8 @@ static int __init ipv4_proc_init(void) goto out_udp;if (ping_proc_init ()) goto out_ping; -if (ip_misc_proc_init ()) - goto out_misc; out:return rc; -out_misc: -ping_proc_exit (); out_ping:udp4_proc_exit (); out_udp:
[Severity: Low]
This isn't a bug, but the commit message doesn't describe the init restructuring. That restructuring changes behaviour on default kernels, since CONFIG_IPV4 is def_bool y at this commit.
ip_mr_init() calls register_pernet_subsys(&ipmr_net_ops). It now runs after init_inet_pernet_ops() and ip_misc_proc_init() instead of before them. This changes the pernet init order and the reverse exit order.
ip_misc_proc_init() has also moved out of ipv4_proc_init():
- it now runs before the raw, tcp4, udp4 and ping proc registrations
- it runs even if those registrations fail
- if it fails, it only prints pr_crit() and no longer unwinds the ping, udp4, tcp4 and raw proc entries
The message also doesn't mention the new guards in inet_gso_segment(), around ip_mc_drop_socket() in inet_release(), and in inet_sk_reselect_saddr().
There is also a typo in the commit message:
This patch moves the generic ip_generec_getfrag() from ip_output.c to af_inet.c.
ip_generec_getfrag() should be ip_generic_getfrag().
Could the commit message be updated to cover these changes?
[ ... ]
Quoted 4 lines
net/ipv6/datagram.c +0
-0
[ ... ]
net/ipv6/datagram.c int __ip6_datagram_connect(struct sock *sk, struct sockaddr_unsized *uaddr, · line 192
Quoted 9 lines
net/ipv6/datagram.c +1
-1@@ -186,7 +186,7 @@ int __ip6_datagram_connect(struct sock *sk, struct sockaddr_unsized *uaddr,if (addr_type &IPV6_ADDR_MAPPED ) {struct sockaddr_in sin; -if (ipv6_only_sock (sk)) { +if (!IS_ENABLED (CONFIG_IPV4 ) ||ipv6_only_sock (sk)) { err = -ENETUNREACH ; goto out; }
[Severity: Low]
The v4-mapped rejection here and in __inet6_bind() doesn't cover tcp_v6_connect()->tcp_v4_connect() or udpv6_sendmsg()->udp_sendmsg(). With CONFIG_IPV4=n, can those paths still be reached at this commit?
This looks handled later in the series. "tcp: move protocol agnostic TCP functions out of tcp_ipv4.c" adds this to tcp_v6_connect():
if (!IS_ENABLED(CONFIG_IPV4) || ipv6_only_sock(sk)) return -ENETUNREACH;
The same patch also guards tcp_v6_conn_request(), tcp_v6_syn_recv_sock() and tcp_v6_do_rcv().
The UDP split later in the series guards the v4-mapped paths in udpv6_sendmsg(), udp_v6_push_pending_frames() and udp6_hash4(). CONFIG_IPV4 can't be disabled until the final patch, so no intermediate state is affected.
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260930135334.4739-1-fmancera%40suse.de
[email protected]
AI reviewRe: [PATCH 04/16 net-next v3] tcp: move protocol agnostic TCP functions out of tcp_ipv4.c
In reply to Fernando Fernandez ManceraThank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you…
Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message understates the user-visible changes.
- [Low] union bpf_tcp_iter_batch_item and struct bpf_tcp_iter_state were file-local in tcp_ipv4.c and are now moved into the widely included…
Pre-existing issues:
- [Medium] This problem wasn't introduced by this patch, but the relocated TCP BPF iterator can call vfree() while holding a plain…
--
tcp: move protocol agnostic TCP functions out of tcp_ipv4.c
This moves the protocol agnostic TCP code (proc and BPF iterators, tcp_twsk_unique(), tcp_add_backlog(), the pernet ops and more) from tcp_ipv4.c into tcp.c, so it still builds with CONFIG_IPV4=n. It also renames tcp_v4_destroy_sock() to tcp_destroy_sock() and guards the IPv4-mapped paths in tcp_ipv6.c. Finally, it changes the /proc/net/sockstat and /proc/net/snmp output for IPv4-less builds.
Quoted 8 lines
In addition, guard IPv4 code around IPv6 TCP implementation. This ensures that IPv4-mapped IPv6 sockects are rejected with a proper error code when IPv4 stack is disabled.
Please note that this commit also addresses how
/proc/net/sockstatoutput is handled for all protocols. The implementation now force the inuse attrtibute to be zero whenCONFIG_IPV4=nbut the shared stats are represented correctly.
[Severity: Low]
Is this description complete? sockstat_seq_show() zeroes the TCP, UDP and RAW inuse counters, but it drops the FRAG: line entirely instead of zeroing it:
if (IS_ENABLED(CONFIG_IPV4))
seq_printf(seq, "FRAG: inuse %u memory %lu\n",
...
/proc/net/snmp changes too, and the message doesn't mention it:
- snmp_seq_show() leaves out the Ip:, Icmp: and IcmpMsg: sections.
- snmp_seq_show_tcp_udp() gains a first argument, so the output starts with "Tcp:" instead of "\nTcp:".
These output formats only show up in CONFIG_IPV4=n builds. Those become selectable in the later commit "ipv4: make CONFIG_IPV4 boolean", so IPv6-only kernels would see procfs format changes that aren't documented.
Some structural changes are not mentioned either:
- register_pernet_subsys(&tcp_sk_ops) and bpf_iter_register() move from tcp_v4_init() into tcp_init(), where they now run unconditionally.
- tcp_bpf_v4_build_proto() is now gated on CONFIG_IPV4.
- struct bpf_tcp_iter_state and union bpf_tcp_iter_batch_item move into include/net/tcp.h.
About "rejected with a proper error code": only tcp_v6_connect() returns an error (-ENETUNREACH). The other guards return no error to anyone:
- tcp_v6_conn_request() does goto drop.
- tcp_v6_syn_recv_sock() returns NULL.
- tcp_v6_do_rcv() calls kfree_skb() and returns 0.
These guards seem to be there to avoid references to IPv4 symbols on paths that can't run once IPv4 is compiled out.
Could the commit message describe these changes more precisely?
Quoted 4 lines
include/net/tcp.h +0
-0
[ ... ]
Quoted 8 lines
include/net/tcp.h +4
-0@@ -2855,6 +2855,20 @@ struct sk_psock; #ifdef CONFIG_BPF_SYSCALL int tcp_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore); void tcp_bpf_clone(const struct sock *sk, struct sock *newsk); + +union bpf_tcp_iter_batch_item { + struct sock *sk; + __u64 cookie;
include/net/tcp.h struct sk_psock; · line 2871
Quoted 10 lines
include/net/tcp.h +10
-0+}; + +struct bpf_tcp_iter_state { +struct tcp_iter_state state; +unsigned int cur_sk; +unsigned int end_sk; +unsigned int max_sk; +union bpf_tcp_iter_batch_item *batch; +}; +
[Severity: Low]
Do these definitions need to go into include/net/tcp.h?
After this patch, and still at the end of the series, net/ipv4/tcp.c is the only user of union bpf_tcp_iter_batch_item and struct bpf_tcp_iter_state. All of the BPF TCP iterator code now lives there, so both types could stay file-local in tcp.c. That would keep iterator internals out of a widely included header.
Quoted 3 lines
include/net/tcp.h +0
-0#ifdef CONFIG_BPF_STREAM_PARSER struct strparser ; int tcp_bpf_strp_read_sock(struct strparser *strp, read_descriptor_t *desc,
[ ... ]
Quoted 4 lines
net/ipv4/tcp.c +0
-0
[ ... ]
Quoted 1 line
net/ipv4/tcp.c +0
-0@@ -1458,6 +1464,1115 @@ int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
[ ... ]
Quoted 17 lines
net/ipv4/tcp.c +17
-0+static int bpf_iter_tcp_realloc_batch (struct bpf_tcp_iter_state *iter, +unsigned int new_batch_sz,gfp_t flags) +{ +union bpf_tcp_iter_batch_item *new_batch; + + new_batch =kvmalloc_objs (*new_batch, new_batch_sz, + flags | __GFP_NOWARN); +if (!new_batch) +return -ENOMEM ; + +memcpy (new_batch, iter->batch,sizeof (*iter->batch) * iter->end_sk); +kvfree (iter->batch); + iter->batch = new_batch; + iter->max_sk = new_batch_sz; + +return 0 ; +}
[ ... ]
Quoted 14 lines
net/ipv4/tcp.c +14
-0+/* Batch size was too small. */ +bpf_iter_tcp_unlock_bucket (seq); +bpf_iter_tcp_put_batch (iter); + err =bpf_iter_tcp_realloc_batch (iter, expected *3 /2 , +GFP_USER ); +if (err) { + iter->cur_sk =0 ; + iter->end_sk =0 ; +return ERR_PTR (err); + } + + sk =bpf_iter_tcp_resume (seq); +if (!sk) +return NULL ;/* Done */
net/ipv4/tcp.c int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) · line 2024
Quoted 10 lines
net/ipv4/tcp.c +10
-0+ + expected =bpf_iter_fill_batch (seq, &sk); +if (likely (!sk)) + goto done; + +/* Batch size was still too small. Hold onto the lock while we try +* again with a larger batch to make sure the current bucket's size +* does not change in the meantime. +*/ + err =bpf_iter_tcp_realloc_batch (iter, expected,GFP_NOWAIT );
[Severity: Medium]
This is a pre-existing issue, not one introduced by this patch; the same code is already in tcp_ipv4.c. Since it is being moved anyway: can this call vfree() while a plain spinlock is held?
The first reallocation uses GFP_USER with the bucket unlocked. For more than about 512 entries the size exceeds PAGE_SIZE. kvmalloc() then tries kmalloc() with __GFP_NORETRY and can fall back to vmalloc(), so iter->batch may end up vmalloc-backed.
In the listening state, bpf_iter_tcp_resume() retakes the bucket lock in listening_get_first() with a plain spin_lock:
spin_lock(&ilb2->lock);
Concurrent listen() calls may have grown the bucket past the new capacity in the meantime. If so, this GFP_NOWAIT reallocation runs with the lock held, and on success:
bpf_iter_tcp_realloc_batch()
kvfree(iter->batch)
vfree()vfree() only defers when in_interrupt() is true:
if (unlikely(in_interrupt())) {
vfree_atomic(addr);
return;
}
...
might_sleep();This runs in process context under a plain spin_lock with BH enabled, so in_interrupt() is false. vfree() would then call might_sleep() and tear down the area synchronously while ilb2->lock is held. GFP_NOWAIT only limits the new allocation, not the freeing of the old buffer. The established case uses spin_lock_bh(), so vfree_atomic() is used there.
With CONFIG_DEBUG_ATOMIC_SLEEP this would give a "sleeping function called from invalid context" splat.
Would it make sense to free the old batch only after the bucket has been unlocked?
Quoted 4 lines
net/ipv4/tcp.c +4
-0+if (err) { +bpf_iter_tcp_unlock_bucket (seq); +return ERR_PTR (err); + }
[ ... ]
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260930135334.4739-1-fmancera%40suse.de
[email protected]
AI reviewRe: [PATCH 05/16 net-next v3] ipv4: raw: split IPv4 specific logic into raw_ipv4.c
In reply to Fernando Fernandez ManceraThank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you…
Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The IPv4-only struct raw_frag_vec is left behind in net/ipv4/raw.c (line 72) and a second, identical copy is added in…
- [Low] The new file net/ipv4/raw_ipv4.c uses EXPORT_SYMBOL_GPL(raw_v4_match); at line 61 but does not include…
--
ipv4: raw: split IPv4 specific logic into raw_ipv4.c
This commit moves the IPv4-specific RAW socket code (packet matching, input/output processing, ICMP filtering and the AF_INET raw_prot) from net/ipv4/raw.c into a new net/ipv4/raw_ipv4.c. The new file is built only when CONFIG_IPV4 is enabled. raw_diag.c now wraps raw_v4_match() in an IS_ENABLED(CONFIG_IPV4) check.
Quoted 6 lines
net/ipv4/raw_ipv4.c new file +0
-0@@ -0,0 +1,884 @@
[ ... ]
Quoted 13 lines
net/ipv4/raw_ipv4.c new file +13
-0+#include <asm/ioctls.h> +#include <linux/igmp.h> +#include <linux/mroute.h> +#include <linux/netfilter.h> +#include <linux/sockios.h> +#include <linux/stddef.h> +#include <linux/types.h> +#include <linux/compat.h> +#include <net/icmp.h> +#include <net/ip.h> +#include <net/raw.h> +#include <net/sock.h> +#include <net/udp.h>
net/ipv4/raw_ipv4.c line 39
Quoted 10 lines
net/ipv4/raw_ipv4.c new file +10
-0+#include <net/xfrm.h> + +struct raw_frag_vec { +struct msghdr *msg; +union { +struct icmphdr icmph; +char c[1 ]; + } hdr; +int hlen; +};
[Severity: Low]
This isn't a bug, but should the original copy of struct raw_frag_vec be removed from net/ipv4/raw.c? After this patch, raw.c still contains:
net/ipv4/raw.c:
struct raw_frag_vec {
struct msghdr *msg;
union {
struct icmphdr icmph;
char c[1];
} hdr;
int hlen;
};All of its users (raw_probe_proto_opt(), raw_getfrag() and raw_sendmsg()) are now in raw_ipv4.c, so nothing in raw.c uses it.
Can the raw.c copy be dropped as part of the move? That would leave a single definition of this IPv4-only structure.
Quoted 4 lines
net/ipv4/raw_ipv4.c new file +4
-0+ +bool raw_v4_match (struct net *net,const struct sock *sk,unsigned short num, +__be32 raddr,__be32 laddr,int dif,int sdif) +{
[ ... ]
net/ipv4/raw_ipv4.c line 61
Quoted 4 lines
net/ipv4/raw_ipv4.c new file +4
-0+return raw_sk_bound_dev_eq (net,READ_ONCE (sk->sk_bound_dev_if), + dif, sdif); +} +EXPORT_SYMBOL_GPL (raw_v4_match);
[Severity: Low]
Should raw_ipv4.c include <linux/export.h>? It uses EXPORT_SYMBOL_GPL(raw_v4_match), but <linux/export.h> is not in its include list. raw.c includes that header directly for EXPORT_SYMBOL_GPL(raw_v4_hashinfo).
With W=2, check_missing_include_linux_export_h() in scripts/misc-check would warn:
net/ipv4/raw_ipv4.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
The file still compiles, because the header is pulled in indirectly.
[ ... ]
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260930135334.4739-1-fmancera%40suse.de
[email protected]
AI reviewRe: [PATCH 06/16 net-next v3] ipv4: udp: split IPv4 specific logic into udp_ipv4.c
In reply to Fernando Fernandez ManceraThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [Medium] When CONFIG_IPV4=n, udp4_gro_complete() (net/ipv4/udp_offload.c) returns -EAFNOSUPPORT for every merged IPv4…
--
ipv4: udp: split IPv4 specific logic into udp_ipv4.c
This commit moves the IPv4-specific UDP socket code out of udp.c and into a new file, udp_ipv4.c. That covers lookup, input/output, multicast delivery and the AF_INET udp_prot. The new file is built only when CONFIG_IPV4 is enabled. Callers in af_inet.c, udp_bpf.c, udp_offload.c and ipv6/udp.c get IS_ENABLED(CONFIG_IPV4) guards.
net/ipv4/udp_offload.c INDIRECT_CALLABLE_SCOPE int udp4_gro_complete(struct sk_buff *skb, int nhoff) · line 963
Quoted 11 lines
net/ipv4/udp_offload.c +3
-0@@ -958,6 +958,9 @@ INDIRECT_CALLABLE_SCOPE int udp4_gro_complete(struct sk_buff *skb, int nhoff)const struct iphdr *iph = (struct iphdr *)(skb->data + offset);struct udphdr *uh = (struct udphdr *)(skb->data + nhoff); +if (!IS_ENABLED (CONFIG_IPV4 )) +return -EAFNOSUPPORT ; +
[Severity: Medium]
With CONFIG_IPV4=n, can this make every merged IPv4 UDP GRO packet get dropped silently?
The IPv4 GRO offloads are still registered when IPv4 is disabled. ipv4_offload_init() in af_inet.c still calls udpv4_offload_init() and dev_add_offload(&net_hotdata.ip_packet_offload) with no guard. So inet_gro_receive()->udp4_gro_receive()->udp_gro_receive() still runs for IPv4 UDP packets.
The socket lookup there ends up in the new __udp4_lib_lookup() stub, which returns NULL. Even so, udp_gro_receive() still aggregates:
if (skb->dev->features & NETIF_F_GRO_FRAGLIST) NAPI_GRO_CB(skb)->is_flist = sk ? !udp_test_bit(GRO_ENABLED, sk) : 1; if ((!sk && (skb->dev->features & NETIF_F_GRO_UDP_FWD)) || (sk && udp_test_bit(GRO_ENABLED, sk)) || NAPI_GRO_CB(skb)->is_flist) return call_gro_receive(udp_gro_receive_segment, head, skb);
At flush time, gro_complete()->inet_gro_complete()->udp4_gro_complete() now returns -EAFNOSUPPORT, and gro_complete() in net/core/gro.c frees the whole aggregate:
if (err) {
WARN_ON(&ptype->list == head);
kfree_skb(skb);
return;
}The WARN_ON doesn't fire because a ptype was found, so all segments are lost with no warning. This would affect an IPv6-only kernel that bridges or forwards IPv4 UDP with NETIF_F_GRO_UDP_FWD or NETIF_F_GRO_FRAGLIST enabled on the ingress device. Inner IPv4 carried in IPv6 tunnels would be hit too.
The fraglist branch and the udp_gro_complete() path don't need IPv4 socket state. The only IPv4-only dependency looks like the udp4_lib_lookup_skb reference. Would it work to stub or skip only the lookup, for example with a NULL-returning udp4_lib_lookup_skb when CONFIG_IPV4=n, and keep the rest of udp4_gro_complete()? Or should IPv4 UDP GRO receive also be disabled in that configuration, so packets aren't aggregated only to be dropped at completion?
The later patch in the series, "ipv4: make CONFIG_IPV4 boolean", makes this configuration selectable. udp4_gro_complete() and ipv4_offload_init() are unchanged at the end of the series.
Quoted 3 lines
net/ipv4/udp_offload.c +0
-0/* do fraglist only if there is no outer UDP encap (or we already processed it) */ if (NAPI_GRO_CB (skb)->is_flist && !NAPI_GRO_CB (skb)->encap_mark) {udp_set_len (uh, skb->len - nhoff);
[ ... ]
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260930135334.4739-1-fmancera%40suse.de
[email protected]
AI reviewRe: [PATCH 07/16 net-next v3] ipv4: icmp: split IPv4 specific logic into icmp_ipv4.c
In reply to Fernando Fernandez ManceraThank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you…
Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The boot-only per-CPU ICMP control-socket setup loop used to be inside int __init icmp_init(void).
--
ipv4: icmp: split IPv4 specific logic into icmp_ipv4.c
This commit moves the IPv4 specific ICMP code from net/ipv4/icmp.c into a new file, net/ipv4/icmp_ipv4.c. That code covers packet processing, error handling and the per-CPU control socket setup. The new file is built only when CONFIG_IPV4 is enabled, while icmp.c is now always built.
Quoted 4 lines
net/ipv4/icmp.c +0
-0
[ ... ]
Quoted 16 lines
net/ipv4/icmp.c +3
-7@@ -1757,28 +366,11 @@ static struct pernet_operations __net_initdata icmp_sk_ops = {int __init icmp_init (void ) { -int err, i; - -for_each_possible_cpu (i) { -struct sock *sk; +if (IS_ENABLED (CONFIG_IPV4 )) { +int err =icmp_init_ipv4 (); - err =inet_ctl_sock_create (&sk,PF_INET , -SOCK_RAW ,IPPROTO_ICMP , &init_net); -if (err <0 ) +if (err)return err;
[ ... ]
Quoted 5 lines
net/ipv4/icmp_ipv4.c new file +0
-0
[ ... ]
net/ipv4/icmp_ipv4.c line 1433
Quoted 13 lines
net/ipv4/icmp_ipv4.c new file +13
-0+int icmp_init_ipv4 (void ) +{ +int err, i; + +for_each_possible_cpu (i) { +struct sock *sk; + + err =inet_ctl_sock_create (&sk,PF_INET , +SOCK_RAW ,IPPROTO_ICMP , &init_net); +if (err <0 ) +return err; + +per_cpu (ipv4_icmp_sk, i) = sk;
[Severity: Low]
This loop used to run inside the __init icmp_init(). The new icmp_init_ipv4() has no __init annotation, but its only caller is still icmp_init(). So this code is no longer freed after boot.
Should icmp_init_ipv4() be marked __init, both here and on its prototype in include/net/icmp.h?
The prototype also sits in the public header next to the normal ICMP entry points, which makes a boot-only helper look like a general API. If something called it a second time, it would overwrite the per-CPU ipv4_icmp_sk pointers and leak the old sockets. No such caller exists today.
The annotation also appears to be missing at the end of the series.
[ ... ]
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260930135334.4739-1-fmancera%40suse.de
[email protected]
AI reviewRe: [PATCH 09/16 net-next v3] ipv4: fib: split common nexthop logic to fib_core.c
In reply to Fernando Fernandez ManceraThank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you…
Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] net/core/Makefile adds fib_core.o to the unconditional obj-y list next to fib_notifier.o, so it is built into every CONFIG_NET kernel,…
- [Low] The patch rewrote the section comment in include/net/ip_fib.h from "/* Exported by fib_frontend.c */" to "/* Exported by…
--
ipv4: fib: split common nexthop logic to fib_core.c
This moves the shared nexthop init/release helpers, fib_nexthop_info(), fib_add_nexthop(), rtm_ipv4_policy and ip_valid_fib_dump_req() out of net/ipv4 into a new net/core/fib_core.c. The goal is to let IPv6 use them without the IPv4 routing stack. It also adds CONFIG_IPV4=n stubs for several FIB helpers in ip_fib.h and route.h.
Quoted 4 lines
include/net/ip_fib.h +0
-0
[ ... ]
include/net/ip_fib.h static inline bool fib_dscp_masked_match(dscp_t dscp, const struct flowi4 *fl4) · line 454
Quoted 9 lines
include/net/ip_fib.h +1
-1@@ -442,7 +448,7 @@ static inline bool fib_dscp_masked_match(dscp_t dscp, const struct flowi4 *fl4)return dscp == (fl4->flowi4_dscp &INET_DSCP_LEGACY_TOS_MASK ); } -/* Exported by fib_frontend.c */ +/* Exported by net/core/fib_core.c */ extern const struct nla_policy rtm_ipv4_policy[];void ip_fib_init (void ); int fib_gw_from_via(struct fib_config *cfg, struct nlattr *nla,
[Severity: Low]
Does this heading still describe the whole block? Only rtm_ipv4_policy moved to fib_core.c. The other declarations under it are still defined in net/ipv4/fib_frontend.c:
ip_fib_init()
fib_gw_from_via()
fib_compute_spec_dst()
fib_info_nh_uses_dev()
fib_validate_source()
fib_unmerge()
The reverse happens further down in the same header. fib_nh_common_init() and fib_nh_common_release() are now defined in net/core/fib_core.c, but their declarations are still under the older heading:
/* Exported by fib_semantics.c */
...
int fib_nh_common_init(struct net *net, struct fib_nh_common *nhc,
...
void fib_nh_common_release(struct fib_nh_common *nhc);
Could rtm_ipv4_policy get its own fib_core.c heading, with the fib_nh_common_* declarations moved under it? As written, ip_fib_init() or fib_validate_source() could look available when CONFIG_IPV4=n. The headings are still like this at the end of the series.
[ ... ]
net/core/Makefile obj-$(CONFIG_SYSCTL) += sysctl_net_core.o · line 16
Quoted 11 lines
net/core/Makefile +1
-1@@ -12,7 +12,7 @@ obj-$(CONFIG_SYSCTL) += sysctl_net_core.o obj-y += dev.o dev_api.o dev_addr_lists.o dst.o netevent.o \ neighbour.o rtnetlink.o utils.o link_watch.o filter.o \ sock_diag.o dev_ioctl.o tso.o sock_reuseport.o \ - fib_notifier.o xdp.o flow_offload.o gro.o \ + fib_notifier.o fib_core.o xdp.o flow_offload.o gro.o \ netdev-genl.o netdev-genl-gen.o netdev_work.o gso.o
[Severity: Low]
Should fib_core.o be gated on CONFIG_INET? As written, it is built into every CONFIG_NET kernel, including CONFIG_INET=n ones.
Everything in fib_core.c is INET specific. That covers the fnhe and rtable cache teardown, rtm_ipv4_policy, ip_valid_fib_dump_req(), fib_nexthop_info() and fib_add_nexthop(). The callers are in net/ipv4 and net/ipv6, and both of those need INET.
The only caller outside INET is net/mpls/af_mpls.c, and it already skips ip_valid_fib_dump_req() when INET is off:
#if IS_ENABLED(CONFIG_INET)
static int mpls_valid_fib_dump_req(...)
{
return ip_valid_fib_dump_req(net, nlh, filter, cb);
}#else
So on !INET kernels this is unused code plus an unused EXPORT_SYMBOL_GPL(ip_valid_fib_dump_req). The same Makefile already gates an INET-only object this way:
ifdef CONFIG_INET
obj-$(CONFIG_BPF_SYSCALL) += bpf_ksock.o
endif
This does not break the !INET build today. The rule is still unconditional at the end of the series.
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260930135334.4739-1-fmancera%40suse.de
[email protected]
AI reviewRe: [PATCH 11/16 net-next v3] ipv4: disable IPv4-only sysctls when CONFIG_IPV4=n
In reply to Fernando Fernandez ManceraThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [Medium] The patch moves the net.ipv4.fib_multipath_hash_seed entry of ipv4_net_table (net/ipv4/sysctl_net_ipv4.c, lines 1644-1650) inside…
--
ipv4: disable IPv4-only sysctls when CONFIG_IPV4=n
This commit moves the IPv4-specific entries of ipv4_net_table into a new IS_ENABLED(CONFIG_IPV4) block at the end of the table. Those sysctls are then not registered on kernels built without IPv4. Handlers and min/max variables used only by those entries are marked __maybe_unused.
Quoted 4 lines
net/ipv4/sysctl_net_ipv4.c +0
-0
[ ... ]
Quoted 5 lines
net/ipv4/sysctl_net_ipv4.c +1
-0@@ -1656,6 +1469,196 @@ static const struct ctl_table ipv4_net_table[] = { .extra1 = SYSCTL_ONE_THOUSAND, .extra2 = &tcp_rto_max_max, }, +#if IS_ENABLED (CONFIG_IPV4 )
[ ... ]
Quoted 1 line
+#ifdef
CONFIG_IP_ROUTE_MULTIPATH
[ ... ]
net/ipv4/sysctl_net_ipv4.c static const struct ctl_table ipv4_net_table[] = { · line 1651
Quoted 8 lines
net/ipv4/sysctl_net_ipv4.c +8
-0+ { + .procname = "fib_multipath_hash_seed", + .data = &init_net, + .maxlen = sizeof(u32), + .mode = 0644, + .proc_handler = proc_fib_multipath_hash_seed, + }, +#endif
[Severity: Medium]
Is fib_multipath_hash_seed really IPv4-only? The commit message says it hides "the sysctls that are related to IPv4 only". However, the IPv6 datapath also uses this seed.
The shared helper in include/net/ip_fib.h is built whenever CONFIG_IP_ROUTE_MULTIPATH is set:
include/net/ip_fib.h:fib_multipath_hash_from_keys() {
...
mp_seed = READ_ONCE(net->ipv4.sysctl_fib_multipath_hash_seed.mp_seed);
fib_multipath_hash_construct_key(&hash_key, mp_seed);
...
}IPv6 ECMP reaches it through rt6_multipath_hash() and its custom hash helpers in net/ipv6/route.c:
rt6_multipath_hash()->fib_multipath_hash_from_keys()
IP_ROUTE_MULTIPATH depends only on IP_ADVANCED_ROUTER, not on IPV4. Also, ipv4_sysctl_init_net() still calls proc_fib_multipath_hash_set_seed(net, 0) for every netns.
Take a kernel with CONFIG_IPV4=n, CONFIG_IPV6=y and CONFIG_IP_ROUTE_MULTIPATH=y. That becomes possible once "ipv4: make CONFIG_IPV4 boolean" later in this series makes IPV4 selectable. Won't IPv6 multipath hashing then keep using a random seed that userspace can no longer set?
There is no net.ipv6 copy of this seed. net/ipv6/sysctl_net_ipv6.c only has its own fib_multipath_hash_policy. The NETEVENT_IPV4_MPATH_HASH_UPDATE notification sent from proc_fib_multipath_hash_seed() for offload drivers would also never be sent.
Documentation/networking/ip-sysctl.rst describes this sysctl as:
The seed value used when calculating hash for multipath routes. Applies to both IPv4 and IPv6 datapath. Only present for kernels built with CONFIG_IP_ROUTE_MULTIPATH enabled.
proc_fib_multipath_hash_seed() is marked __maybe_unused in this patch. That suggests the IPV4=n with IP_ROUTE_MULTIPATH=y case was expected.
Should this entry stay outside the CONFIG_IPV4 block, guarded only by CONFIG_IP_ROUTE_MULTIPATH?
Quoted 2 lines
net/ipv4/sysctl_net_ipv4.c +2
-0+ { + .procname = "fib_notify_on_flag_change",
[ ... ]
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260930135334.4739-1-fmancera%40suse.de
[email protected]
AI reviewRe: [PATCH 15/16 net-next v3] netlabel: cipso: introduce CONFIG_CIPSO to decouple IPv4 dependency
In reply to Fernando Fernandez ManceraThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [Medium] When CONFIG_CIPSO=n, the NetLabel management PROTOCOLS dump still tells userspace that CIPSOv4 is supported.
--
netlabel: cipso: introduce CONFIG_CIPSO to decouple IPv4 dependency
This patch adds a new CONFIG_CIPSO symbol, which is enabled when both NETLABEL and IPV4 are set. The CIPSO Makefile targets, sysctls and kernel APIs are placed behind it, and the CIPSO kAPI is stubbed out when it is disabled. This lets NetLabel and Smack build on IPv6-only kernels.
[ ... ]
Quoted 17 lines
net/netlabel/Makefile +1
-1@@ -12,5 +12,5 @@ obj-y += netlabel_mgmt.o # protocol modules obj-y += netlabel_unlabeled.o -obj-y += netlabel_cipso_v4.o +obj-$(CONFIG_CIPSO) += netlabel_cipso_v4.o obj-$(subst m,y,$(CONFIG_IPV6)) += netlabel_calipso.onet/netlabel/netlabel_cipso_v4.h +0
-0@@ -147,6 +147,13 @@ enum {#define NLBL_CIPSOV4_A_MAX (__NLBL_CIPSOV4_A_MAX - 1)
net/netlabel/netlabel_cipso_v4.h enum { · line 157
Quoted 10 lines
net/netlabel/netlabel_cipso_v4.h +7
-0/* NetLabel protocol functions */ +#if IS_ENABLED (CONFIG_CIPSO )int netlbl_cipsov4_genl_init (void ); +#else +static inline int netlbl_cipsov4_genl_init (void ) +{ +return 0 ; +} +#endif
[Severity: Medium]
With CONFIG_CIPSO=n, does the NLBL_MGMT_C_PROTOCOLS dump still tell userspace that CIPSOv4 is supported?
This stub means the "NLBL_CIPSOv4" generic netlink family is never registered. The rest of the CIPSO kAPI is stubbed out too, for example cipso_v4_doi_getdef() returns NULL. But netlbl_mgmt_protocols() in net/netlabel/netlabel_mgmt.c still reports CIPSOv4 unconditionally:
net/netlabel/netlabel_mgmt.c:netlbl_mgmt_protocols() {
...
if (protos_sent == 1) {
if (netlbl_mgmt_protocols_cb(skb,
cb,
NETLBL_NLTYPE_CIPSOV4) < 0)
goto protocols_return;
protos_sent++;
}
#if IS_ENABLED(CONFIG_IPV6)
if (protos_sent == 2) {
if (netlbl_mgmt_protocols_cb(skb,
cb,
NETLBL_NLTYPE_CALIPSO) < 0)
goto protocols_return;
protos_sent++;
}
#endif
...
}The CALIPSO entry is guarded by CONFIG_IPV6, but the CIPSOv4 entry has no guard.
On an IPv6-only kernel with NetLabel enabled (for example selected by SMACK), userspace such as netlabel_tools would see CIPSOv4 in the list. It would then fail to resolve the CIPSOv4 genl family. An NLBL_MGMT_C_ADD with NLBL_MGMT_A_CV4DOI would also fail, because cipso_v4_doi_getdef() returns NULL.
At this commit IPV4 is still def_bool y, so CIPSO always matches NETLABEL. The later commit in the series, "ipv4: make CONFIG_IPV4 boolean", makes IPV6=y, IPV4=n, NETLABEL=y a valid configuration. netlbl_mgmt_protocols() is unchanged at the end of the series.
Wrapping the CIPSOv4 block in #if IS_ENABLED(CONFIG_CIPSO) would not be enough by itself. The resume state in cb->args[0] uses fixed indices, and the CALIPSO step checks protos_sent == 2, so skipping the CIPSOv4 step would also stop CALIPSO from being reported.
Could netlbl_mgmt_protocols() always increment protos_sent for each step, and only emit the message when that protocol is enabled?
[ ... ]
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260930135334.4739-1-fmancera%40suse.de
[email protected]
AI reviewRe: [PATCH 16/16 net-next v3] ipv4: make CONFIG_IPV4 boolean
In reply to Fernando Fernandez ManceraThank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider.
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider.
Critical: 0 · High: 1 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [High] ipv4: exposing CONFIG_IPV4 without BROKEN guard silently drops Netfilter
- [Medium] Making CONFIG_IPV4 user-selectable makes an s390 configuration reachable that does not link.
- [Low] Now that IPV4 can be disabled, several IPv4-only prompts in net/ipv4/Kconfig stay visible and settable with IPV4=n, because they…
--
ipv4: make CONFIG_IPV4 boolean
This commit changes CONFIG_IPV4 from a hidden def_bool y into a bool prompt that users can see. The prompt appears when IPV6 is enabled and defaults to INET, which makes an IPv6-only kernel build possible.
net/ipv4/Kconfig line 6
Quoted 10 lines
net/ipv4/Kconfig +1
-1@@ -3,7 +3,15 @@ # IP configuration # config IPV4 - def_bool y + bool "The IPv4 protocol" if IPV6
[Severity: High]
With IPV4=n, does this silently turn off all of netfilter, including the IPv6 firewall?
Earlier patches in this series made both netfilter menus depend on IPV4:
net/netfilter/Kconfig:
menu "Core Netfilter Configuration"
depends on INET && IPV4 && NETFILTER
net/ipv6/netfilter/Kconfig:
menu "IPv6: Netfilter Configuration"
depends on INET && IPV6 && NETFILTER && IPV4
Take INET=y, IPV6=y and NETFILTER=y, then answer N to the new prompt. Kconfig then drops every symbol under both menus without any warning. That includes NF_CONNTRACK, NF_TABLES, IP6_NF_IPTABLES, IP6_NF_FILTER and the rest. The help text only says the result is an IPv6-only system. Nothing tells the user that the firewall went with it.
The resulting kernel has no packet filtering at all. That is likely the opposite of what someone building an IPv6-only host wants, and it seems more serious than a missing feature in a minimal build.
I see from the note after the commit message that this is meant to provide a minimal build and that follow-ups will fill the gaps. Until netfilter works without IPv4, should the prompt stay hidden behind something like "depends on BROKEN" or "depends on EXPERT"? Or should the help text at least warn that netfilter, including ip6tables and nf_tables, is unavailable with IPV4=n?
[Severity: Medium]
Does this make an s390 configuration reachable that fails to link?
In drivers/s390/net/Kconfig, QETH needs IP_MULTICAST, but nothing in its dependencies requires IPV4, and IP_MULTICAST itself does not depend on IPV4:
config QETH
def_tristate y prompt "Gigabit Ethernet device support" depends on CCW && NETDEVICES && IP_MULTICAST && QDIO && ETHERNET
QETH_L3 is also def_tristate y and depends only on QETH.
qeth_l3_main.c calls the inetaddr notifier helpers with no CONFIG_IPV4 guard:
drivers/s390/net/qeth_l3_main.c:qeth_l3_register_notifiers() {
...
rc = register_inetaddr_notifier(&qeth_l3_ip_notifier);
...
unregister_inetaddr_notifier(&qeth_l3_ip_notifier);
...
}qeth_l3_unregister_notifiers() calls unregister_inetaddr_notifier() as well.
Both helpers are defined only in net/ipv4/devinet.c. That file is built only under obj-$(CONFIG_IPV4), and include/linux/inetdevice.h has no stub for the !CONFIG_IPV4 case.
Take INET=y, IPV6=y, IPV4=n, with QETH and QETH_L3 left at their defaults. Would that give an undefined reference at vmlinux link time when QETH_L3=y, or at modpost when QETH_L3=m?
Other drivers in this effort got a "depends on IPV4 || !INET" guard, for example IXGBE_IPSEC, MLX5_CORE, SFC, STMMAC_ETH, PPTP and IWLWIFI. Should QETH or QETH_L3 get the same guard? Or should the notifier calls be guarded in the code instead?
net/ipv4/Kconfig line 17
Quoted 11 lines
net/ipv4/Kconfig +8
-0+ default INET + help + Support for IP version 4 (IPv4). + + Disabling this option compiles the kernel networking stack without + IPv4 support, resulting in a IPv6-only system. + + If unsure, say Y. config IP_MULTICAST bool "IP: multicasting"
[Severity: Low]
This isn't a bug, but now that IPV4 can be disabled, should the IPv4-only prompts in net/ipv4/Kconfig also depend on IPV4?
None of these depend on IPV4, so users can still see and set them with IPV4=n:
IP_MULTICAST ("IP: multicasting")
IP_ADVANCED_ROUTER ("IP: advanced router") IP_FIB_TRIE_STATS, IP_ROUTE_MULTIPATH and IP_ROUTE_VERBOSE, which depend only on IP_ADVANCED_ROUTER
NET_IPGRE_DEMUX ("IP: GRE demultiplexer")
Most of the code behind these options is in route.o, igmp.o, fib_frontend.o, fib_semantics.o and fib_trie.o. net/ipv4/Makefile builds those files only under CONFIG_IPV4:
obj-$(CONFIG_IPV4) += route.o ip_input.o ip_fragment.o ip_forward.o ip_options.o \
In af_inet.c, the CONFIG_IP_MULTICAST IGMP registration sits inside inet4_init(), which is only called under IS_ENABLED(CONFIG_IPV4). Every in-tree user of NET_IPGRE_DEMUX (NET_IPGRE, PPTP, IPV6_GRE) already depends on IPV4.
IP_MULTIPLE_TABLES, IP_PNP, NET_IPIP and IP_MROUTE already have "depends on IPV4", so these options may simply have been missed.
With IPV4=n, menuconfig still offers these routing and multicast options, they have no effect, and they are not nested under the new IPV4 prompt. Would adding "depends on IPV4", or wrapping the block in "if IPV4", make this consistent?
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260930135334.4739-1-fmancera%40suse.de
Re: [PATCH 06/16 net-next v3] ipv4: udp: split IPv4 specific logic into udp_ipv4.c
In reply to [email protected]Quoted 80 lines · On 10/4/26 7:22 PM, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [Medium] When
CONFIG_IPV4=n,udp4_gro_complete()(net/ipv4/udp_offload.c) returns-EAFNOSUPPORTfor every merged IPv4…--
ipv4: udp: split IPv4 specific logic into
udp_ipv4.cThis commit moves the IPv4-specific UDP socket code out of
udp.cand into a new file,udp_ipv4.c. That covers lookup, input/output, multicast delivery and theAF_INETudp_prot. The new file is built only whenCONFIG_IPV4is enabled. Callers inaf_inet.c,udp_bpf.c,udp_offload.candipv6/udp.cgetIS_ENABLED(CONFIG_IPV4)guards.net/ipv4/udp_offload.c INDIRECT_CALLABLE_SCOPE int udp4_gro_complete(struct sk_buff *skb, int nhoff) · line 963
Quoted 11 lines
net/ipv4/udp_offload.c +3
-0@@ -958,6 +958,9 @@ INDIRECT_CALLABLE_SCOPE int udp4_gro_complete(struct sk_buff *skb, int nhoff)const struct iphdr *iph = (struct iphdr *)(skb->data + offset);struct udphdr *uh = (struct udphdr *)(skb->data + nhoff); +if (!IS_ENABLED (CONFIG_IPV4 )) +return -EAFNOSUPPORT ; +[Severity: Medium]
WithCONFIG_IPV4=n, can this make every merged IPv4 UDP GRO packet get dropped silently?The IPv4 GRO offloads are still registered when IPv4 is disabled.
ipv4_offload_init()inaf_inet.cstill callsudpv4_offload_init()anddev_add_offload(&net_hotdata.ip_packet_offload)with no guard. So inet_gro_receive()->udp4_gro_receive()->udp_gro_receive() still runs for IPv4 UDP packets.The socket lookup there ends up in the new
__udp4_lib_lookup()stub, which returns NULL. Even so,udp_gro_receive()still aggregates:if (skb->dev->features & NETIF_F_GRO_FRAGLIST) NAPI_GRO_CB(skb)->is_flist = sk ? !udp_test_bit(GRO_ENABLED, sk) : 1; if ((!sk && (skb->dev->features & NETIF_F_GRO_UDP_FWD)) || (sk && udp_test_bit(GRO_ENABLED, sk)) || NAPI_GRO_CB(skb)->is_flist) return call_gro_receive(udp_gro_receive_segment, head, skb);At flush time, gro_complete()->inet_gro_complete()->udp4_gro_complete() now returns
-EAFNOSUPPORT, andgro_complete()innet/core/gro.cfrees the whole aggregate:if (err) { WARN_ON(&ptype->list == head); kfree_skb(skb); return; }The
WARN_ONdoesn't fire because a ptype was found, so all segments are lost with no warning. This would affect an IPv6-only kernel that bridges or forwards IPv4 UDP withNETIF_F_GRO_UDP_FWDorNETIF_F_GRO_FRAGLISTenabled on the ingress device. Inner IPv4 carried in IPv6 tunnels would be hit too.The fraglist branch and the
udp_gro_complete()path don't need IPv4 socket state. The only IPv4-only dependency looks like theudp4_lib_lookup_skbreference. Would it work to stub or skip only the lookup, for example with a NULL-returningudp4_lib_lookup_skbwhenCONFIG_IPV4=n, and keep the rest ofudp4_gro_complete()? Or should IPv4 UDP GRO receive also be disabled in that configuration, so packets aren't aggregated only to be dropped at completion?
Quoted 4 lines
The later patch in the series, "ipv4: make
CONFIG_IPV4boolean", makes this configuration selectable.udp4_gro_complete()andipv4_offload_init()are unchanged at the end of the series.
I guess this is a good point. I will look more into it.
pw-bot: cr
Quoted 6 lines
Quoted 3 lines
net/ipv4/udp_offload.c +0
-0/* do fraglist only if there is no outer UDP encap (or we already processed it) */ if (NAPI_GRO_CB (skb)->is_flist && !NAPI_GRO_CB (skb)->encap_mark) {udp_set_len (uh, skb->len - nhoff);[ ... ]