]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
New options added, and some magic code to parse unknown options.
authorShane Kerr <shane@isc.org>
Wed, 26 Jul 2006 15:43:52 +0000 (15:43 +0000)
committerShane Kerr <shane@isc.org>
Wed, 26 Jul 2006 15:43:52 +0000 (15:43 +0000)
See ticket rt15925.

RELNOTES
common/dhcp-options.5
common/parse.c
common/tables.c

index c77b6c278f03db17c36f9c75194a0f86621bebf3..a15b1758614a5c136b67c9956b8fa5310276dc37 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -211,6 +211,17 @@ and for prodding me into improving it.
   multiple identifiers (previous versions would silently over-ride the
   value with the later configured value).
 
+- Several option codes that have been allocated since our last release
+  have been named and documented.
+
+- Option names of the form "unknown-123" have been removed from the in-
+  memory hash tables.  In order to support options of these names that
+  may appear in dhclient.leases or similar in previous versions, the
+  parser will now find the new option code definition, or mock up a
+  generic option code definition.  This should result in a smooth
+  transition from one name to the other, as the new name is used to
+  write new output.
+
                        Changes since 3.0.4rc1
 
 - The dhcp-options.5 manpage was updated to correct indentation errors
index 923d624f9e7eff814227c664cf1c9018df89d0f6..76d8448ebec156c08f5c0707d80fac0810b09c12 100644 (file)
@@ -1,4 +1,4 @@
-.\"    $Id: dhcp-options.5,v 1.30 2006/07/22 02:24:16 dhankins Exp $
+.\"    $Id: dhcp-options.5,v 1.31 2006/07/26 15:43:52 shane Exp $
 .\"
 .\" Copyright (c) 2004-2006 by Internet Systems Consortium, Inc. ("ISC")
 .\" Copyright (c) 1996-2003 by Internet Software Consortium
@@ -168,6 +168,14 @@ some subnets of the directly connected network may have smaller MTUs.
 This option specifies the timeout in seconds for ARP cache entries.
 .RE
 .PP
+.B option \fBbcms-controller-address\fR \fIip-address\fR [\fB,\fR
+\fIip-address\fR... ]\fB;\fR
+.RS 0.25i
+.PP
+This option configures a list of IPv4 addresses for use as Broadcast and
+Multicast Controller Servers ("BCMS").
+.RE
+.PP
 .B option \fBbootfile-name\fR \fItext\fR\fB;\fR
 .RS 0.25i
 .PP
@@ -215,6 +223,15 @@ This option specifies the default TTL that the client should use when
 sending TCP segments.  The minimum value is 1.
 .RE
 .PP
+.B option \fBdefault-url\fR \fIstring\fR\fB;\fR
+.RS 0.25i
+.PP
+The format and meaning of this option is not described in any standards
+document, but is claimed to be in use by Apple Computer.  It is not known
+what clients may reasonably do if supplied with this option.  Use at your
+own risk.
+.RE
+.PP
 .B option \fBdhcp-client-identifier\fR \fIstring\fR\fB;\fR
 .RS 0.25i
 .PP
@@ -612,6 +629,27 @@ parameter for the client as specified in RFC 1001/1002. See RFC1001,
 RFC1002, and RFC1035 for character-set restrictions.
 .RE
 .PP
+.B option \fBnetinfo-server-address\fR \fIip-address\fR [\fB,\fR
+\fIip-address\fR... ]\fB;\fR
+.RS 0.25i
+.PP
+The \fBnetinfo-server-address\fR option has not been described in any
+RFC, but has been allocated (and is claimed to be in use) by Apple
+Computers.  It's hard to say if the above is the correct format, or
+what clients might be expected to do if values were configured.  Use
+at your own risk.
+.RE
+.PP
+.B option \fBnetinfo-server-tag\fR \fItext\fR\fB;\fR
+.RS 0.25i
+.PP
+The \fBnetinfo-server-tag\fR option has not been described in any
+RFC, but has been allocated (and is claimed to be in use) by Apple
+Computers.  It's hard to say if the above is the correct format,
+or what clients might be expected to do if values were configured.  Use
+at your own risk.
+.RE
+.PP
 .B option \fBnis-domain\fR \fItext\fR\fB;\fR
 .RS 0.25i
 .PP
