refined test-routine to work in vservers without 'lo' interface
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Mon, 16 Feb 2004 19:14:29 +0000 (19:14 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Mon, 16 Feb 2004 19:14:29 +0000 (19:14 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@898 94cd875c-1c1d-0410-91d2-eb244daf1a30

util-vserver/src/chbind.c

index 21981ce..90bf13c 100644 (file)
@@ -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