From: Menglong Dong <dong.mengl...@zte.com.cn>

For now, most sysctl in 'net/core' are globally unified, such as
sysctl_wmem_default, sysctl_rmem_default, sysctl_wmem_default,
sysctl_rmem_default, etc.

It's not convenient in some case. For example, when we use docker
and try to control the default udp socket receive buffer for
each container by sysctl_rmem_default.

For that reason, I namespace-ify some sysctl in 'net/core', which
are sysctl_wmem_default, sysctl_rmem_default, sysctl_wmem_default
and sysctl_rmem_default.

In the first patch, I made some adjustments to the initialization
of netns_core_table.

The second patch make sysctl_wmem_default and sysctl_rmem_default
per-namespace, and the third patch make sysctl_wmem_max and
sysctl_rmem_max per-namespace.

After these patch, sysctl above are pre-namespace, for example:

$ cat /proc/sys/net/core/rmem_default
1024000
$ ip netns exec test cat /proc/sys/net/core/rmem_default
212992
$ ip netns exec test2 cat /proc/sys/net/core/rmem_default
2048000

Thanks for Christian's patient explaining to make these patches a
single series~

Menglong Dong (3):
  net: core: init every ctl_table in netns_core_table
  net: core: Namespace-ify sysctl_wmem_default and sysctl_rmem_default
  net: core: Namespace-ify sysctl_rmem_max and sysctl_wmem_max

 include/net/netns/core.h        |  4 ++
 include/net/sock.h              |  6 ---
 net/core/filter.c               |  4 +-
 net/core/net_namespace.c        |  4 ++
 net/core/sock.c                 | 18 +++-----
 net/core/sysctl_net_core.c      | 76 +++++++++++++++++----------------
 net/ipv4/ip_output.c            |  2 +-
 net/ipv4/tcp_output.c           |  2 +-
 net/netfilter/ipvs/ip_vs_sync.c |  4 +-
 9 files changed, 60 insertions(+), 60 deletions(-)


base-commit: 5ee88057889bbca5f5bb96031b62b3756b33e164
-- 
2.30.0

Reply via email to