summaryrefslogtreecommitdiffstats
path: root/usr.sbin/jail
diff options
context:
space:
mode:
authorjamie <jamie@FreeBSD.org>2012-08-23 01:43:22 +0000
committerjamie <jamie@FreeBSD.org>2012-08-23 01:43:22 +0000
commit5aeb73af6c7bed7a202fdbe8f227a82f48caf5ea (patch)
tree2de29aeb81e8899c3fda1a5e72173bc7ca50cc53 /usr.sbin/jail
parent2c0fa1424091a2dec98b12412d446a9cac3edc15 (diff)
downloadFreeBSD-src-5aeb73af6c7bed7a202fdbe8f227a82f48caf5ea.zip
FreeBSD-src-5aeb73af6c7bed7a202fdbe8f227a82f48caf5ea.tar.gz
Pre-separate IP addresses passed on the command line, so they can be
properly parsed for interface prefixes and netmask suffixes. This was already done for the old-style (fixed) command line, but missed for the new-style. MFC after: 1 week
Diffstat (limited to 'usr.sbin/jail')
-rw-r--r--usr.sbin/jail/jail.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/usr.sbin/jail/jail.c b/usr.sbin/jail/jail.c
index 78160c0..6970ae1 100644
--- a/usr.sbin/jail/jail.c
+++ b/usr.sbin/jail/jail.c
@@ -304,9 +304,33 @@ main(int argc, char **argv)
for (i++; i < argc; i++)
add_param(NULL, NULL, IP_COMMAND,
argv[i]);
- break;
}
- add_param(NULL, NULL, 0, argv[i]);
+#ifdef INET
+ else if (!strncmp(argv[i], "ip4.addr=", 9)) {
+ for (cs = argv[i] + 9;; cs = ncs + 1) {
+ ncs = strchr(cs, ',');
+ if (ncs)
+ *ncs = '\0';
+ add_param(NULL, NULL, KP_IP4_ADDR, cs);
+ if (!ncs)
+ break;
+ }
+ }
+#endif
+#ifdef INET6
+ else if (!strncmp(argv[i], "ip6.addr=", 9)) {
+ for (cs = argv[i] + 9;; cs = ncs + 1) {
+ ncs = strchr(cs, ',');
+ if (ncs)
+ *ncs = '\0';
+ add_param(NULL, NULL, KP_IP6_ADDR, cs);
+ if (!ncs)
+ break;
+ }
+ }
+#endif
+ else
+ add_param(NULL, NULL, 0, argv[i]);
}
} else {
/* From the config file, perhaps with a specified jail */
OpenPOWER on IntegriCloud