From: Enrico Scholz Date: Mon, 16 Feb 2004 19:14:29 +0000 (+0000) Subject: refined test-routine to work in vservers without 'lo' interface X-Git-Tag: VERSION_0_10~663 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e682b2d060bbf4e3178f942408c900625a92696;p=util-vserver.git 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 --- 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