X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fsrc%2Fifspec.c;h=6121615d131b4c04af7fb0a0733e12099c26db62;hb=a917f24ef7b003dcef54a3db2644cf9cb4bc2db2;hp=803a15d2b0f0e89e236a0e5b31a04451083a80cc;hpb=9dbaad751b3abd6eddf6f0274fb136fb0d0dbe97;p=util-vserver.git diff --git a/util-vserver/src/ifspec.c b/util-vserver/src/ifspec.c index 803a15d..6121615 100644 --- a/util-vserver/src/ifspec.c +++ b/util-vserver/src/ifspec.c @@ -108,7 +108,7 @@ int ifconfig_print ( struct { unsigned long addr; unsigned long mask; - } solved; + } solved = {0,0}; if (addrstr != NULL && addrstr[0] != '\0'){ printf ("ADDR=%s\n",addrstr); solved.addr = ip_cnv (addrstr); @@ -123,6 +123,10 @@ int ifconfig_print ( solved.addr = addr; ret = 0; } + else { + perror("ifspec: ioctl(SIOCGIFADDR)"); + } + if (maskstr != NULL && maskstr[0] != '\0'){ printf ("NETMASK=%s\n",maskstr); solved.mask = ip_cnv (maskstr); @@ -137,6 +141,10 @@ int ifconfig_print ( solved.mask = addr; ret = 0; } + else { + perror("ifspec: ioctl(SIOCGIFNETMASK)"); + } + if (bcaststr != NULL && bcaststr[0] != '\0'){ printf ("BCAST=%s\n",bcaststr); }else if (ifconfig_ioctl(skfd,ifname,SIOCGIFBRDADDR, &ifr) >= 0){ @@ -148,7 +156,7 @@ int ifconfig_print ( ,(addr>>8)&0xff ,addr&0xff); ret = 0; - }else{ + }else if (solved.addr!=0 && solved.mask!=0) { // Can't get it from the kernel, compute it from the IP // and the netmask unsigned long addr = (solved.addr & solved.mask)