Author: jamie
Date: Thu Aug 23 01:43:22 2012
New Revision: 239602
URL: http://svn.freebsd.org/changeset/base/239602

Log:
  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

Modified:
  head/usr.sbin/jail/jail.c

Modified: head/usr.sbin/jail/jail.c
==============================================================================
--- head/usr.sbin/jail/jail.c   Thu Aug 23 01:43:01 2012        (r239601)
+++ head/usr.sbin/jail/jail.c   Thu Aug 23 01:43:22 2012        (r239602)
@@ -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 */
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to