Re: [PATCH net-next v14 05/12] selftests/vsock: add namespace helpers to vmtest.sh

From: Stefano Garzarella

Date: Tue Jan 13 2026 - 10:53:33 EST


On Mon, Jan 12, 2026 at 07:11:14PM -0800, Bobby Eshleman wrote:
From: Bobby Eshleman <bobbyeshleman@xxxxxxxx>

Add functions for initializing namespaces with the different vsock NS
modes. Callers can use add_namespaces() and del_namespaces() to create
namespaces global0, global1, local0, and local1.

The add_namespaces() function initializes global0, local0, etc... with
their respective vsock NS mode by toggling child_ns_mode before creating
the namespace.

Remove namespaces upon exiting the program in cleanup(). This is
unlikely to be needed for a healthy run, but it is useful for tests that
are manually killed mid-test.

This patch is in preparation for later namespace tests.

Signed-off-by: Bobby Eshleman <bobbyeshleman@xxxxxxxx>
---
Changes in v13:
- intialize namespaces to use the child_ns_mode mechanism
- remove setting modes from init_namespaces() function (this function
only sets up the lo device now)
- remove ns_set_mode(ns) because ns_mode is no longer mutable
---
tools/testing/selftests/vsock/vmtest.sh | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)

Reviewed-by: Stefano Garzarella <sgarzare@xxxxxxxxxx>