Don't bother checking an ip[46].addr netmask/prefixlen. This is already

handled by ifconfig, and it was doing it wrong when the paramater included
extra ifconfig options.

PR:		205926
MFC after:	5 days
This commit is contained in:
Jamie Gritton 2016-01-16 22:32:57 +00:00
parent 6d4bd09012
commit 5160b6a7e6

View File

@ -454,7 +454,7 @@ check_intparams(struct cfjail *j)
struct addrinfo hints;
struct addrinfo *ai0, *ai;
const char *hostname;
int gicode, defif, prefix;
int gicode, defif;
#endif
#ifdef INET
struct in_addr addr4;
@ -597,15 +597,7 @@ check_intparams(struct cfjail *j)
strcpy(s->s, cs + 1);
s->len -= cs + 1 - s->s;
}
if ((cs = strchr(s->s, '/'))) {
prefix = strtol(cs + 1, &ep, 10);
if (*ep == '.'
? inet_pton(AF_INET, cs + 1, &addr4) != 1
: *ep || prefix < 0 || prefix > 32) {
jail_warnx(j,
"ip4.addr: bad netmask \"%s\"", cs);
error = -1;
}
if ((cs = strchr(s->s, '/')) != NULL) {
*cs = '\0';
s->len = cs - s->s;
}
@ -626,14 +618,7 @@ check_intparams(struct cfjail *j)
strcpy(s->s, cs + 1);
s->len -= cs + 1 - s->s;
}
if ((cs = strchr(s->s, '/'))) {
prefix = strtol(cs + 1, &ep, 10);
if (*ep || prefix < 0 || prefix > 128) {
jail_warnx(j,
"ip6.addr: bad prefixlen \"%s\"",
cs);
error = -1;
}
if ((cs = strchr(s->s, '/')) != NULL) {
*cs = '\0';
s->len = cs - s->s;
}