Problem Statement
NetworkNamespace::create() (and its teardown) in crates/openshell-supervisor-process/src/netns/mod.rs build the sandbox network namespace, veth pair, addresses, and routes by shelling out to ip — 32 call sites via run_ip / run_ip_netns / run_ip_netns_output — and to nsenter — 9 call sites, used to run ip inside the target namespace. Both binaries are resolved from the workload image (IP_SEARCH_PATHS, NSENTER_SEARCH_PATHS). A bare Alpine image ships only busybox ip (no netns subcommand) and no nsenter equivalent, so setup fails with Network namespace creation failed ... iproute2 is installed.
setns is already a direct syscall for the enter path (8 call sites), so the pattern is established; only namespace/veth/route creation still spawns external binaries.
Proposed Design
Create and configure the namespace entirely through kernel interfaces, with no external process:
- Namespace: create via
unshare(CLONE_NEWNET) in a forked helper (or open + setns), keeping an FD-owned namespace so the /run/netns bind mount is no longer required.
- veth pair, address assignment, link up/down, routes: route netlink via the
rtnetlink crate.
- Operations "inside" the namespace: enter with
setns on the owned FD instead of nsenter.
Acceptance Criteria
Scope
In: the ip + nsenter network-namespace/veth/route path in netns/mod.rs.
Out: the nft firewall rules (sibling issue) and dmesg→NFLOG bypass monitoring (#2382).
Related
Problem Statement
NetworkNamespace::create()(and its teardown) incrates/openshell-supervisor-process/src/netns/mod.rsbuild the sandbox network namespace, veth pair, addresses, and routes by shelling out toip— 32 call sites viarun_ip/run_ip_netns/run_ip_netns_output— and tonsenter— 9 call sites, used to runipinside the target namespace. Both binaries are resolved from the workload image (IP_SEARCH_PATHS,NSENTER_SEARCH_PATHS). A bare Alpine image ships only busyboxip(nonetnssubcommand) and nonsenterequivalent, so setup fails withNetwork namespace creation failed ... iproute2 is installed.setnsis already a direct syscall for the enter path (8 call sites), so the pattern is established; only namespace/veth/route creation still spawns external binaries.Proposed Design
Create and configure the namespace entirely through kernel interfaces, with no external process:
unshare(CLONE_NEWNET)in a forked helper (or open +setns), keeping an FD-owned namespace so the/run/netnsbind mount is no longer required.rtnetlinkcrate.setnson the owned FD instead ofnsenter.Acceptance Criteria
ip/nsenterprocess spawned./run/netnsbind mount is no longer required.ip).Scope
In: the
ip+nsenternetwork-namespace/veth/route path innetns/mod.rs.Out: the
nftfirewall rules (sibling issue) anddmesg→NFLOG bypass monitoring (#2382).Related