From 0e682b2d060bbf4e3178f942408c900625a92696 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Mon, 16 Feb 2004 19:14:29 +0000 Subject: [PATCH] refined test-routine to work in vservers without 'lo' interface git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@898 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- util-vserver/src/chbind.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/util-vserver/src/chbind.c b/util-vserver/src/chbind.c index 21981ce..90bf13c 100644 --- a/util-vserver/src/chbind.c +++ b/util-vserver/src/chbind.c @@ -302,6 +302,7 @@ void test() { struct vc_ip_mask_pair ip; uint32_t bcast; + uint32_t tmp; bcast = 0; readIP("1.2.3.4", &ip, &bcast); @@ -315,8 +316,10 @@ void test() readIP("localhost", &ip, &bcast); assert(ip.ip==ntohl(0x7f000001) && ip.mask==ntohl(0xffffff00) && bcast==0); - - readIP("lo", &ip, &bcast); - assert(ip.ip==ntohl(0x7f000001) && ip.mask==ntohl(0xff000000) && bcast==ntohl(0x7fffffff)); + + if (ifconfig_getaddr("lo", &tmp, &tmp, &tmp)!=-1) { + readIP("lo", &ip, &bcast); + assert(ip.ip==ntohl(0x7f000001) && ip.mask==ntohl(0xff000000) && bcast==ntohl(0x7fffffff)); + } } #endif -- 1.8.1.5