From: Daniel Lezcano <daniel.lezc...@free.fr>

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 <dlezc...@fr.ibm.com>
---
 src/lxc/confile.c |    4 ++--
 src/lxc/list.h    |    5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 127fb37..e2c015d 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -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);
diff --git a/src/lxc/list.h b/src/lxc/list.h
index eb4fd13..5213e80 100644
--- a/src/lxc/list.h
+++ b/src/lxc/list.h
@@ -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;
-- 
1.7.0.4


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to