]> git.proxmox.com Git - mirror_lxc.git/blobdiff - src/lxc/conf.c
start: unify and simplify network creation
[mirror_lxc.git] / src / lxc / conf.c
index d7d9ad902c956ddbafe8a11cac9bb6a44fe021a4..97da012d38c7845622aec4a7fcd7772ac3039129 100644 (file)
@@ -3563,16 +3563,19 @@ int lxc_setup(struct lxc_handler *handler)
        if (ret < 0)
                return -1;
 
-       ret = lxc_setup_network_in_child_namespaces(lxc_conf, &lxc_conf->network);
-       if (ret < 0) {
-               ERROR("Failed to setup network");
-               return -1;
-       }
+       if (handler->ns_clone_flags & CLONE_NEWNET) {
+               ret = lxc_setup_network_in_child_namespaces(lxc_conf,
+                                                           &lxc_conf->network);
+               if (ret < 0) {
+                       ERROR("Failed to setup network");
+                       return -1;
+               }
 
-       ret = lxc_network_send_name_and_ifindex_to_parent(handler);
-       if (ret < 0) {
-               ERROR("Failed to send network device names and ifindices to parent");
-               return -1;
+               ret = lxc_network_send_name_and_ifindex_to_parent(handler);
+               if (ret < 0) {
+                       ERROR("Failed to send network device names and ifindices to parent");
+                       return -1;
+               }
        }
 
        if (lxc_conf->autodev > 0) {