}
/* default: let the system to choose one interface name */
- if (!netdev->newname)
- netdev->newname = "eth%d";
+ if (!netdev->name)
+ netdev->name = "eth%d";
/* rename the interface name */
- if (lxc_device_rename(ifname, netdev->newname)) {
+ if (lxc_device_rename(ifname, netdev->name)) {
ERROR("failed to rename %s->%s", ifname, current_ifname);
return -1;
}
if (lxc_veth_create(veth1, veth2)) {
ERROR("failed to create %s-%s/%s",
- veth1, veth2, netdev->ifname);
+ veth1, veth2, netdev->link);
goto out;
}
}
}
- if (lxc_bridge_attach(netdev->ifname, veth1)) {
+ if (lxc_bridge_attach(netdev->link, veth1)) {
ERROR("failed to attach '%s' to the bridge '%s'",
- veth1, netdev->ifname);
+ veth1, netdev->link);
goto out_delete;
}
return -1;
}
- if (lxc_macvlan_create(netdev->ifname, peer)) {
+ if (lxc_macvlan_create(netdev->link, peer)) {
ERROR("failed to create macvlan interface '%s' on '%s'",
- peer, netdev->ifname);
+ peer, netdev->link);
goto out;
}
static int instanciate_phys(struct lxc_netdev *netdev)
{
- netdev->ifindex = if_nametoindex(netdev->ifname);
+ netdev->ifindex = if_nametoindex(netdev->link);
if (!netdev->ifindex) {
- ERROR("failed to retrieve the index for %s", netdev->ifname);
+ ERROR("failed to retrieve the index for %s", netdev->link);
return -1;
}
if (lxc_device_move(netdev->ifindex, pid)) {
ERROR("failed to move '%s' to the container",
- netdev->ifname);
+ netdev->link);
return -1;
}
- DEBUG("move '%s' to '%d'", netdev->ifname, pid);
+ DEBUG("move '%s' to '%d'", netdev->link, pid);
}
return 0;
};
/*
* Defines a structure to configure a network device
- * @ifname : network device name
+ * @link : lxc.network.link, name of bridge or host iface to attach if any
+ * @name : lxc.network.name, name of iface on the container side
* @flags : flag of the network device (IFF_UP, ... )
* @ipv4 : a list of ipv4 addresses to be set on the network device
* @ipv6 : a list of ipv6 addresses to be set on the network device
int type;
int flags;
int ifindex;
- char *ifname;
- char *newname;
+ char *link;
+ char *name;
char *hwaddr;
char *mtu;
struct lxc_list ipv4;