* [PATCH net] vsock: document namespace mode sysctls
@ 2026-02-16 16:31 Stefano Garzarella
2026-02-16 20:21 ` Randy Dunlap
2026-02-18 1:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Stefano Garzarella @ 2026-02-16 16:31 UTC (permalink / raw)
To: netdev
Cc: Shuah Khan, Bobby Eshleman, linux-kernel, Jonathan Corbet,
linux-doc, Stefano Garzarella
From: Stefano Garzarella <sgarzare@redhat.com>
Add documentation for the vsock per-namespace sysctls (`ns_mode` and
`child_ns_mode`) to Documentation/admin-guide/sysctl/net.rst.
These sysctls were introduced by by commit eafb64f40ca4 ("vsock: add
netns to vsock core").
Document the two namespace modes (`global` and `local`), the
inheritance behavior of `child_ns_mode`, and the restriction preventing
local namespaces from setting `child_ns_mode` to `global`.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
---
Hi,
I guess this is `net` material since we forgot to do this change with
commit eafb64f40ca4 ("vsock: add netns to vsock core") landed in Linus'
tree in the current merge window, but I'm not sure if we need a Fixes
tag.
Let me know if a Fixes tag is needed or if this patch is net-next material.
Thanks,
Stefano
---
Documentation/admin-guide/sysctl/net.rst | 52 +++++++++++++++++++++++-
1 file changed, 50 insertions(+), 2 deletions(-)
diff --git a/Documentation/admin-guide/sysctl/net.rst b/Documentation/admin-guide/sysctl/net.rst
index 19408da2390b..c10530624f1e 100644
--- a/Documentation/admin-guide/sysctl/net.rst
+++ b/Documentation/admin-guide/sysctl/net.rst
@@ -40,8 +40,8 @@ Table : Subdirectories in /proc/sys/net
bridge Bridging rose X.25 PLP layer
core General parameter tipc TIPC
ethernet Ethernet protocol unix Unix domain sockets
- ipv4 IP version 4 x25 X.25 protocol
- ipv6 IP version 6
+ ipv4 IP version 4 vsock VSOCK sockets
+ ipv6 IP version 6 x25 X.25 protocol
========= =================== = ========== ===================
1. /proc/sys/net/core - Network core options
@@ -551,3 +551,51 @@ originally may have been issued in the correct sequential order.
If named_timeout is nonzero, failed topology updates will be placed on a defer
queue until another event arrives that clears the error, or until the timeout
expires. Value is in milliseconds.
+
+6. /proc/sys/net/vsock - VSOCK sockets
+--------------------------------------
+
+VSOCK sockets (AF_VSOCK) provide communication between virtual machines and
+their hosts. The behavior of VSOCK sockets in a network namespace is determined
+by the namespace's mode (``global`` or ``local``), which controls how CIDs
+(Context IDs) are allocated and how sockets interact across namespaces.
+
+ns_mode
+-------
+
+Read-only. Reports the current namespace's mode, set at namespace creation
+and immutable thereafter.
+
+Values:
+
+ - ``global`` - the namespace shares system-wide CID allocation and
+ its sockets can reach any VM or socket in any global namespace.
+ Sockets in this namespace cannot reach sockets in local
+ namespaces.
+ - ``local`` - the namespace has private CID allocation and its
+ sockets can only connect to VMs or sockets within the same
+ namespace.
+
+The init_net mode is always ``global``.
+
+child_ns_mode
+-------------
+
+Controls what mode newly created child namespaces will inherit. At namespace
+creation, ``ns_mode`` is inherited from the parent's ``child_ns_mode``. The
+initial value matches the namespace's own ``ns_mode``.
+
+Values:
+
+ - ``global`` - child namespaces will share system-wide CID allocation
+ and their sockets will be able to reach any VM or socket in any
+ global namespace.
+ - ``local`` - child namespaces will have private CID allocation and
+ their sockets will only be able to connect within their own
+ namespace.
+
+Changing ``child_ns_mode`` only affects namespaces created after the change;
+it does not modify the current namespace or any existing children.
+
+A namespace with ``ns_mode`` set to ``local`` cannot change
+``child_ns_mode`` to ``global`` (returns ``-EPERM``).
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] vsock: document namespace mode sysctls
2026-02-16 16:31 [PATCH net] vsock: document namespace mode sysctls Stefano Garzarella
@ 2026-02-16 20:21 ` Randy Dunlap
2026-02-18 1:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2026-02-16 20:21 UTC (permalink / raw)
To: Stefano Garzarella, netdev
Cc: Shuah Khan, Bobby Eshleman, linux-kernel, Jonathan Corbet,
linux-doc
On 2/16/26 8:31 AM, Stefano Garzarella wrote:
> From: Stefano Garzarella <sgarzare@redhat.com>
>
> Add documentation for the vsock per-namespace sysctls (`ns_mode` and
> `child_ns_mode`) to Documentation/admin-guide/sysctl/net.rst.
> These sysctls were introduced by by commit eafb64f40ca4 ("vsock: add
> netns to vsock core").
>
> Document the two namespace modes (`global` and `local`), the
> inheritance behavior of `child_ns_mode`, and the restriction preventing
> local namespaces from setting `child_ns_mode` to `global`.
>
> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
> ---
> Documentation/admin-guide/sysctl/net.rst | 52 +++++++++++++++++++++++-
> 1 file changed, 50 insertions(+), 2 deletions(-)
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Thanks.
--
~Randy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] vsock: document namespace mode sysctls
2026-02-16 16:31 [PATCH net] vsock: document namespace mode sysctls Stefano Garzarella
2026-02-16 20:21 ` Randy Dunlap
@ 2026-02-18 1:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-02-18 1:30 UTC (permalink / raw)
To: Stefano Garzarella
Cc: netdev, skhan, bobbyeshleman, linux-kernel, corbet, linux-doc
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 16 Feb 2026 17:31:47 +0100 you wrote:
> From: Stefano Garzarella <sgarzare@redhat.com>
>
> Add documentation for the vsock per-namespace sysctls (`ns_mode` and
> `child_ns_mode`) to Documentation/admin-guide/sysctl/net.rst.
> These sysctls were introduced by by commit eafb64f40ca4 ("vsock: add
> netns to vsock core").
>
> [...]
Here is the summary with links:
- [net] vsock: document namespace mode sysctls
https://git.kernel.org/netdev/net/c/a07c33c6f2fc
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-18 1:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-16 16:31 [PATCH net] vsock: document namespace mode sysctls Stefano Garzarella
2026-02-16 20:21 ` Randy Dunlap
2026-02-18 1:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox