From 6168e99ffffd5e04aaff9981803d0c04cc682b6a Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Fri, 23 Jul 2010 15:10:38 +0200 Subject: [PATCH] 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 --- src/lxc/conf.c | 5 +++++ 1 file changed, 5 insertions(+) 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); -- 2.47.2