]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
don't skip setting network properties in unpriv case
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 18 Feb 2014 04:33:20 +0000 (22:33 -0600)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 18 Feb 2014 04:40:01 +0000 (23:40 -0500)
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/conf.c

index 8529a438c07b8d8b32e51bf5a36799d707d9e3bc..d40e3e0b5233d6c0f78013110a7403ab3eee6742 100644 (file)
@@ -2374,16 +2374,19 @@ static int setup_netdev(struct lxc_netdev *netdev)
                                return -1;
                        }
                }
-               return 0;
+               if (netdev->type != LXC_NET_VETH)
+                       return 0;
+               netdev->ifindex = if_nametoindex(netdev->name);
        }
 
        /* get the new ifindex in case of physical netdev */
-       if (netdev->type == LXC_NET_PHYS)
+       if (netdev->type == LXC_NET_PHYS) {
                if (!(netdev->ifindex = if_nametoindex(netdev->link))) {
                        ERROR("failed to get ifindex for %s",
                                netdev->link);
                        return -1;
                }
+       }
 
        /* retrieve the name of the interface */
        if (!if_indextoname(netdev->ifindex, current_ifname)) {
@@ -2398,11 +2401,13 @@ static int setup_netdev(struct lxc_netdev *netdev)
                        netdev->link : "eth%d";
 
        /* rename the interface name */
-       err = lxc_netdev_rename_by_name(ifname, netdev->name);
-       if (err) {
-               ERROR("failed to rename %s->%s : %s", ifname, netdev->name,
-                     strerror(-err));
-               return -1;
+       if (strcmp(ifname, netdev->name) != 0) {
+               err = lxc_netdev_rename_by_name(ifname, netdev->name);
+               if (err) {
+                       ERROR("failed to rename %s->%s : %s", ifname, netdev->name,
+                             strerror(-err));
+                       return -1;
+               }
        }
 
        /* Re-read the name of the interface because its name has changed