On Mon, Jan 12, 2026 at 07:11:14PM -0800, Bobby Eshleman wrote:
From: Bobby Eshleman <[email protected]>

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 <[email protected]>
---
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 <[email protected]>


Reply via email to