Changeset 2668

Show
Ignore:
Timestamp:
01/21/08 15:13:52 (10 months ago)
Author:
dhozac
Message:

Don't require a netmask/prefix.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/naddress.c

    r2616 r2668  
    245245  char const *fc; 
    246246  char str[len + 1], *ptr = str; 
    247   int ret = -1
     247  int ret = 0
    248248 
    249249  strcpy(str, str_c); 
     
    262262    } 
    263263 
    264     if ((sep = memchr(ptr, *(fc + 1), len)) == NULL) { 
     264    if (len == 0) 
    265265      goto out; 
    266     } 
     266    if ((sep = memchr(ptr, *(fc + 1), len)) == NULL) 
     267      sep = ptr + len; 
    267268    *sep = '\0'; 
    268269 
     
    281282 
    282283      if (!isNumberUnsigned(ptr, &sz, true) || sz > limit) { 
     284        ret = -1; 
    283285        goto out; 
    284286      } 
     
    296298    else { 
    297299      if (convertAddress(ptr, &(*ips)->a.vna_type, dst) == -1) { 
     300        ret = -1; 
    298301        goto out; 
    299302      } 
     
    304307    } 
    305308 
     309    ret++; 
     310    len -= (sep - ptr); 
    306311    ptr = sep + 1; 
    307312 
     
    309314      break; 
    310315  } 
    311   ret = 0; 
    312316 
    313317out: 
     
    320324{ 
    321325  if (ifconfig_getaddr(str, &(*ips)->a.vna_v4_ip.s_addr, &(*ips)->a.vna_v4_mask.s_addr, NULL)==-1) { 
    322     if (parseIPFormat(str, ips, "1/m") == -1) { 
     326    if (parseIPFormat(str, ips, "1/m") < 1) { 
    323327      WRITE_MSG(2, "Invalid IP number '"); 
    324328      WRITE_STR(2, str); 
     
    356360readRange(char const *str, struct vc_ips **ips) 
    357361{ 
    358   if (parseIPFormat(str, ips, "1-2/m") == -1) { 
     362  if (parseIPFormat(str, ips, "1-2/m") < 2) { 
    359363    WRITE_MSG(2, "Invalid range '"); 
    360364    WRITE_STR(2, str);