ip netns创建对/ var / run / ns中的(命名)网络命名空间的引用,可以轻松跟踪它.同样,也可以通过/ proc / [pid] / ns / net来确定.然而,一些自定义程序可能创建一个网络ns,并将相应的inode保存在其他非常规位置.这可能使得难以确定是否存在可以列出的净值.
其次,取消共享< cmd>当进程退出时,会损坏网络,这很好.但是,ip netns exec< netns> < CMD>即使在命令/进程退出后也会保持ns.所以我相信,任何自定义程序都可以这样做.
因此,问题是:自定义程序是否可能创建一个未命名的网络ns,并且与任何进程保持不相关?
此外,鉴于我们不知道inode的路径,是否可以从用户空间中列出这样的(隐藏)网络ns? (内核当然有一个net ns的链表)一个代码段将是有帮助的.
Is it possible that a custom program creates an unnamed net ns,and it is left unassociated with any process?
是的,这是可能的.根据Linux命名空间手册页(http://man7.org/linux/man-pages/man7/namespaces.7.html):
Each process has a /proc/[pid]/ns/ subdirectory containing one entry
for each namespace that supports being manipulated by setns(2):Bind mounting (see mount(2)) one of the files in this directory to
somewhere else in the filesystem keeps the corresponding namespace of
the process specified by pid alive even if all processes currently in
the namespace terminate.
关于另一个问题:
is it possible to list out such (hidden) net ns from user-space,given that we do not know the paths to the inodes?
如果您从第一个问题考虑上述引用,通过检查绑定路径,您应该可以找到这些隐藏的命名空间.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。