index e460f844b7368a2f85fdc3394efa86e64b6c7da1..0bda8de4d8467c15e15ea0e7f9ab4b7ce9e40755 100644 (file)
@@ -34,7 +34,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: parse.c,v 1.114 2006/07/25 09:59:39 shane Exp $ Copyright (c) 2004-2006 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: parse.c,v 1.115 2006/07/26 15:43:52 shane Exp $ Copyright (c) 2004-2006 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -944,6 +944,7 @@ parse_option_name (cfile, allocate, known, opt)
        char *uname;
        struct universe *universe;
        struct option *option;
+       unsigned code;
 
        if (opt == NULL)
                return ISC_R_INVALIDARG;
@@ -998,23 +999,66 @@ parse_option_name (cfile, allocate, known, opt)
        if (option) {
                if (known)
                        *known = 1;
-       } else {
-               /* If we've been told to allocate, that means that this
-                  (might) be an option code definition, so we'll create
-                  an option structure just in case. */
-               if (allocate) {
-                       option = new_option(val, MDL);
-                       option -> universe = universe;
-                       option_reference(opt, option, MDL);
+       /* If the option name is of the form unknown-[decimal], use
+        * the trailing decimal value to find the option definition.
+        * If there is no definition, construct one.  This is to
+        * support legacy use of unknown options in config files or
+        * lease databases.
+        */
+       } else if (strncasecmp(val, "unknown-", 8) == 0) {
+               code = atoi(val+8);
 
+               /* Option code 0 is always illegal for us, thanks
+                * to the option decoder.
+                */
+               if (code == 0 || code == universe->end) {
+                       parse_warn(cfile, "Option codes 0 and %u are illegal "
+                                         "in the %s space.", universe->end,
+                                         universe->name);
+                       skip_to_semi(cfile);
                        dfree(uname, MDL);
-                       return ISC_R_SUCCESS;
+                       return ISC_R_FAILURE;
                }
-               if (val == uname)
-                       parse_warn (cfile, "no option named %s", val);
-               else
-                       parse_warn (cfile, "no option named %s in space %s",
-                                   val, uname);
+
+               /* It's odd to think of unknown option codes as
+                * being known, but this means we know what the
+                * parsed name is talking about.
+                */
+               if (known)
+                       *known = 1;
+
+               option_code_hash_lookup(opt, universe->code_hash,
+                                       &code, 0, MDL);
+               option = *opt;
+
+               /* If we did not find an option of that code,
+                * manufacture an unknown-xxx option definition.
+                * Its single reference will ensure that it is
+                * deleted once the option is recycled out of
+                * existence (by the parent).
+                */
+               if (option == NULL) {
+                       option = new_option(val, MDL);
+                       option->universe = universe;
+                       option->code = code;
+                       option->format = "X";
+                       option_reference(opt, option, MDL);
+               } else
+                       log_info("option %s has been redefined as option %s.  "
+                                "Please update your configs if neccessary.",
+                                val, option->name);
+       /* If we've been told to allocate, that means that this
+        * (might) be an option code definition, so we'll create
+        * an option structure and return it for the parent to
+        * decide.
+        */
+       } else if (allocate) {
+               option = new_option(val, MDL);
+               option -> universe = universe;
+               option_reference(opt, option, MDL);
+       } else {
+               parse_warn(cfile, "no option named %s in space %s",
+                          val, universe->name);
                skip_to_semi (cfile);
                dfree(uname, MDL);
                return ISC_R_NOTFOUND;
@@ -4569,13 +4613,12 @@ int parse_option_statement (result, cfile, lookups, option, op)
 
              and_again:
                /* Set fmt to start of format for 'A' and one char back
-                  for 'a' */
-                if ((fmt != NULL) &&
-                   (fmt != option -> format) && (*fmt == 'a'))
+                * for 'a'.
+                */
+               if ((fmt != NULL) && (fmt != option->format) && (*fmt == 'a'))
                        fmt -= 1;
-               else
-                       fmt = ((fmt == NULL) ||
-                              (*fmt == 'A')) ? option -> format : fmt;
+               else if ((fmt == NULL) || (*fmt == 'A'))
+                       fmt = option->format;
 
                /* 'a' means always uniform */
                uniform |= (fmt [1] == 'a');
index 030f8dd711d8779fe514932833a28ade43a38f5a..fb7d3367d624afd3c5f1c59839906e382c84e38d 100644 (file)
@@ -34,7 +34,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: tables.c,v 1.57 2006/07/25 13:25:59 shane Exp $ Copyright (c) 2004-2006 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: tables.c,v 1.58 2006/07/26 15:43:52 shane Exp $ Copyright (c) 2004-2006 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -184,13 +184,52 @@ static struct option dhcp_options[] = {
        { "nds-servers", "IA",                  &dhcp_universe,  85, 1 },
        { "nds-tree-name", "t",                 &dhcp_universe,  86, 1 },
        { "nds-context", "t",                   &dhcp_universe,  87, 1 },
+       { "bcms-controller-address", "Ia",      &dhcp_universe,  89, 1 },
+#if 0
+       /* Not defined by RFC yet */
+       { "pxe-system-type", "S",               &dhcp_universe,  93, 1 },
+       { "pxe-interface-id", "BBB",            &dhcp_universe,  94, 1 },
+       { "pxe-client-id", "BX",                &dhcp_universe,  97, 1 },
+#endif
        { "client-last-transaction-time", "L",  &dhcp_universe,  91, 1 },
        { "associated-ip", "Ia",                &dhcp_universe,  92, 1 },
        { "uap-servers", "t",                   &dhcp_universe,  98, 1 },
+       { "netinfo-server-address", "Ia",       &dhcp_universe, 112, 1 },
+       { "netinfo-server-tag", "t",            &dhcp_universe, 113, 1 },
+       { "default-url", "t",                   &dhcp_universe, 114, 1 },
        { "subnet-selection", "I",              &dhcp_universe, 118, 1 },
        { "domain-search", "D",                 &dhcp_universe, 119, 1 },
        { "vivco", "Evendor-class.",            &dhcp_universe, 124, 1 },
        { "vivso", "Evendor.",                  &dhcp_universe, 125, 1 },
+#if 0
+       /* Not defined by RFC yet.
+        * DO NOT UNCOMMENT THESE DEFINITIONS: these names are placeholders
+        * and will not be used in future versions of the software.
+        */
+       { "pxe-undefined-1", "X",               &dhcp_universe, 128, 1 },
+       { "pxe-undefined-2", "X",               &dhcp_universe, 129, 1 },
+       { "pxe-undefined-3", "X",               &dhcp_universe, 130, 1 },
+       { "pxe-undefined-4", "X",               &dhcp_universe, 131, 1 },
+       { "pxe-undefined-5", "X",               &dhcp_universe, 132, 1 },
+       { "pxe-undefined-6", "X",               &dhcp_universe, 133, 1 },
+       { "pxe-undefined-7", "X",               &dhcp_universe, 134, 1 },
+       { "pxe-undefined-8", "X",               &dhcp_universe, 135, 1 },
+#endif
+#if 0
+       /* Not defined by RFC yet */
+       { "tftp-server-address", "Ia",          &dhcp_universe, 150, 1 },
+#endif
+#if 0
+       /* PXELINUX options: not defined by RFC yet */
+       { "pxelinux-magic", "BBBB",             &dhcp_universe, 208, 1 },
+       { "loader-configfile", "t",             &dhcp_universe, 209, 1 },
+       { "loader-pathprefix", "t",             &dhcp_universe, 210, 1 },
+       { "loader-reboottime", "L",             &dhcp_universe, 211, 1 },
+#endif
+#if 0
+       /* Not defined by RFC yet */
+       { "vss-info", "BX",                     &dhcp_universe, 221, 1 },
+#endif
        { NULL, NULL, NULL, 0, 0 }
 };