1 From c44003f7e7254ac972eaa1b22a686471ea4ce2d7 Mon Sep 17 00:00:00 2001
2 From: Liping Zhang <liping.zhang@spreadtrum.com>
3 Date: Tue, 20 Sep 2016 02:09:02 -0700
4 Subject: [PATCH] ipmonitor: fix ip monitor can't work when NET_NS is not
7 In ip monitor, netns_map_init will check getnsid is supported or not.
8 But when /proc/self/ns/net does not exist, we just print out error
9 messages and exit. So user cannot use ip monitor anymore when
10 CONFIG_NET_NS is disabled:
12 open("/proc/self/ns/net"): No such file or directory
14 If open "/proc/self/ns/net" failed, set have_rtnl_getnsid to false.
16 Fixes: d652ccbf8195 ("netns: allow to dump and monitor nsid")
17 Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
18 Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
21 1 file changed, 2 insertions(+), 2 deletions(-)
23 diff --git a/ip/ipnetns.c b/ip/ipnetns.c
24 index af87065..ccc652c 100644
27 @@ -72,8 +72,8 @@ static int ipnetns_have_nsid(void)
28 if (have_rtnl_getnsid < 0) {
29 fd = open("/proc/self/ns/net", O_RDONLY);
31 - perror("open(\"/proc/self/ns/net\")");
33 + have_rtnl_getnsid = 0;
37 addattr32(&req.n, 1024, NETNSA_FD, fd);