]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
fix inverted network interface creation
authorDaniel Lezcano <daniel.lezcano@free.fr>
Thu, 22 Jul 2010 13:59:44 +0000 (15:59 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Thu, 22 Jul 2010 13:59:44 +0000 (15:59 +0200)
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: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/confile.c
src/lxc/list.h

index 127fb3700534ef5430f347c649881b81b5690e57..e2c015d7c449bdab0b8437f38ec4179df666368e 100644 (file)
@@ -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);
index eb4fd13468cf336127a6c1dd98fbfafdf1ab5e1c..5213e8085d98424d434bcf4fe5d70d5538c680c4 100644 (file)
@@ -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;