summaryrefslogtreecommitdiff
path: root/usr.sbin/jail/config.c
diff options
context:
space:
mode:
authorJamie Gritton <jamie@FreeBSD.org>2010-10-27 20:25:55 +0000
committerJamie Gritton <jamie@FreeBSD.org>2010-10-27 20:25:55 +0000
commit47fdec177ac609f1b665ae86e179a179dbe69a7b (patch)
tree2783ca1259f3013d6bfca37860721326e0628cad /usr.sbin/jail/config.c
parent50f0104e67d343436aeed44ef796366714dc1cea (diff)
downloadsrc-test2-47fdec177ac609f1b665ae86e179a179dbe69a7b.tar.gz
src-test2-47fdec177ac609f1b665ae86e179a179dbe69a7b.zip
Notes
Diffstat (limited to 'usr.sbin/jail/config.c')
-rw-r--r--usr.sbin/jail/config.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/usr.sbin/jail/config.c b/usr.sbin/jail/config.c
index f37b49fc8bd9..4bc8938c373f 100644
--- a/usr.sbin/jail/config.c
+++ b/usr.sbin/jail/config.c
@@ -580,13 +580,23 @@ ip_params(struct cfjail *j)
}
if ((cs = strchr(s->s, '/'))) {
prefix = strtol(cs + 1, &ep, 10);
- if (!isip6 && *ep == '.'
+ if (
+#ifdef INET6
+ !isip6 &&
+#endif
+ *ep == '.'
? inet_pton(AF_INET, cs + 1, &addr4) != 1
- : *ep || prefix < 0 || prefix >
- (isip6 ? 128 : 32)) {
- jail_warnx(j, isip6
- ? "ip6.addr: bad prefixlen \"%s\""
- : "ip4.addr: bad netmask \"%s\"",
+ : *ep || prefix < 0 || prefix > (
+#ifdef INET6
+ isip6 ? 128 :
+#endif
+ 32)) {
+ jail_warnx(j,
+#ifdef INET6
+ isip6
+ ? "ip6.addr: bad prefixlen \"%s\"" :
+#endif
+ "ip4.addr: bad netmask \"%s\"",
cs);
error = -1;
}