]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: Namespaces should only complain about failure if we have it
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 31 Mar 2018 19:08:14 +0000 (15:08 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 31 Mar 2018 19:08:14 +0000 (15:08 -0400)
Do not complain about failure to create a namespace if we
do not have any such thing going on.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/netns_linux.c

index 01616be7115c0d9d7b859d17df784bd12c2cb578..3d61cecc03e94d7d9dbc0267fae01d088db04a08 100644 (file)
@@ -412,9 +412,12 @@ void ns_init(void)
                return;
        errno = 0;
 #ifdef HAVE_NETNS
-       if (have_netns_enabled < 0)
+       if (have_netns_enabled < 0) {
                ns_default_ns_fd = open(NS_DEFAULT_NAME, O_RDONLY);
-       else {
+               if (ns_default_ns_fd == -1)
+                       zlog_err("NS initialization failure %d(%s)",
+                                errno, safe_strerror(errno));
+       } else {
                ns_default_ns_fd = -1;
                default_ns = NULL;
        }
@@ -422,9 +425,6 @@ void ns_init(void)
        ns_default_ns_fd = -1;
        default_ns = NULL;
 #endif /* HAVE_NETNS */
-       if (ns_default_ns_fd == -1)
-               zlog_err("NS initialisation failure (%s)",
-                        safe_strerror(errno));
        ns_current_ns_fd = -1;
        ns_initialised = 1;
 }