59e838db401f7d00cab3dc0b741beb6c4853bb31 galt Mon Jul 22 15:22:54 2019 -0700 improved subnet error diff --git src/lib/internet.c src/lib/internet.c index 702ae82..dcd4e14 100644 --- src/lib/internet.c +++ src/lib/internet.c @@ -418,34 +418,35 @@ struct in6_addr careMask6; ip6AddrMaskLeft(&careMask6, cidr->subnetLength); struct in6_addr subMasked, clientIpMasked; ip6AddrAndBits(&cidr->ipv6, &careMask6, &subMasked); ip6AddrAndBits(clientIp, &careMask6, &clientIpMasked); if (ip6AddrCmpBits(&subMasked, &clientIpMasked) == 0) // they are equal return TRUE; } return FALSE; } static void notGoodSubnetCidr(char *sns) /* Complain about subnet format. */ { -errAbort("'%s' is not a properly formatted subnet. Subnets must consist of\n" - "one to four dot-separated numbers between 0 and 255 \n" - "optionally followed by an slash and subnet bit length integer between 1 and 32.\n" - "A trailing dot on the subnet IP address is not allowed.", sns); +errAbort("'%s' is not a properly formatted subnet.\n" + "Subnets in IPv4 must consist of one to four dot-separated numbers between 0 and 255 \n" + "optionally followed by a CIDR slash and subnet bit length integer between 1 and 32, and trailing dot is not allowed.\n" + "Subnets in IPv6 must consist of an IPv6 address followed by a CIDR slash and 1 and 128 for IPv6 addresses.\n" + "Multiple subnets may be provided in a comma-separated list.", sns); } struct cidr *internetParseOneSubnetCidr(char *cidr) /* parse one input CIDR format IP for range or subnet */ { char *s = cloneString(cidr); char *c = strchr(s, '/'); char *ip = s; int bits = -1; int bitsMax = 32; if (c) // has slash { *c++ = 0; bits = atoi(c); }