]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
netns: make /var/run/netns bind-mount recursive
authorCasey Callendrello <casey.callendrello@coreos.com>
Tue, 1 Aug 2017 15:46:09 +0000 (17:46 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 4 Aug 2017 19:08:52 +0000 (12:08 -0700)
When ip netns {add|delete} is first run, it bind-mounts /var/run/netns
on top of itself, then marks it as shared. However, if there are already
bind-mounts in the directory from other tools, these would not be
propagated. Fix this by recursively bind-mounting.

Signed-off-by: Casey Callendrello <casey.callendrello@coreos.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
ip/ipnetns.c

index 198e9de8c830a1bfcfdf28c9c460e7d53611bfe6..9ee1fe6a51f9c52f6bae7f287f7273643f321148 100644 (file)
@@ -636,7 +636,7 @@ static int netns_add(int argc, char **argv)
                }
 
                /* Upgrade NETNS_RUN_DIR to a mount point */
-               if (mount(NETNS_RUN_DIR, NETNS_RUN_DIR, "none", MS_BIND, NULL)) {
+               if (mount(NETNS_RUN_DIR, NETNS_RUN_DIR, "none", MS_BIND | MS_REC, NULL)) {
                        fprintf(stderr, "mount --bind %s %s failed: %s\n",
                                NETNS_RUN_DIR, NETNS_RUN_DIR, strerror(errno));
                        return -1;