From: Daniel Lezcano Date: Fri, 23 Jul 2010 13:10:38 +0000 (+0200) Subject: fix core dump when using physical interface X-Git-Tag: lxc-0.7.2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6168e99ffffd5e04aaff9981803d0c04cc682b6a;p=thirdparty%2Flxc.git fix core dump when using physical interface 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 Reported-by: Ferenc Wagner --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index a118ae197..8cc1a8f5c 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -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);