]> git.proxmox.com Git - mirror_lxc.git/commitdiff
fix core dump when using physical interface
authorDaniel Lezcano <daniel.lezcano@free.fr>
Fri, 23 Jul 2010 13:10:38 +0000 (15:10 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Fri, 23 Jul 2010 13:10:38 +0000 (15:10 +0200)
If the physical link is not specified in the configuration
the check in if_nametoindex(netdev->link) leads to a segfault.

Check the link is specified.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Reported-by: Ferenc Wagner <wferi@niif.hu>
src/lxc/conf.c

index a118ae197cc75ef6b6a87f79adc8eaab4dd588f8..8cc1a8f5ca4c88013c2978e777504393d82e3266 100644 (file)
@@ -1285,6 +1285,11 @@ static int instanciate_vlan(struct lxc_netdev *netdev)
 
 static int instanciate_phys(struct lxc_netdev *netdev)
 {
+       if (!netdev->link) {
+               ERROR("no link specified for the physical interface");
+               return -1;
+       }
+
        netdev->ifindex = if_nametoindex(netdev->link);
        if (!netdev->ifindex) {
                ERROR("failed to retrieve the index for %s", netdev->link);