Make sure that when configuring containers that have interfaces containing
multiple IP addresses they are added in the order of the configuration file
(i.e. the first being the primary one) and not the reverse order.

Signed-off-by: Christian Seiler <christ...@iwakd.de>
---
 src/lxc/confile.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

This problem hit me when I created a container with multiple IPv4 addresses
and they were added in the reverse order, making the last one in the config
file the primary address from which all outgoing connections were made
unless the program bound source IPs explicitly, which then caused an
IP-based filter on the other end to deny access.

diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 034136e..da87088 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -624,7 +624,7 @@ static int config_network_ipv4(const char *key, const char 
*value,
                        htonl(INADDR_BROADCAST >>  inetdev->prefix);
        }
 
-       lxc_list_add(&netdev->ipv4, list);
+       lxc_list_add_tail(&netdev->ipv4, list);
 
        free(addr);
        return 0;
@@ -716,7 +716,7 @@ static int config_network_ipv6(const char *key, const char 
*value,
                return -1;
        }
 
-       lxc_list_add(&netdev->ipv6, list);
+       lxc_list_add_tail(&netdev->ipv6, list);
 
        free(valdup);
        return 0;
-- 
1.7.2.5


------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to