From b4c2463268a8aaed3ceb34cdb429b543f9d67b8b Mon Sep 17 00:00:00 2001 From: Zhang Tianyang Date: Fri, 5 Apr 2024 15:55:31 +0800 Subject: [PATCH] network: fix private sandbox netns Signed-off-by: Zhang Tianyang --- vmm/common/src/lib.rs | 2 +- vmm/task/src/main.rs | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/vmm/common/src/lib.rs b/vmm/common/src/lib.rs index 90502af9..a3a909fb 100644 --- a/vmm/common/src/lib.rs +++ b/vmm/common/src/lib.rs @@ -35,7 +35,7 @@ pub const HOSTNAME_FILENAME: &str = "hostname"; pub const RESOLV_FILENAME: &str = "resolv.conf"; pub const SANDBOX_NS_PATH: &str = "/run/sandbox-ns"; -pub const NET_NAMESPACE: &str = "net"; +pub const NET_NAMESPACE: &str = "network"; pub const IPC_NAMESPACE: &str = "ipc"; pub const UTS_NAMESPACE: &str = "uts"; pub const CGROUP_NAMESPACE: &str = "cgroup"; diff --git a/vmm/task/src/main.rs b/vmm/task/src/main.rs index bd0a02fd..bce4fb9d 100644 --- a/vmm/task/src/main.rs +++ b/vmm/task/src/main.rs @@ -40,8 +40,7 @@ use signal_hook_tokio::Signals; use tokio::fs::File; use vmm_common::{ api::sandbox_ttrpc::create_sandbox_service, mount::mount, ETC_RESOLV, HOSTNAME_FILENAME, - IPC_NAMESPACE, KUASAR_STATE_DIR, NET_NAMESPACE, RESOLV_FILENAME, SANDBOX_NS_PATH, - UTS_NAMESPACE, + IPC_NAMESPACE, KUASAR_STATE_DIR, RESOLV_FILENAME, SANDBOX_NS_PATH, UTS_NAMESPACE, }; use crate::{ @@ -131,7 +130,6 @@ lazy_static! { options: vec!["relatime", "nodev", "sync", "dirsync",] },]; static ref CLONE_FLAG_TABLE: HashMap = HashMap::from([ - (String::from(NET_NAMESPACE), CloneFlags::CLONE_NEWNET), (String::from(IPC_NAMESPACE), CloneFlags::CLONE_NEWIPC), (String::from(UTS_NAMESPACE), CloneFlags::CLONE_NEWUTS), ]);