Re: [RFC PATCH net-next 0/3] netns: optionally inherit IPv4 TCP sysctls from old net

From: Eric Dumazet

Date: Wed Apr 29 2026 - 22:46:45 EST


On Wed, Apr 29, 2026 at 6:30 PM nmreadelf <kong414@xxxxxxxxxxx> wrote:
>
> a new network namespace starts with built-in TCP defaults.
> In container-heavy setups, operators often tune TCP sysctls in init_net and then
> need to re-apply the same values for each new netns.
>

There is a mistake here. init_net is not the same as parent_net (or
old_net in your patches)

unshare -n # Parent netns might be init_net
unshare -n # Parent netns is not init_net
...


> This series adds an opt-in mechanism to initialize per-netns IPv4 TCP sysctl
> settings from init_net at netns creation time.
>
> Behavior:
>
> Default is unchanged.
> When net.ipv4.netns_inherit_tcp_sysctls=1, new netns inherit
> TCP sysctl from old_net.
>
> nmreadelf (3):
> ipv4: netns: group copyable TCP sysctls in netns_ipv4
> net: ipv4: add netns_inherit_tcp_sysctls sysctl
> tcp: netns: optionally inherit IPv4 TCP sysctls from parent netns
>
> .../net_cachelines/netns_ipv4_sysctl.rst | 25 +++----
> include/net/netns/ipv4.h | 33 +++++----
> net/core/net_namespace.c | 72 +++++++++++++++++++
> net/ipv4/sysctl_net_ipv4.c | 9 +++
> 4 files changed, 114 insertions(+), 25 deletions(-)
>
> --
> 2.47.3
>