Commit 40790553 by Serge Hallyn Committed by Stéphane Graber

don't skip setting network properties in unpriv case

parent f338fa89
...@@ -2374,16 +2374,19 @@ static int setup_netdev(struct lxc_netdev *netdev) ...@@ -2374,16 +2374,19 @@ static int setup_netdev(struct lxc_netdev *netdev)
return -1; return -1;
} }
} }
if (netdev->type != LXC_NET_VETH)
return 0; return 0;
netdev->ifindex = if_nametoindex(netdev->name);
} }
/* get the new ifindex in case of physical netdev */ /* 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))) { if (!(netdev->ifindex = if_nametoindex(netdev->link))) {
ERROR("failed to get ifindex for %s", ERROR("failed to get ifindex for %s",
netdev->link); netdev->link);
return -1; return -1;
} }
}
/* retrieve the name of the interface */ /* retrieve the name of the interface */
if (!if_indextoname(netdev->ifindex, current_ifname)) { if (!if_indextoname(netdev->ifindex, current_ifname)) {
...@@ -2398,12 +2401,14 @@ static int setup_netdev(struct lxc_netdev *netdev) ...@@ -2398,12 +2401,14 @@ static int setup_netdev(struct lxc_netdev *netdev)
netdev->link : "eth%d"; netdev->link : "eth%d";
/* rename the interface name */ /* rename the interface name */
if (strcmp(ifname, netdev->name) != 0) {
err = lxc_netdev_rename_by_name(ifname, netdev->name); err = lxc_netdev_rename_by_name(ifname, netdev->name);
if (err) { if (err) {
ERROR("failed to rename %s->%s : %s", ifname, netdev->name, ERROR("failed to rename %s->%s : %s", ifname, netdev->name,
strerror(-err)); strerror(-err));
return -1; return -1;
} }
}
/* Re-read the name of the interface because its name has changed /* Re-read the name of the interface because its name has changed
* and would be automatically allocated by the system * and would be automatically allocated by the system
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment