Commit bac89583 by Daniel Lezcano Committed by Daniel Lezcano

fix inverted network interface creation

The list is 'lifo', so when we create the network interfaces, we do this in the reverse order of the expected one. That is confusing. Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 7a82e923
......@@ -136,7 +136,7 @@ static int config_network_type(const char *key, char *value,
lxc_list_init(list);
list->elem = netdev;
lxc_list_add(network, list);
lxc_list_add_tail(network, list);
if (!strcmp(value, "veth"))
netdev->type = LXC_NET_VETH;
......@@ -178,7 +178,7 @@ static struct lxc_netdev *network_netdev(const char *key, const char *value,
return NULL;
}
netdev = lxc_list_first_elem(network);
netdev = lxc_list_last_elem(network);
if (!netdev) {
ERROR("no network device defined for '%s' = '%s' option",
key, value);
......
......@@ -30,6 +30,11 @@ static inline void *lxc_list_first_elem(struct lxc_list *list)
return list->next->elem;
}
static inline void *lxc_list_last_elem(struct lxc_list *list)
{
return list->prev->elem;
}
static inline int lxc_list_empty(struct lxc_list *list)
{
return list == list->next;
......
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