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