mbox series

[net-next,v2,0/2] net: visibility of memory limits in netns

Message ID 20240530232722.45255-1-technoboy85@gmail.com
Headers show
Series net: visibility of memory limits in netns | expand

Message

Matteo Croce May 30, 2024, 11:27 p.m. UTC
From: Matteo Croce <teknoraver@meta.com>

Some programs need to know the size of the network buffers to operate
correctly, export the following sysctls read-only in network namespaces:

- net.core.rmem_default
- net.core.rmem_max
- net.core.wmem_default
- net.core.wmem_max

Matteo Croce (2):
  net: make net.core.{r,w}mem_{default,max} namespaced
  selftests: net: tests net.core.{r,w}mem_{default,max} sysctls in a
    netns

changes from v1:
- added SPDX header to test
- rewrite test with more detailed error messages

 net/core/sysctl_net_core.c                  | 75 ++++++++++++---------
 tools/testing/selftests/net/Makefile        |  1 +
 tools/testing/selftests/net/netns-sysctl.sh | 40 +++++++++++
 3 files changed, 83 insertions(+), 33 deletions(-)
 create mode 100755 tools/testing/selftests/net/netns-sysctl.sh

Comments

Eric Dumazet May 31, 2024, 8:12 a.m. UTC | #1
On Fri, May 31, 2024 at 1:27 AM <technoboy85@gmail.com> wrote:
>
> From: Matteo Croce <teknoraver@meta.com>
>
> The following sysctl are global and can't be read from a netns:
>
> net.core.rmem_default
> net.core.rmem_max
> net.core.wmem_default
> net.core.wmem_max
>
> Make the following sysctl parameters available readonly from within a
> network namespace, allowing a container to read them.
>
> Signed-off-by: Matteo Croce <teknoraver@meta.com>

Reviewed-by: Eric Dumazet <edumazet@google.com>
Shakeel Butt May 31, 2024, 10:11 p.m. UTC | #2
On Fri, May 31, 2024 at 01:27:21AM GMT, technoboy85@gmail.com wrote:
> From: Matteo Croce <teknoraver@meta.com>
> 
> The following sysctl are global and can't be read from a netns:
> 
> net.core.rmem_default
> net.core.rmem_max
> net.core.wmem_default
> net.core.wmem_max
> 
> Make the following sysctl parameters available readonly from within a
> network namespace, allowing a container to read them.
> 
> Signed-off-by: Matteo Croce <teknoraver@meta.com>

Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
patchwork-bot+netdevbpf@kernel.org June 1, 2024, 11:20 p.m. UTC | #3
Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 31 May 2024 01:27:20 +0200 you wrote:
> From: Matteo Croce <teknoraver@meta.com>
> 
> Some programs need to know the size of the network buffers to operate
> correctly, export the following sysctls read-only in network namespaces:
> 
> - net.core.rmem_default
> - net.core.rmem_max
> - net.core.wmem_default
> - net.core.wmem_max
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/2] net: make net.core.{r,w}mem_{default,max} namespaced
    https://git.kernel.org/netdev/net-next/c/19249c0724f2
  - [net-next,v2,2/2] selftests: net: tests net.core.{r,w}mem_{default,max} sysctls in a netns
    https://git.kernel.org/netdev/net-next/c/5b5233fb81bf

You are awesome, thank you!