Annotation of embedaddon/dhcp/common/tables.c, revision 1.1
1.1 ! misho 1: /* tables.c
! 2:
! 3: Tables of information... */
! 4:
! 5: /*
! 6: * Copyright (c) 2004-2009 by Internet Systems Consortium, Inc. ("ISC")
! 7: * Copyright (c) 1995-2003 by Internet Software Consortium
! 8: *
! 9: * Permission to use, copy, modify, and distribute this software for any
! 10: * purpose with or without fee is hereby granted, provided that the above
! 11: * copyright notice and this permission notice appear in all copies.
! 12: *
! 13: * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
! 14: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
! 15: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
! 16: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
! 17: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
! 18: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
! 19: * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
! 20: *
! 21: * Internet Systems Consortium, Inc.
! 22: * 950 Charter Street
! 23: * Redwood City, CA 94063
! 24: * <info@isc.org>
! 25: * https://www.isc.org/
! 26: *
! 27: * This software has been written for Internet Systems Consortium
! 28: * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
! 29: * To learn more about Internet Systems Consortium, see
! 30: * ``https://www.isc.org/''. To learn more about Vixie Enterprises,
! 31: * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
! 32: * ``http://www.nominum.com''.
! 33: */
! 34:
! 35: #include "dhcpd.h"
! 36:
! 37: /* XXXDPN: Moved here from hash.c, when it moved to libomapi. Not sure
! 38: where these really belong. */
! 39: HASH_FUNCTIONS (group, const char *, struct group_object, group_hash_t,
! 40: group_reference, group_dereference, do_string_hash)
! 41: HASH_FUNCTIONS (universe, const char *, struct universe, universe_hash_t, 0, 0,
! 42: do_case_hash)
! 43: HASH_FUNCTIONS (option_name, const char *, struct option, option_name_hash_t,
! 44: option_reference, option_dereference, do_case_hash)
! 45: HASH_FUNCTIONS (option_code, const unsigned *, struct option,
! 46: option_code_hash_t, option_reference, option_dereference,
! 47: do_number_hash)
! 48:
! 49: /* DHCP Option names, formats and codes, from RFC1533.
! 50:
! 51: Format codes:
! 52:
! 53: I - IPv4 address
! 54: 6 - IPv6 address
! 55: l - 32-bit signed integer
! 56: L - 32-bit unsigned integer
! 57: s - 16-bit signed integer
! 58: S - 16-bit unsigned integer
! 59: b - 8-bit signed integer
! 60: B - 8-bit unsigned integer
! 61: t - ASCII text
! 62: T - Lease Time, 32-bit unsigned integer implying a number of seconds from
! 63: some event. The special all-ones value means 'infinite'. May either
! 64: be printed as a decimal, eg, "3600", or as this name, eg, "infinite".
! 65: f - flag (true or false)
! 66: A - array of whatever precedes (e.g., IA means array of IP addresses)
! 67: a - array of the preceding character (e.g., IIa means two or more IP
! 68: addresses)
! 69: U - name of an option space (universe)
! 70: F - implicit flag - the presence of the option indicates that the
! 71: flag is true.
! 72: o - the preceding value is optional.
! 73: E - encapsulation, string or colon-separated hex list (the latter
! 74: two for parsing). E is followed by a text string containing
! 75: the name of the option space to encapsulate, followed by a '.'.
! 76: If the E is immediately followed by '.', the applicable vendor
! 77: option space is used if one is defined.
! 78: e - If an encapsulation directive is not the first thing in the string,
! 79: the option scanner requires an efficient way to find the encapsulation.
! 80: This is done by placing a 'e' at the beginning of the option. The
! 81: 'e' has no other purpose, and is not required if 'E' is the first
! 82: thing in the option.
! 83: X - either an ASCII string or binary data. On output, the string is
! 84: scanned to see if it's printable ASCII and, if so, output as a
! 85: quoted string. If not, it's output as colon-separated hex. On
! 86: input, the option can be specified either as a quoted string or as
! 87: a colon-separated hex list.
! 88: N - enumeration. N is followed by a text string containing
! 89: the name of the set of enumeration values to parse or emit,
! 90: followed by a '.'. The width of the data is specified in the
! 91: named enumeration. Named enumerations are tracked in parse.c.
! 92: d - Domain name (i.e., FOO or FOO.BAR).
! 93: D - Domain list (i.e., example.com eng.example.com)
! 94: c - When following a 'D' atom, enables compression pointers.
! 95: Z - Zero-length option
! 96: */
! 97:
! 98: struct universe dhcp_universe;
! 99: static struct option dhcp_options[] = {
! 100: { "subnet-mask", "I", &dhcp_universe, 1, 1 },
! 101: { "time-offset", "l", &dhcp_universe, 2, 1 },
! 102: { "routers", "IA", &dhcp_universe, 3, 1 },
! 103: { "time-servers", "IA", &dhcp_universe, 4, 1 },
! 104: { "ien116-name-servers", "IA", &dhcp_universe, 5, 1 },
! 105: { "domain-name-servers", "IA", &dhcp_universe, 6, 1 },
! 106: { "log-servers", "IA", &dhcp_universe, 7, 1 },
! 107: { "cookie-servers", "IA", &dhcp_universe, 8, 1 },
! 108: { "lpr-servers", "IA", &dhcp_universe, 9, 1 },
! 109: { "impress-servers", "IA", &dhcp_universe, 10, 1 },
! 110: { "resource-location-servers", "IA", &dhcp_universe, 11, 1 },
! 111: { "host-name", "t", &dhcp_universe, 12, 1 },
! 112: { "boot-size", "S", &dhcp_universe, 13, 1 },
! 113: { "merit-dump", "t", &dhcp_universe, 14, 1 },
! 114: { "domain-name", "t", &dhcp_universe, 15, 1 },
! 115: { "swap-server", "I", &dhcp_universe, 16, 1 },
! 116: { "root-path", "t", &dhcp_universe, 17, 1 },
! 117: { "extensions-path", "t", &dhcp_universe, 18, 1 },
! 118: { "ip-forwarding", "f", &dhcp_universe, 19, 1 },
! 119: { "non-local-source-routing", "f", &dhcp_universe, 20, 1 },
! 120: { "policy-filter", "IIA", &dhcp_universe, 21, 1 },
! 121: { "max-dgram-reassembly", "S", &dhcp_universe, 22, 1 },
! 122: { "default-ip-ttl", "B", &dhcp_universe, 23, 1 },
! 123: { "path-mtu-aging-timeout", "L", &dhcp_universe, 24, 1 },
! 124: { "path-mtu-plateau-table", "SA", &dhcp_universe, 25, 1 },
! 125: { "interface-mtu", "S", &dhcp_universe, 26, 1 },
! 126: { "all-subnets-local", "f", &dhcp_universe, 27, 1 },
! 127: { "broadcast-address", "I", &dhcp_universe, 28, 1 },
! 128: { "perform-mask-discovery", "f", &dhcp_universe, 29, 1 },
! 129: { "mask-supplier", "f", &dhcp_universe, 30, 1 },
! 130: { "router-discovery", "f", &dhcp_universe, 31, 1 },
! 131: { "router-solicitation-address", "I", &dhcp_universe, 32, 1 },
! 132: { "static-routes", "IIA", &dhcp_universe, 33, 1 },
! 133: { "trailer-encapsulation", "f", &dhcp_universe, 34, 1 },
! 134: { "arp-cache-timeout", "L", &dhcp_universe, 35, 1 },
! 135: { "ieee802-3-encapsulation", "f", &dhcp_universe, 36, 1 },
! 136: { "default-tcp-ttl", "B", &dhcp_universe, 37, 1 },
! 137: { "tcp-keepalive-interval", "L", &dhcp_universe, 38, 1 },
! 138: { "tcp-keepalive-garbage", "f", &dhcp_universe, 39, 1 },
! 139: { "nis-domain", "t", &dhcp_universe, 40, 1 },
! 140: { "nis-servers", "IA", &dhcp_universe, 41, 1 },
! 141: { "ntp-servers", "IA", &dhcp_universe, 42, 1 },
! 142: { "vendor-encapsulated-options", "E.", &dhcp_universe, 43, 1 },
! 143: { "netbios-name-servers", "IA", &dhcp_universe, 44, 1 },
! 144: { "netbios-dd-server", "IA", &dhcp_universe, 45, 1 },
! 145: { "netbios-node-type", "B", &dhcp_universe, 46, 1 },
! 146: { "netbios-scope", "t", &dhcp_universe, 47, 1 },
! 147: { "font-servers", "IA", &dhcp_universe, 48, 1 },
! 148: { "x-display-manager", "IA", &dhcp_universe, 49, 1 },
! 149: { "dhcp-requested-address", "I", &dhcp_universe, 50, 1 },
! 150: { "dhcp-lease-time", "L", &dhcp_universe, 51, 1 },
! 151: { "dhcp-option-overload", "B", &dhcp_universe, 52, 1 },
! 152: { "dhcp-message-type", "B", &dhcp_universe, 53, 1 },
! 153: { "dhcp-server-identifier", "I", &dhcp_universe, 54, 1 },
! 154: { "dhcp-parameter-request-list", "BA", &dhcp_universe, 55, 1 },
! 155: { "dhcp-message", "t", &dhcp_universe, 56, 1 },
! 156: { "dhcp-max-message-size", "S", &dhcp_universe, 57, 1 },
! 157: { "dhcp-renewal-time", "L", &dhcp_universe, 58, 1 },
! 158: { "dhcp-rebinding-time", "L", &dhcp_universe, 59, 1 },
! 159: { "vendor-class-identifier", "X", &dhcp_universe, 60, 1 },
! 160: { "dhcp-client-identifier", "X", &dhcp_universe, 61, 1 },
! 161: { "nwip-domain", "t", &dhcp_universe, 62, 1 },
! 162: { "nwip-suboptions", "Enwip.", &dhcp_universe, 63, 1 },
! 163: { "nisplus-domain", "t", &dhcp_universe, 64, 1 },
! 164: { "nisplus-servers", "IA", &dhcp_universe, 65, 1 },
! 165: { "tftp-server-name", "t", &dhcp_universe, 66, 1 },
! 166: { "bootfile-name", "t", &dhcp_universe, 67, 1 },
! 167: { "mobile-ip-home-agent", "IA", &dhcp_universe, 68, 1 },
! 168: { "smtp-server", "IA", &dhcp_universe, 69, 1 },
! 169: { "pop-server", "IA", &dhcp_universe, 70, 1 },
! 170: { "nntp-server", "IA", &dhcp_universe, 71, 1 },
! 171: { "www-server", "IA", &dhcp_universe, 72, 1 },
! 172: { "finger-server", "IA", &dhcp_universe, 73, 1 },
! 173: { "irc-server", "IA", &dhcp_universe, 74, 1 },
! 174: { "streettalk-server", "IA", &dhcp_universe, 75, 1 },
! 175: { "streettalk-directory-assistance-server", "IA",
! 176: &dhcp_universe, 76, 1 },
! 177: { "user-class", "t", &dhcp_universe, 77, 1 },
! 178: { "slp-directory-agent", "fIa", &dhcp_universe, 78, 1 },
! 179: { "slp-service-scope", "fto", &dhcp_universe, 79, 1 },
! 180: /* 80 is the zero-length rapid-commit (RFC 4039) */
! 181: { "fqdn", "Efqdn.", &dhcp_universe, 81, 1 },
! 182: { "relay-agent-information", "Eagent.", &dhcp_universe, 82, 1 },
! 183: /* 83 is iSNS (RFC 4174) */
! 184: /* 84 is unassigned */
! 185: { "nds-servers", "IA", &dhcp_universe, 85, 1 },
! 186: { "nds-tree-name", "t", &dhcp_universe, 86, 1 },
! 187: { "nds-context", "t", &dhcp_universe, 87, 1 },
! 188:
! 189: /* Note: RFC4280 fails to identify if the DHCPv4 option is to use
! 190: * compression pointers or not. Assume not.
! 191: */
! 192: { "bcms-controller-names", "D", &dhcp_universe, 88, 1 },
! 193: { "bcms-controller-address", "Ia", &dhcp_universe, 89, 1 },
! 194:
! 195: /* 90 is the authentication option (RFC 3118) */
! 196:
! 197: { "client-last-transaction-time", "L", &dhcp_universe, 91, 1 },
! 198: { "associated-ip", "Ia", &dhcp_universe, 92, 1 },
! 199: #if 0
! 200: /* Defined by RFC 4578 */
! 201: { "pxe-system-type", "S", &dhcp_universe, 93, 1 },
! 202: { "pxe-interface-id", "BBB", &dhcp_universe, 94, 1 },
! 203: { "pxe-client-id", "BX", &dhcp_universe, 97, 1 },
! 204: #endif
! 205: { "uap-servers", "t", &dhcp_universe, 98, 1 },
! 206: { "netinfo-server-address", "Ia", &dhcp_universe, 112, 1 },
! 207: { "netinfo-server-tag", "t", &dhcp_universe, 113, 1 },
! 208: { "default-url", "t", &dhcp_universe, 114, 1 },
! 209: { "subnet-selection", "I", &dhcp_universe, 118, 1 },
! 210: { "domain-search", "Dc", &dhcp_universe, 119, 1 },
! 211: { "vivco", "Evendor-class.", &dhcp_universe, 124, 1 },
! 212: { "vivso", "Evendor.", &dhcp_universe, 125, 1 },
! 213: #if 0
! 214: /* Referenced by RFC 4578.
! 215: * DO NOT UNCOMMENT THESE DEFINITIONS: these names are placeholders
! 216: * and will not be used in future versions of the software.
! 217: */
! 218: { "pxe-undefined-1", "X", &dhcp_universe, 128, 1 },
! 219: { "pxe-undefined-2", "X", &dhcp_universe, 129, 1 },
! 220: { "pxe-undefined-3", "X", &dhcp_universe, 130, 1 },
! 221: { "pxe-undefined-4", "X", &dhcp_universe, 131, 1 },
! 222: { "pxe-undefined-5", "X", &dhcp_universe, 132, 1 },
! 223: { "pxe-undefined-6", "X", &dhcp_universe, 133, 1 },
! 224: { "pxe-undefined-7", "X", &dhcp_universe, 134, 1 },
! 225: { "pxe-undefined-8", "X", &dhcp_universe, 135, 1 },
! 226: #endif
! 227: #if 0
! 228: /* Not defined by RFC yet */
! 229: { "tftp-server-address", "Ia", &dhcp_universe, 150, 1 },
! 230: #endif
! 231: #if 0
! 232: /* PXELINUX options: defined by RFC 5071 */
! 233: { "pxelinux-magic", "BBBB", &dhcp_universe, 208, 1 },
! 234: { "loader-configfile", "t", &dhcp_universe, 209, 1 },
! 235: { "loader-pathprefix", "t", &dhcp_universe, 210, 1 },
! 236: { "loader-reboottime", "L", &dhcp_universe, 211, 1 },
! 237: #endif
! 238: #if 0
! 239: /* Not defined by RFC yet */
! 240: { "vss-info", "BX", &dhcp_universe, 221, 1 },
! 241: #endif
! 242: { NULL, NULL, NULL, 0, 0 }
! 243: };
! 244:
! 245: struct universe nwip_universe;
! 246: static struct option nwip_options[] = {
! 247: { "illegal-1", "", &nwip_universe, 1, 1 },
! 248: { "illegal-2", "", &nwip_universe, 2, 1 },
! 249: { "illegal-3", "", &nwip_universe, 3, 1 },
! 250: { "illegal-4", "", &nwip_universe, 4, 1 },
! 251: { "nsq-broadcast", "f", &nwip_universe, 5, 1 },
! 252: { "preferred-dss", "IA", &nwip_universe, 6, 1 },
! 253: { "nearest-nwip-server", "IA", &nwip_universe, 7, 1 },
! 254: { "autoretries", "B", &nwip_universe, 8, 1 },
! 255: { "autoretry-secs", "B", &nwip_universe, 9, 1 },
! 256: { "nwip-1-1", "f", &nwip_universe, 10, 1 },
! 257: { "primary-dss", "I", &nwip_universe, 11, 1 },
! 258: { NULL, NULL, NULL, 0, 0 }
! 259: };
! 260:
! 261: /* Note that the "FQDN suboption space" does not reflect the FQDN option
! 262: * format - rather, this is a handy "virtualization" of a flat option
! 263: * which makes manual configuration and presentation of some of its
! 264: * contents easier (each of these suboptions is a fixed-space field within
! 265: * the fqdn contents - domain and host names are derived from a common field,
! 266: * and differ in the left and right hand side of the leftmost dot, fqdn is
! 267: * the combination of the two).
! 268: *
! 269: * Note further that the DHCPv6 and DHCPv4 'fqdn' options use the same
! 270: * virtualized option space to store their work.
! 271: */
! 272:
! 273: struct universe fqdn_universe;
! 274: struct universe fqdn6_universe;
! 275: static struct option fqdn_options[] = {
! 276: { "no-client-update", "f", &fqdn_universe, 1, 1 },
! 277: { "server-update", "f", &fqdn_universe, 2, 1 },
! 278: { "encoded", "f", &fqdn_universe, 3, 1 },
! 279: { "rcode1", "B", &fqdn_universe, 4, 1 },
! 280: { "rcode2", "B", &fqdn_universe, 5, 1 },
! 281: { "hostname", "t", &fqdn_universe, 6, 1 },
! 282: { "domainname", "t", &fqdn_universe, 7, 1 },
! 283: { "fqdn", "t", &fqdn_universe, 8, 1 },
! 284: { NULL, NULL, NULL, 0, 0 }
! 285: };
! 286:
! 287: struct universe vendor_class_universe;
! 288: static struct option vendor_class_options[] = {
! 289: { "isc", "X", &vendor_class_universe, 2495, 1 },
! 290: { NULL, NULL, NULL, 0, 0 }
! 291: };
! 292:
! 293: struct universe vendor_universe;
! 294: static struct option vendor_options[] = {
! 295: { "isc", "Eisc.", &vendor_universe, 2495, 1 },
! 296: { NULL, NULL, NULL, 0, 0 }
! 297: };
! 298:
! 299: struct universe isc_universe;
! 300: static struct option isc_options [] = {
! 301: { "media", "t", &isc_universe, 1, 1 },
! 302: { "update-assist", "X", &isc_universe, 2, 1 },
! 303: { NULL, NULL, NULL, 0, 0 }
! 304: };
! 305:
! 306: struct universe dhcpv6_universe;
! 307: static struct option dhcpv6_options[] = {
! 308:
! 309: /* RFC3315 OPTIONS */
! 310:
! 311: /* Client and server DUIDs are opaque fields, but marking them
! 312: * up somewhat makes configuration easier.
! 313: */
! 314: { "client-id", "X", &dhcpv6_universe, 1, 1 },
! 315: { "server-id", "X", &dhcpv6_universe, 2, 1 },
! 316:
! 317: /* ia-* options actually have at their ends a space for options
! 318: * that are specific to this instance of the option. We can not
! 319: * handle this yet at this stage of development, so the encoding
! 320: * of these options is unspecified ("X").
! 321: */
! 322: { "ia-na", "X", &dhcpv6_universe, 3, 1 },
! 323: { "ia-ta", "X", &dhcpv6_universe, 4, 1 },
! 324: { "ia-addr", "X", &dhcpv6_universe, 5, 1 },
! 325:
! 326: /* "oro" is DHCPv6 speak for "parameter-request-list" */
! 327: { "oro", "SA", &dhcpv6_universe, 6, 1 },
! 328:
! 329: { "preference", "B", &dhcpv6_universe, 7, 1 },
! 330: { "elapsed-time", "S", &dhcpv6_universe, 8, 1 },
! 331: { "relay-msg", "X", &dhcpv6_universe, 9, 1 },
! 332:
! 333: /* Option code 10 is curiously unassigned. */
! 334: #if 0
! 335: /* XXX: missing suitable atoms for the auth option. We may want
! 336: * to 'virtually encapsulate' this option a la the fqdn option
! 337: * seeing as it is processed explicitly by the server and unlikely
! 338: * to be configured by hand by users as such.
! 339: */
! 340: { "auth", "Nauth-protocol.Nauth-algorithm.Nrdm-type.LLX",
! 341: &dhcpv6_universe, 11, 1 },
! 342: #endif
! 343: { "unicast", "6", &dhcpv6_universe, 12, 1 },
! 344: { "status-code", "Nstatus-codes.to", &dhcpv6_universe, 13, 1 },
! 345: { "rapid-commit", "Z", &dhcpv6_universe, 14, 1 },
! 346: #if 0
! 347: /* XXX: user-class contents are of the form "StA" where the
! 348: * integer describes the length of the text field. We don't have
! 349: * an atom for pre-determined-length octet strings yet, so we
! 350: * can't quite do these two.
! 351: */
! 352: { "user-class", "X", &dhcpv6_universe, 15, 1 },
! 353: { "vendor-class", "X", &dhcpv6_universe, 16, 1 },
! 354: #endif
! 355: { "vendor-opts", "Evsio.", &dhcpv6_universe, 17, 1 },
! 356: { "interface-id", "X", &dhcpv6_universe, 18, 1 },
! 357: { "reconf-msg", "Ndhcpv6-messages.", &dhcpv6_universe, 19, 1 },
! 358: { "reconf-accept", "Z", &dhcpv6_universe, 20, 1 },
! 359:
! 360: /* RFC3319 OPTIONS */
! 361:
! 362: /* Of course: we would HAVE to have a different atom for
! 363: * domain names without compression. Typical.
! 364: */
! 365: { "sip-servers-names", "D", &dhcpv6_universe, 21, 1 },
! 366: { "sip-servers-addresses", "6A", &dhcpv6_universe, 22, 1 },
! 367:
! 368: /* RFC3646 OPTIONS */
! 369:
! 370: { "name-servers", "6A", &dhcpv6_universe, 23, 1 },
! 371: { "domain-search", "D", &dhcpv6_universe, 24, 1 },
! 372:
! 373: /* RFC3633 OPTIONS */
! 374:
! 375: { "ia-pd", "X", &dhcpv6_universe, 25, 1 },
! 376: { "ia-prefix", "X", &dhcpv6_universe, 26, 1 },
! 377:
! 378: /* RFC3898 OPTIONS */
! 379:
! 380: { "nis-servers", "6A", &dhcpv6_universe, 27, 1 },
! 381: { "nisp-servers", "6A", &dhcpv6_universe, 28, 1 },
! 382: { "nis-domain-name", "D", &dhcpv6_universe, 29, 1 },
! 383: { "nisp-domain-name", "D", &dhcpv6_universe, 30, 1 },
! 384:
! 385: /* RFC4075 OPTIONS */
! 386: { "sntp-servers", "6A", &dhcpv6_universe, 31, 1 },
! 387:
! 388: /* RFC4242 OPTIONS */
! 389:
! 390: { "info-refresh-time", "T", &dhcpv6_universe, 32, 1 },
! 391:
! 392: /* RFC4280 OPTIONS */
! 393:
! 394: { "bcms-server-d", "D", &dhcpv6_universe, 33, 1 },
! 395: { "bcms-server-a", "6A", &dhcpv6_universe, 34, 1 },
! 396:
! 397: /* Note that 35 is not assigned. */
! 398:
! 399: /* Not yet considering for inclusion. */
! 400: #if 0
! 401: /* RFC4776 OPTIONS */
! 402:
! 403: { "geoconf-civic", "X", &dhcpv6_universe, 36, 1 },
! 404: #endif
! 405:
! 406: /* RFC4649 OPTIONS */
! 407:
! 408: /* The remote-id option looks like the VSIO option, but for all
! 409: * intents and purposes we only need to treat the entire field
! 410: * like a globally unique identifier (and if we create such an
! 411: * option, ensure the first 4 bytes are our enterprise-id followed
! 412: * by a globally unique ID so long as you're within that enterprise
! 413: * id). So we'll use "X" for now unless someone grumbles.
! 414: */
! 415: { "remote-id", "X", &dhcpv6_universe, 37, 1 },
! 416:
! 417: /* RFC4580 OPTIONS */
! 418:
! 419: { "subscriber-id", "X", &dhcpv6_universe, 38, 1 },
! 420:
! 421: /* RFC4704 OPTIONS */
! 422:
! 423: /* The DHCPv6 FQDN option is...weird.
! 424: *
! 425: * We use the same "virtual" encapsulated space as DHCPv4's FQDN
! 426: * option, so it can all be configured in one place. Since the
! 427: * options system does not support multiple inheritance, we use
! 428: * a 'shill' layer to perform the different protocol conversions,
! 429: * and to redirect any queries in the DHCPv4 FQDN's space.
! 430: */
! 431: { "fqdn", "Efqdn6-if-you-see-me-its-a-bug-bug-bug.",
! 432: &dhcpv6_universe, 39, 1 },
! 433:
! 434: /* Not yet considering for inclusion. */
! 435: #if 0
! 436: /* draft-ietf-dhc-paa-option-05 */
! 437: { "pana-agent", "6A", &dhcpv6_universe, 40, 1 },
! 438:
! 439: /* RFC4833 OPTIONS */
! 440:
! 441: { "new-posix-timezone", "t", &dhcpv6_universe, 41, 1 },
! 442: { "new-tzdb-timezone", "t", &dhcpv6_universe, 42, 1 },
! 443:
! 444: /* RFC4994 OPTIONS */
! 445:
! 446: { "ero", "SA", &dhcpv6_universe, 43, 1 },
! 447: #endif
! 448:
! 449: /* RFC5007 OPTIONS */
! 450:
! 451: { "lq-query", "X", &dhcpv6_universe, 44, 1 },
! 452: { "client-data", "X", &dhcpv6_universe, 45, 1 },
! 453: { "clt-time", "L", &dhcpv6_universe, 46, 1 },
! 454: { "lq-relay-data", "6X", &dhcpv6_universe, 47, 1 },
! 455: { "lq-client-link", "6A", &dhcpv6_universe, 48, 1 },
! 456:
! 457: { NULL, NULL, NULL, 0, 0 }
! 458: };
! 459:
! 460: struct enumeration_value dhcpv6_duid_type_values[] = {
! 461: { "duid-llt", DUID_LLT }, /* Link-Local Plus Time */
! 462: { "duid-en", DUID_EN }, /* DUID based upon enterprise-ID. */
! 463: { "duid-ll", DUID_LL }, /* DUID from Link Local address only. */
! 464: { NULL, 0 }
! 465: };
! 466:
! 467: struct enumeration dhcpv6_duid_types = {
! 468: NULL,
! 469: "duid-types", 2,
! 470: dhcpv6_duid_type_values
! 471: };
! 472:
! 473: struct enumeration_value dhcpv6_status_code_values[] = {
! 474: { "success", 0 }, /* Success */
! 475: { "UnspecFail", 1 }, /* Failure, for unspecified reasons. */
! 476: { "NoAddrsAvail", 2 }, /* Server has no addresses to assign. */
! 477: { "NoBinding", 3 }, /* Client record (binding) unavailable. */
! 478: { "NotOnLink", 4 }, /* Bad prefix for the link. */
! 479: { "UseMulticast", 5 }, /* Not just good advice. It's the law. */
! 480: { "NoPrefixAvail", 6 }, /* Server has no prefixes to assign. */
! 481: { "UnknownQueryType", 7 }, /* Query-type unknown/unsupported. */
! 482: { "MalformedQuery", 8 }, /* Leasequery not valid. */
! 483: { "NotConfigured", 9 }, /* The target address is not in config. */
! 484: { "NotAllowed", 10 }, /* Server doesn't allow the leasequery. */
! 485: { NULL, 0 }
! 486: };
! 487:
! 488: struct enumeration dhcpv6_status_codes = {
! 489: NULL,
! 490: "status-codes", 2,
! 491: dhcpv6_status_code_values
! 492: };
! 493:
! 494: struct enumeration_value lq6_query_type_values[] = {
! 495: { "query-by-address", 1 },
! 496: { "query-by-clientid", 2 },
! 497: { NULL, 0 }
! 498: };
! 499:
! 500: struct enumeration lq6_query_types = {
! 501: NULL,
! 502: "query-types", 2,
! 503: lq6_query_type_values
! 504: };
! 505:
! 506: struct enumeration_value dhcpv6_message_values[] = {
! 507: { "SOLICIT", 1 },
! 508: { "ADVERTISE", 2 },
! 509: { "REQUEST", 3 },
! 510: { "CONFIRM", 4 },
! 511: { "RENEW", 5 },
! 512: { "REBIND", 6 },
! 513: { "REPLY", 7 },
! 514: { "RELEASE", 8 },
! 515: { "DECLINE", 9 },
! 516: { "RECONFIGURE", 10 },
! 517: { "INFORMATION-REQUEST", 11 },
! 518: { "RELAY-FORW", 12 },
! 519: { "RELAY-REPL", 13 },
! 520: { "LEASEQUERY", 14 },
! 521: { "LEASEQUERY-REPLY", 15 },
! 522: { NULL, 0 }
! 523: };
! 524:
! 525: /* Some code refers to a different table. */
! 526: const char *dhcpv6_type_names[] = {
! 527: NULL,
! 528: "Solicit",
! 529: "Advertise",
! 530: "Request",
! 531: "Confirm",
! 532: "Renew",
! 533: "Rebind",
! 534: "Reply",
! 535: "Release",
! 536: "Decline",
! 537: "Reconfigure",
! 538: "Information-request",
! 539: "Relay-forward",
! 540: "Relay-reply",
! 541: "Leasequery",
! 542: "Leasequery-reply"
! 543: };
! 544: const int dhcpv6_type_name_max =
! 545: (sizeof(dhcpv6_type_names) / sizeof(dhcpv6_type_names[0]));
! 546:
! 547: struct enumeration dhcpv6_messages = {
! 548: NULL,
! 549: "dhcpv6-messages", 1,
! 550: dhcpv6_message_values
! 551: };
! 552:
! 553: struct universe vsio_universe;
! 554: static struct option vsio_options[] = {
! 555: { "isc", "Eisc6.", &vsio_universe, 2495, 1 },
! 556: { NULL, NULL, NULL, 0, 0 }
! 557: };
! 558:
! 559: struct universe isc6_universe;
! 560: static struct option isc6_options[] = {
! 561: { "media", "t", &isc6_universe, 1, 1 },
! 562: { "update-assist", "X", &isc6_universe, 2, 1 },
! 563: { NULL, NULL, NULL, 0, 0 }
! 564: };
! 565:
! 566: const char *hardware_types [] = {
! 567: "unknown-0",
! 568: "ethernet",
! 569: "unknown-2",
! 570: "unknown-3",
! 571: "unknown-4",
! 572: "unknown-5",
! 573: "token-ring",
! 574: "unknown-7",
! 575: "fddi",
! 576: "unknown-9",
! 577: "unknown-10",
! 578: "unknown-11",
! 579: "unknown-12",
! 580: "unknown-13",
! 581: "unknown-14",
! 582: "unknown-15",
! 583: "unknown-16",
! 584: "unknown-17",
! 585: "unknown-18",
! 586: "unknown-19",
! 587: "unknown-20",
! 588: "unknown-21",
! 589: "unknown-22",
! 590: "unknown-23",
! 591: "unknown-24",
! 592: "unknown-25",
! 593: "unknown-26",
! 594: "unknown-27",
! 595: "unknown-28",
! 596: "unknown-29",
! 597: "unknown-30",
! 598: "unknown-31",
! 599: "unknown-32",
! 600: "unknown-33",
! 601: "unknown-34",
! 602: "unknown-35",
! 603: "unknown-36",
! 604: "unknown-37",
! 605: "unknown-38",
! 606: "unknown-39",
! 607: "unknown-40",
! 608: "unknown-41",
! 609: "unknown-42",
! 610: "unknown-43",
! 611: "unknown-44",
! 612: "unknown-45",
! 613: "unknown-46",
! 614: "unknown-47",
! 615: "unknown-48",
! 616: "unknown-49",
! 617: "unknown-50",
! 618: "unknown-51",
! 619: "unknown-52",
! 620: "unknown-53",
! 621: "unknown-54",
! 622: "unknown-55",
! 623: "unknown-56",
! 624: "unknown-57",
! 625: "unknown-58",
! 626: "unknown-59",
! 627: "unknown-60",
! 628: "unknown-61",
! 629: "unknown-62",
! 630: "unknown-63",
! 631: "unknown-64",
! 632: "unknown-65",
! 633: "unknown-66",
! 634: "unknown-67",
! 635: "unknown-68",
! 636: "unknown-69",
! 637: "unknown-70",
! 638: "unknown-71",
! 639: "unknown-72",
! 640: "unknown-73",
! 641: "unknown-74",
! 642: "unknown-75",
! 643: "unknown-76",
! 644: "unknown-77",
! 645: "unknown-78",
! 646: "unknown-79",
! 647: "unknown-80",
! 648: "unknown-81",
! 649: "unknown-82",
! 650: "unknown-83",
! 651: "unknown-84",
! 652: "unknown-85",
! 653: "unknown-86",
! 654: "unknown-87",
! 655: "unknown-88",
! 656: "unknown-89",
! 657: "unknown-90",
! 658: "unknown-91",
! 659: "unknown-92",
! 660: "unknown-93",
! 661: "unknown-94",
! 662: "unknown-95",
! 663: "unknown-96",
! 664: "unknown-97",
! 665: "unknown-98",
! 666: "unknown-99",
! 667: "unknown-100",
! 668: "unknown-101",
! 669: "unknown-102",
! 670: "unknown-103",
! 671: "unknown-104",
! 672: "unknown-105",
! 673: "unknown-106",
! 674: "unknown-107",
! 675: "unknown-108",
! 676: "unknown-109",
! 677: "unknown-110",
! 678: "unknown-111",
! 679: "unknown-112",
! 680: "unknown-113",
! 681: "unknown-114",
! 682: "unknown-115",
! 683: "unknown-116",
! 684: "unknown-117",
! 685: "unknown-118",
! 686: "unknown-119",
! 687: "unknown-120",
! 688: "unknown-121",
! 689: "unknown-122",
! 690: "unknown-123",
! 691: "unknown-124",
! 692: "unknown-125",
! 693: "unknown-126",
! 694: "unknown-127",
! 695: "unknown-128",
! 696: "unknown-129",
! 697: "unknown-130",
! 698: "unknown-131",
! 699: "unknown-132",
! 700: "unknown-133",
! 701: "unknown-134",
! 702: "unknown-135",
! 703: "unknown-136",
! 704: "unknown-137",
! 705: "unknown-138",
! 706: "unknown-139",
! 707: "unknown-140",
! 708: "unknown-141",
! 709: "unknown-142",
! 710: "unknown-143",
! 711: "unknown-144",
! 712: "unknown-145",
! 713: "unknown-146",
! 714: "unknown-147",
! 715: "unknown-148",
! 716: "unknown-149",
! 717: "unknown-150",
! 718: "unknown-151",
! 719: "unknown-152",
! 720: "unknown-153",
! 721: "unknown-154",
! 722: "unknown-155",
! 723: "unknown-156",
! 724: "unknown-157",
! 725: "unknown-158",
! 726: "unknown-159",
! 727: "unknown-160",
! 728: "unknown-161",
! 729: "unknown-162",
! 730: "unknown-163",
! 731: "unknown-164",
! 732: "unknown-165",
! 733: "unknown-166",
! 734: "unknown-167",
! 735: "unknown-168",
! 736: "unknown-169",
! 737: "unknown-170",
! 738: "unknown-171",
! 739: "unknown-172",
! 740: "unknown-173",
! 741: "unknown-174",
! 742: "unknown-175",
! 743: "unknown-176",
! 744: "unknown-177",
! 745: "unknown-178",
! 746: "unknown-179",
! 747: "unknown-180",
! 748: "unknown-181",
! 749: "unknown-182",
! 750: "unknown-183",
! 751: "unknown-184",
! 752: "unknown-185",
! 753: "unknown-186",
! 754: "unknown-187",
! 755: "unknown-188",
! 756: "unknown-189",
! 757: "unknown-190",
! 758: "unknown-191",
! 759: "unknown-192",
! 760: "unknown-193",
! 761: "unknown-194",
! 762: "unknown-195",
! 763: "unknown-196",
! 764: "unknown-197",
! 765: "unknown-198",
! 766: "unknown-199",
! 767: "unknown-200",
! 768: "unknown-201",
! 769: "unknown-202",
! 770: "unknown-203",
! 771: "unknown-204",
! 772: "unknown-205",
! 773: "unknown-206",
! 774: "unknown-207",
! 775: "unknown-208",
! 776: "unknown-209",
! 777: "unknown-210",
! 778: "unknown-211",
! 779: "unknown-212",
! 780: "unknown-213",
! 781: "unknown-214",
! 782: "unknown-215",
! 783: "unknown-216",
! 784: "unknown-217",
! 785: "unknown-218",
! 786: "unknown-219",
! 787: "unknown-220",
! 788: "unknown-221",
! 789: "unknown-222",
! 790: "unknown-223",
! 791: "unknown-224",
! 792: "unknown-225",
! 793: "unknown-226",
! 794: "unknown-227",
! 795: "unknown-228",
! 796: "unknown-229",
! 797: "unknown-230",
! 798: "unknown-231",
! 799: "unknown-232",
! 800: "unknown-233",
! 801: "unknown-234",
! 802: "unknown-235",
! 803: "unknown-236",
! 804: "unknown-237",
! 805: "unknown-238",
! 806: "unknown-239",
! 807: "unknown-240",
! 808: "unknown-241",
! 809: "unknown-242",
! 810: "unknown-243",
! 811: "unknown-244",
! 812: "unknown-245",
! 813: "unknown-246",
! 814: "unknown-247",
! 815: "unknown-248",
! 816: "unknown-249",
! 817: "unknown-250",
! 818: "unknown-251",
! 819: "unknown-252",
! 820: "unknown-253",
! 821: "unknown-254",
! 822: "unknown-255" };
! 823:
! 824: universe_hash_t *universe_hash;
! 825: struct universe **universes;
! 826: int universe_count, universe_max;
! 827:
! 828: /* Universe containing names of configuration options, which, rather than
! 829: writing "option universe-name.option-name ...;", can be set by writing
! 830: "option-name ...;". */
! 831:
! 832: struct universe *config_universe;
! 833:
! 834: /* XXX: omapi must die...all the below keeps us from having to make the
! 835: * option structures omapi typed objects, which is a bigger headache.
! 836: */
! 837:
! 838: char *default_option_format = (char *) "X";
! 839:
! 840: /* Must match hash_reference/dereference types in omapip/hash.h. */
! 841: int
! 842: option_reference(struct option **dest, struct option *src,
! 843: const char * file, int line)
! 844: {
! 845: if (!dest || !src)
! 846: return ISC_R_INVALIDARG;
! 847:
! 848: if (*dest) {
! 849: #if defined(POINTER_DEBUG)
! 850: log_fatal("%s(%d): reference store into non-null pointer!",
! 851: file, line);
! 852: #else
! 853: return ISC_R_INVALIDARG;
! 854: #endif
! 855: }
! 856:
! 857: *dest = src;
! 858: src->refcnt++;
! 859: rc_register(file, line, dest, src, src->refcnt, 0, RC_MISC);
! 860: return(ISC_R_SUCCESS);
! 861: }
! 862:
! 863: int
! 864: option_dereference(struct option **dest, const char *file, int line)
! 865: {
! 866: if (!dest)
! 867: return ISC_R_INVALIDARG;
! 868:
! 869: if (!*dest) {
! 870: #if defined (POINTER_DEBUG)
! 871: log_fatal("%s(%d): dereference of null pointer!", file, line);
! 872: #else
! 873: return ISC_R_INVALIDARG;
! 874: #endif
! 875: }
! 876:
! 877: if ((*dest)->refcnt <= 0) {
! 878: #if defined (POINTER_DEBUG)
! 879: log_fatal("%s(%d): dereference of <= 0 refcnt!", file, line);
! 880: #else
! 881: return ISC_R_INVALIDARG;
! 882: #endif
! 883: }
! 884:
! 885: (*dest)->refcnt--;
! 886:
! 887: rc_register(file, line, dest, (*dest), (*dest)->refcnt, 1, RC_MISC);
! 888:
! 889: if ((*dest)->refcnt == 0) {
! 890: /* The option name may be packed in the same alloc as the
! 891: * option structure.
! 892: */
! 893: if ((char *) (*dest)->name != (char *) ((*dest) + 1))
! 894: dfree((char *) (*dest)->name, file, line);
! 895:
! 896: /* It's either a user-configured format (allocated), or the
! 897: * default static format.
! 898: */
! 899: if (((*dest)->format != NULL) &&
! 900: ((*dest)->format != default_option_format)) {
! 901: dfree((char *) (*dest)->format, file, line);
! 902: }
! 903:
! 904: dfree(*dest, file, line);
! 905: }
! 906:
! 907: *dest = NULL;
! 908: return ISC_R_SUCCESS;
! 909: }
! 910:
! 911: void initialize_common_option_spaces()
! 912: {
! 913: unsigned code;
! 914: int i;
! 915:
! 916: /* The 'universes' table is dynamically grown to contain
! 917: * universe as they're configured - except during startup.
! 918: * Since we know how many we put down in .c files, we can
! 919: * allocate a more-than-right-sized buffer now, leaving some
! 920: * space for user-configured option spaces.
! 921: *
! 922: * 1: dhcp_universe (dhcpv4 options)
! 923: * 2: nwip_universe (dhcpv4 NWIP option)
! 924: * 3: fqdn_universe (dhcpv4 fqdn option - reusable for v6)
! 925: * 4: vendor_class_universe (VIVCO)
! 926: * 5: vendor_universe (VIVSO)
! 927: * 6: isc_universe (dhcpv4 isc config space)
! 928: * 7: dhcpv6_universe (dhcpv6 options)
! 929: * 8: vsio_universe (DHCPv6 Vendor-Identified space)
! 930: * 9: isc6_universe (ISC's Vendor universe in DHCPv6 VSIO)
! 931: * 10: fqdn6_universe (dhcpv6 fqdn option shill to v4)
! 932: * 11: agent_universe (dhcpv4 relay agent - see server/stables.c)
! 933: * 12: server_universe (server's config, see server/stables.c)
! 934: * 13: user-config
! 935: * 14: more user-config
! 936: * 15: more user-config
! 937: * 16: more user-config
! 938: */
! 939: universe_max = 16;
! 940: i = universe_max * sizeof(struct universe *);
! 941: if (i <= 0)
! 942: log_fatal("Ludicrous initial size option space table.");
! 943: universes = dmalloc(i, MDL);
! 944: if (universes == NULL)
! 945: log_fatal("Can't allocate option space table.");
! 946: memset(universes, 0, i);
! 947:
! 948: /* Set up the DHCP option universe... */
! 949: dhcp_universe.name = "dhcp";
! 950: dhcp_universe.concat_duplicates = 1;
! 951: dhcp_universe.lookup_func = lookup_hashed_option;
! 952: dhcp_universe.option_state_dereference =
! 953: hashed_option_state_dereference;
! 954: dhcp_universe.save_func = save_hashed_option;
! 955: dhcp_universe.delete_func = delete_hashed_option;
! 956: dhcp_universe.encapsulate = hashed_option_space_encapsulate;
! 957: dhcp_universe.foreach = hashed_option_space_foreach;
! 958: dhcp_universe.decode = parse_option_buffer;
! 959: dhcp_universe.length_size = 1;
! 960: dhcp_universe.tag_size = 1;
! 961: dhcp_universe.get_tag = getUChar;
! 962: dhcp_universe.store_tag = putUChar;
! 963: dhcp_universe.get_length = getUChar;
! 964: dhcp_universe.store_length = putUChar;
! 965: dhcp_universe.site_code_min = 0;
! 966: dhcp_universe.end = DHO_END;
! 967: dhcp_universe.index = universe_count++;
! 968: universes [dhcp_universe.index] = &dhcp_universe;
! 969: if (!option_name_new_hash(&dhcp_universe.name_hash,
! 970: BYTE_NAME_HASH_SIZE, MDL) ||
! 971: !option_code_new_hash(&dhcp_universe.code_hash,
! 972: BYTE_CODE_HASH_SIZE, MDL))
! 973: log_fatal ("Can't allocate dhcp option hash table.");
! 974: for (i = 0 ; dhcp_options[i].name ; i++) {
! 975: option_code_hash_add(dhcp_universe.code_hash,
! 976: &dhcp_options[i].code, 0,
! 977: &dhcp_options[i], MDL);
! 978: option_name_hash_add(dhcp_universe.name_hash,
! 979: dhcp_options [i].name, 0,
! 980: &dhcp_options [i], MDL);
! 981: }
! 982: #if defined(REPORT_HASH_PERFORMANCE)
! 983: log_info("DHCP name hash: %s",
! 984: option_name_hash_report(dhcp_universe.name_hash));
! 985: log_info("DHCP code hash: %s",
! 986: option_code_hash_report(dhcp_universe.code_hash));
! 987: #endif
! 988:
! 989: /* Set up the Novell option universe (for option 63)... */
! 990: nwip_universe.name = "nwip";
! 991: nwip_universe.concat_duplicates = 0; /* XXX: reference? */
! 992: nwip_universe.lookup_func = lookup_linked_option;
! 993: nwip_universe.option_state_dereference =
! 994: linked_option_state_dereference;
! 995: nwip_universe.save_func = save_linked_option;
! 996: nwip_universe.delete_func = delete_linked_option;
! 997: nwip_universe.encapsulate = nwip_option_space_encapsulate;
! 998: nwip_universe.foreach = linked_option_space_foreach;
! 999: nwip_universe.decode = parse_option_buffer;
! 1000: nwip_universe.length_size = 1;
! 1001: nwip_universe.tag_size = 1;
! 1002: nwip_universe.get_tag = getUChar;
! 1003: nwip_universe.store_tag = putUChar;
! 1004: nwip_universe.get_length = getUChar;
! 1005: nwip_universe.store_length = putUChar;
! 1006: nwip_universe.site_code_min = 0;
! 1007: nwip_universe.end = 0;
! 1008: code = DHO_NWIP_SUBOPTIONS;
! 1009: nwip_universe.enc_opt = NULL;
! 1010: if (!option_code_hash_lookup(&nwip_universe.enc_opt,
! 1011: dhcp_universe.code_hash, &code, 0, MDL))
! 1012: log_fatal("Unable to find NWIP parent option (%s:%d).", MDL);
! 1013: nwip_universe.index = universe_count++;
! 1014: universes [nwip_universe.index] = &nwip_universe;
! 1015: if (!option_name_new_hash(&nwip_universe.name_hash,
! 1016: NWIP_HASH_SIZE, MDL) ||
! 1017: !option_code_new_hash(&nwip_universe.code_hash,
! 1018: NWIP_HASH_SIZE, MDL))
! 1019: log_fatal ("Can't allocate nwip option hash table.");
! 1020: for (i = 0 ; nwip_options[i].name ; i++) {
! 1021: option_code_hash_add(nwip_universe.code_hash,
! 1022: &nwip_options[i].code, 0,
! 1023: &nwip_options[i], MDL);
! 1024: option_name_hash_add(nwip_universe.name_hash,
! 1025: nwip_options[i].name, 0,
! 1026: &nwip_options[i], MDL);
! 1027: }
! 1028: #if defined(REPORT_HASH_PERFORMANCE)
! 1029: log_info("NWIP name hash: %s",
! 1030: option_name_hash_report(nwip_universe.name_hash));
! 1031: log_info("NWIP code hash: %s",
! 1032: option_code_hash_report(nwip_universe.code_hash));
! 1033: #endif
! 1034:
! 1035: /* Set up the FQDN option universe... */
! 1036: fqdn_universe.name = "fqdn";
! 1037: fqdn_universe.concat_duplicates = 0;
! 1038: fqdn_universe.lookup_func = lookup_linked_option;
! 1039: fqdn_universe.option_state_dereference =
! 1040: linked_option_state_dereference;
! 1041: fqdn_universe.save_func = save_linked_option;
! 1042: fqdn_universe.delete_func = delete_linked_option;
! 1043: fqdn_universe.encapsulate = fqdn_option_space_encapsulate;
! 1044: fqdn_universe.foreach = linked_option_space_foreach;
! 1045: fqdn_universe.decode = fqdn_universe_decode;
! 1046: fqdn_universe.length_size = 1;
! 1047: fqdn_universe.tag_size = 1;
! 1048: fqdn_universe.get_tag = getUChar;
! 1049: fqdn_universe.store_tag = putUChar;
! 1050: fqdn_universe.get_length = getUChar;
! 1051: fqdn_universe.store_length = putUChar;
! 1052: fqdn_universe.site_code_min = 0;
! 1053: fqdn_universe.end = 0;
! 1054: fqdn_universe.index = universe_count++;
! 1055: code = DHO_FQDN;
! 1056: fqdn_universe.enc_opt = NULL;
! 1057: if (!option_code_hash_lookup(&fqdn_universe.enc_opt,
! 1058: dhcp_universe.code_hash, &code, 0, MDL))
! 1059: log_fatal("Unable to find FQDN parent option (%s:%d).", MDL);
! 1060: universes [fqdn_universe.index] = &fqdn_universe;
! 1061: if (!option_name_new_hash(&fqdn_universe.name_hash,
! 1062: FQDN_HASH_SIZE, MDL) ||
! 1063: !option_code_new_hash(&fqdn_universe.code_hash,
! 1064: FQDN_HASH_SIZE, MDL))
! 1065: log_fatal ("Can't allocate fqdn option hash table.");
! 1066: for (i = 0 ; fqdn_options[i].name ; i++) {
! 1067: option_code_hash_add(fqdn_universe.code_hash,
! 1068: &fqdn_options[i].code, 0,
! 1069: &fqdn_options[i], MDL);
! 1070: option_name_hash_add(fqdn_universe.name_hash,
! 1071: fqdn_options[i].name, 0,
! 1072: &fqdn_options[i], MDL);
! 1073: }
! 1074: #if defined(REPORT_HASH_PERFORMANCE)
! 1075: log_info("FQDN name hash: %s",
! 1076: option_name_hash_report(fqdn_universe.name_hash));
! 1077: log_info("FQDN code hash: %s",
! 1078: option_code_hash_report(fqdn_universe.code_hash));
! 1079: #endif
! 1080:
! 1081: /* Set up the Vendor Identified Vendor Class options (for option
! 1082: * 125)...
! 1083: */
! 1084: vendor_class_universe.name = "vendor-class";
! 1085: vendor_class_universe.concat_duplicates = 0; /* XXX: reference? */
! 1086: vendor_class_universe.lookup_func = lookup_hashed_option;
! 1087: vendor_class_universe.option_state_dereference =
! 1088: hashed_option_state_dereference;
! 1089: vendor_class_universe.save_func = save_hashed_option;
! 1090: vendor_class_universe.delete_func = delete_hashed_option;
! 1091: vendor_class_universe.encapsulate = hashed_option_space_encapsulate;
! 1092: vendor_class_universe.foreach = hashed_option_space_foreach;
! 1093: vendor_class_universe.decode = parse_option_buffer;
! 1094: vendor_class_universe.length_size = 1;
! 1095: vendor_class_universe.tag_size = 4;
! 1096: vendor_class_universe.get_tag = getULong;
! 1097: vendor_class_universe.store_tag = putULong;
! 1098: vendor_class_universe.get_length = getUChar;
! 1099: vendor_class_universe.store_length = putUChar;
! 1100: vendor_class_universe.site_code_min = 0;
! 1101: vendor_class_universe.end = 0;
! 1102: code = DHO_VIVCO_SUBOPTIONS;
! 1103: vendor_class_universe.enc_opt = NULL;
! 1104: if (!option_code_hash_lookup(&vendor_class_universe.enc_opt,
! 1105: dhcp_universe.code_hash, &code, 0, MDL))
! 1106: log_fatal("Unable to find VIVCO parent option (%s:%d).", MDL);
! 1107: vendor_class_universe.index = universe_count++;
! 1108: universes[vendor_class_universe.index] = &vendor_class_universe;
! 1109: if (!option_name_new_hash(&vendor_class_universe.name_hash,
! 1110: VIVCO_HASH_SIZE, MDL) ||
! 1111: !option_code_new_hash(&vendor_class_universe.code_hash,
! 1112: VIVCO_HASH_SIZE, MDL))
! 1113: log_fatal("Can't allocate Vendor Identified Vendor Class "
! 1114: "option hash table.");
! 1115: for (i = 0 ; vendor_class_options[i].name ; i++) {
! 1116: option_code_hash_add(vendor_class_universe.code_hash,
! 1117: &vendor_class_options[i].code, 0,
! 1118: &vendor_class_options[i], MDL);
! 1119: option_name_hash_add(vendor_class_universe.name_hash,
! 1120: vendor_class_options[i].name, 0,
! 1121: &vendor_class_options[i], MDL);
! 1122: }
! 1123: #if defined(REPORT_HASH_PERFORMANCE)
! 1124: log_info("VIVCO name hash: %s",
! 1125: option_name_hash_report(vendor_class_universe.name_hash));
! 1126: log_info("VIVCO code hash: %s",
! 1127: option_code_hash_report(vendor_class_universe.code_hash));
! 1128: #endif
! 1129:
! 1130: /* Set up the Vendor Identified Vendor Sub-options (option 126)... */
! 1131: vendor_universe.name = "vendor";
! 1132: vendor_universe.concat_duplicates = 0; /* XXX: reference? */
! 1133: vendor_universe.lookup_func = lookup_hashed_option;
! 1134: vendor_universe.option_state_dereference =
! 1135: hashed_option_state_dereference;
! 1136: vendor_universe.save_func = save_hashed_option;
! 1137: vendor_universe.delete_func = delete_hashed_option;
! 1138: vendor_universe.encapsulate = hashed_option_space_encapsulate;
! 1139: vendor_universe.foreach = hashed_option_space_foreach;
! 1140: vendor_universe.decode = parse_option_buffer;
! 1141: vendor_universe.length_size = 1;
! 1142: vendor_universe.tag_size = 4;
! 1143: vendor_universe.get_tag = getULong;
! 1144: vendor_universe.store_tag = putULong;
! 1145: vendor_universe.get_length = getUChar;
! 1146: vendor_universe.store_length = putUChar;
! 1147: vendor_universe.site_code_min = 0;
! 1148: vendor_universe.end = 0;
! 1149: code = DHO_VIVSO_SUBOPTIONS;
! 1150: vendor_universe.enc_opt = NULL;
! 1151: if (!option_code_hash_lookup(&vendor_universe.enc_opt,
! 1152: dhcp_universe.code_hash, &code, 0, MDL))
! 1153: log_fatal("Unable to find VIVSO parent option (%s:%d).", MDL);
! 1154: vendor_universe.index = universe_count++;
! 1155: universes[vendor_universe.index] = &vendor_universe;
! 1156: if (!option_name_new_hash(&vendor_universe.name_hash,
! 1157: VIVSO_HASH_SIZE, MDL) ||
! 1158: !option_code_new_hash(&vendor_universe.code_hash,
! 1159: VIVSO_HASH_SIZE, MDL))
! 1160: log_fatal("Can't allocate Vendor Identified Vendor Sub-"
! 1161: "options hash table.");
! 1162: for (i = 0 ; vendor_options[i].name ; i++) {
! 1163: option_code_hash_add(vendor_universe.code_hash,
! 1164: &vendor_options[i].code, 0,
! 1165: &vendor_options[i], MDL);
! 1166: option_name_hash_add(vendor_universe.name_hash,
! 1167: vendor_options[i].name, 0,
! 1168: &vendor_options[i], MDL);
! 1169: }
! 1170: #if defined(REPORT_HASH_PERFORMANCE)
! 1171: log_info("VIVSO name hash: %s",
! 1172: option_name_hash_report(vendor_universe.name_hash));
! 1173: log_info("VIVSO code hash: %s",
! 1174: option_code_hash_report(vendor_universe.code_hash));
! 1175: #endif
! 1176:
! 1177: /* Set up the ISC Vendor-option universe (for option 125.2495)... */
! 1178: isc_universe.name = "isc";
! 1179: isc_universe.concat_duplicates = 0; /* XXX: check VIVSO ref */
! 1180: isc_universe.lookup_func = lookup_linked_option;
! 1181: isc_universe.option_state_dereference =
! 1182: linked_option_state_dereference;
! 1183: isc_universe.save_func = save_linked_option;
! 1184: isc_universe.delete_func = delete_linked_option;
! 1185: isc_universe.encapsulate = linked_option_space_encapsulate;
! 1186: isc_universe.foreach = linked_option_space_foreach;
! 1187: isc_universe.decode = parse_option_buffer;
! 1188: isc_universe.length_size = 2;
! 1189: isc_universe.tag_size = 2;
! 1190: isc_universe.get_tag = getUShort;
! 1191: isc_universe.store_tag = putUShort;
! 1192: isc_universe.get_length = getUShort;
! 1193: isc_universe.store_length = putUShort;
! 1194: isc_universe.site_code_min = 0;
! 1195: isc_universe.end = 0;
! 1196: code = VENDOR_ISC_SUBOPTIONS;
! 1197: isc_universe.enc_opt = NULL;
! 1198: if (!option_code_hash_lookup(&isc_universe.enc_opt,
! 1199: vendor_universe.code_hash, &code, 0, MDL))
! 1200: log_fatal("Unable to find ISC parent option (%s:%d).", MDL);
! 1201: isc_universe.index = universe_count++;
! 1202: universes[isc_universe.index] = &isc_universe;
! 1203: if (!option_name_new_hash(&isc_universe.name_hash,
! 1204: VIV_ISC_HASH_SIZE, MDL) ||
! 1205: !option_code_new_hash(&isc_universe.code_hash,
! 1206: VIV_ISC_HASH_SIZE, MDL))
! 1207: log_fatal("Can't allocate ISC Vendor options hash table.");
! 1208: for (i = 0 ; isc_options[i].name ; i++) {
! 1209: option_code_hash_add(isc_universe.code_hash,
! 1210: &isc_options[i].code, 0,
! 1211: &isc_options[i], MDL);
! 1212: option_name_hash_add(isc_universe.name_hash,
! 1213: isc_options[i].name, 0,
! 1214: &isc_options[i], MDL);
! 1215: }
! 1216: #if defined(REPORT_HASH_PERFORMANCE)
! 1217: log_info("ISC name hash: %s",
! 1218: option_name_hash_report(isc_universe.name_hash));
! 1219: log_info("ISC code hash: %s",
! 1220: option_code_hash_report(isc_universe.code_hash));
! 1221: #endif
! 1222:
! 1223: /* Set up the DHCPv6 root universe. */
! 1224: dhcpv6_universe.name = "dhcp6";
! 1225: dhcpv6_universe.concat_duplicates = 0;
! 1226: dhcpv6_universe.lookup_func = lookup_hashed_option;
! 1227: dhcpv6_universe.option_state_dereference =
! 1228: hashed_option_state_dereference;
! 1229: dhcpv6_universe.save_func = save_hashed_option;
! 1230: dhcpv6_universe.delete_func = delete_hashed_option;
! 1231: dhcpv6_universe.encapsulate = hashed_option_space_encapsulate;
! 1232: dhcpv6_universe.foreach = hashed_option_space_foreach;
! 1233: dhcpv6_universe.decode = parse_option_buffer;
! 1234: dhcpv6_universe.length_size = 2;
! 1235: dhcpv6_universe.tag_size = 2;
! 1236: dhcpv6_universe.get_tag = getUShort;
! 1237: dhcpv6_universe.store_tag = putUShort;
! 1238: dhcpv6_universe.get_length = getUShort;
! 1239: dhcpv6_universe.store_length = putUShort;
! 1240: dhcpv6_universe.site_code_min = 0;
! 1241: /* DHCPv6 has no END option. */
! 1242: dhcpv6_universe.end = 0x00;
! 1243: dhcpv6_universe.index = universe_count++;
! 1244: universes[dhcpv6_universe.index] = &dhcpv6_universe;
! 1245: if (!option_name_new_hash(&dhcpv6_universe.name_hash,
! 1246: WORD_NAME_HASH_SIZE, MDL) ||
! 1247: !option_code_new_hash(&dhcpv6_universe.code_hash,
! 1248: WORD_CODE_HASH_SIZE, MDL))
! 1249: log_fatal("Can't allocate dhcpv6 option hash tables.");
! 1250: for (i = 0 ; dhcpv6_options[i].name ; i++) {
! 1251: option_code_hash_add(dhcpv6_universe.code_hash,
! 1252: &dhcpv6_options[i].code, 0,
! 1253: &dhcpv6_options[i], MDL);
! 1254: option_name_hash_add(dhcpv6_universe.name_hash,
! 1255: dhcpv6_options[i].name, 0,
! 1256: &dhcpv6_options[i], MDL);
! 1257: }
! 1258:
! 1259: /* Add DHCPv6 protocol enumeration sets. */
! 1260: add_enumeration(&dhcpv6_duid_types);
! 1261: add_enumeration(&dhcpv6_status_codes);
! 1262: add_enumeration(&dhcpv6_messages);
! 1263:
! 1264: /* Set up DHCPv6 VSIO universe. */
! 1265: vsio_universe.name = "vsio";
! 1266: vsio_universe.concat_duplicates = 0;
! 1267: vsio_universe.lookup_func = lookup_hashed_option;
! 1268: vsio_universe.option_state_dereference =
! 1269: hashed_option_state_dereference;
! 1270: vsio_universe.save_func = save_hashed_option;
! 1271: vsio_universe.delete_func = delete_hashed_option;
! 1272: vsio_universe.encapsulate = hashed_option_space_encapsulate;
! 1273: vsio_universe.foreach = hashed_option_space_foreach;
! 1274: vsio_universe.decode = parse_option_buffer;
! 1275: vsio_universe.length_size = 0;
! 1276: vsio_universe.tag_size = 4;
! 1277: vsio_universe.get_tag = getULong;
! 1278: vsio_universe.store_tag = putULong;
! 1279: vsio_universe.get_length = NULL;
! 1280: vsio_universe.store_length = NULL;
! 1281: vsio_universe.site_code_min = 0;
! 1282: /* No END option. */
! 1283: vsio_universe.end = 0x00;
! 1284: code = D6O_VENDOR_OPTS;
! 1285: if (!option_code_hash_lookup(&vsio_universe.enc_opt,
! 1286: dhcpv6_universe.code_hash, &code, 0, MDL))
! 1287: log_fatal("Unable to find VSIO parent option (%s:%d).", MDL);
! 1288: vsio_universe.index = universe_count++;
! 1289: universes[vsio_universe.index] = &vsio_universe;
! 1290: if (!option_name_new_hash(&vsio_universe.name_hash,
! 1291: VSIO_HASH_SIZE, MDL) ||
! 1292: !option_code_new_hash(&vsio_universe.code_hash,
! 1293: VSIO_HASH_SIZE, MDL))
! 1294: log_fatal("Can't allocate Vendor Specific Information "
! 1295: "Options space.");
! 1296: for (i = 0 ; vsio_options[i].name != NULL ; i++) {
! 1297: option_code_hash_add(vsio_universe.code_hash,
! 1298: &vsio_options[i].code, 0,
! 1299: &vsio_options[i], MDL);
! 1300: option_name_hash_add(vsio_universe.name_hash,
! 1301: vsio_options[i].name, 0,
! 1302: &vsio_options[i], MDL);
! 1303: }
! 1304:
! 1305: /* Add ISC VSIO sub-sub-option space. */
! 1306: isc6_universe.name = "isc6";
! 1307: isc6_universe.concat_duplicates = 0;
! 1308: isc6_universe.lookup_func = lookup_hashed_option;
! 1309: isc6_universe.option_state_dereference =
! 1310: hashed_option_state_dereference;
! 1311: isc6_universe.save_func = save_hashed_option;
! 1312: isc6_universe.delete_func = delete_hashed_option;
! 1313: isc6_universe.encapsulate = hashed_option_space_encapsulate;
! 1314: isc6_universe.foreach = hashed_option_space_foreach;
! 1315: isc6_universe.decode = parse_option_buffer;
! 1316: isc6_universe.length_size = 0;
! 1317: isc6_universe.tag_size = 4;
! 1318: isc6_universe.get_tag = getULong;
! 1319: isc6_universe.store_tag = putULong;
! 1320: isc6_universe.get_length = NULL;
! 1321: isc6_universe.store_length = NULL;
! 1322: isc6_universe.site_code_min = 0;
! 1323: /* No END option. */
! 1324: isc6_universe.end = 0x00;
! 1325: code = 2495;
! 1326: if (!option_code_hash_lookup(&isc6_universe.enc_opt,
! 1327: vsio_universe.code_hash, &code, 0, MDL))
! 1328: log_fatal("Unable to find ISC parent option (%s:%d).", MDL);
! 1329: isc6_universe.index = universe_count++;
! 1330: universes[isc6_universe.index] = &isc6_universe;
! 1331: if (!option_name_new_hash(&isc6_universe.name_hash,
! 1332: VIV_ISC_HASH_SIZE, MDL) ||
! 1333: !option_code_new_hash(&isc6_universe.code_hash,
! 1334: VIV_ISC_HASH_SIZE, MDL))
! 1335: log_fatal("Can't allocate Vendor Specific Information "
! 1336: "Options space.");
! 1337: for (i = 0 ; isc6_options[i].name != NULL ; i++) {
! 1338: option_code_hash_add(isc6_universe.code_hash,
! 1339: &isc6_options[i].code, 0,
! 1340: &isc6_options[i], MDL);
! 1341: option_name_hash_add(isc6_universe.name_hash,
! 1342: isc6_options[i].name, 0,
! 1343: &isc6_options[i], MDL);
! 1344: }
! 1345:
! 1346: /* The fqdn6 option space is a protocol-wrapper shill for the
! 1347: * old DHCPv4 space.
! 1348: */
! 1349: fqdn6_universe.name = "fqdn6-if-you-see-me-its-a-bug-bug-bug";
! 1350: fqdn6_universe.lookup_func = lookup_fqdn6_option;
! 1351: fqdn6_universe.option_state_dereference = NULL; /* Covered by v4. */
! 1352: fqdn6_universe.save_func = save_fqdn6_option;
! 1353: fqdn6_universe.delete_func = delete_fqdn6_option;
! 1354: fqdn6_universe.encapsulate = fqdn6_option_space_encapsulate;
! 1355: fqdn6_universe.foreach = fqdn6_option_space_foreach;
! 1356: fqdn6_universe.decode = fqdn6_universe_decode;
! 1357: /* This is not a 'normal' encapsulated space, so these values are
! 1358: * meaningless.
! 1359: */
! 1360: fqdn6_universe.length_size = 0;
! 1361: fqdn6_universe.tag_size = 0;
! 1362: fqdn6_universe.get_tag = NULL;
! 1363: fqdn6_universe.store_tag = NULL;
! 1364: fqdn6_universe.get_length = NULL;
! 1365: fqdn6_universe.store_length = NULL;
! 1366: fqdn6_universe.site_code_min = 0;
! 1367: fqdn6_universe.end = 0;
! 1368: fqdn6_universe.index = universe_count++;
! 1369: code = D6O_CLIENT_FQDN;
! 1370: fqdn6_universe.enc_opt = NULL;
! 1371: if (!option_code_hash_lookup(&fqdn6_universe.enc_opt,
! 1372: dhcpv6_universe.code_hash, &code, 0, MDL))
! 1373: log_fatal("Unable to find FQDN v6 parent option. (%s:%d).",
! 1374: MDL);
! 1375: universes[fqdn6_universe.index] = &fqdn6_universe;
! 1376: /* The fqdn6 space shares the same option space as the v4 space.
! 1377: * So there are no name or code hashes on the v6 side.
! 1378: */
! 1379: fqdn6_universe.name_hash = NULL;
! 1380: fqdn6_universe.code_hash = NULL;
! 1381:
! 1382:
! 1383: /* Set up the hash of DHCPv4 universes. */
! 1384: universe_new_hash(&universe_hash, UNIVERSE_HASH_SIZE, MDL);
! 1385: universe_hash_add(universe_hash, dhcp_universe.name, 0,
! 1386: &dhcp_universe, MDL);
! 1387: universe_hash_add(universe_hash, nwip_universe.name, 0,
! 1388: &nwip_universe, MDL);
! 1389: universe_hash_add(universe_hash, fqdn_universe.name, 0,
! 1390: &fqdn_universe, MDL);
! 1391: universe_hash_add(universe_hash, vendor_class_universe.name, 0,
! 1392: &vendor_class_universe, MDL);
! 1393: universe_hash_add(universe_hash, vendor_universe.name, 0,
! 1394: &vendor_universe, MDL);
! 1395: universe_hash_add(universe_hash, isc_universe.name, 0,
! 1396: &isc_universe, MDL);
! 1397:
! 1398: /* Set up hashes for DHCPv6 universes. */
! 1399: universe_hash_add(universe_hash, dhcpv6_universe.name, 0,
! 1400: &dhcpv6_universe, MDL);
! 1401: universe_hash_add(universe_hash, vsio_universe.name, 0,
! 1402: &vsio_universe, MDL);
! 1403: universe_hash_add(universe_hash, isc6_universe.name, 0,
! 1404: &isc6_universe, MDL);
! 1405: /* This should not be necessary. Listing here just for consistency.
! 1406: * universe_hash_add(universe_hash, fqdn6_universe.name, 0,
! 1407: * &fqdn6_universe, MDL);
! 1408: */
! 1409: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>