3 Tables of information... */
6 * Copyright (c) 2004-2009 by Internet Systems Consortium, Inc. ("ISC")
7 * Copyright (c) 1995-2003 by Internet Software Consortium
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.
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.
21 * Internet Systems Consortium, Inc.
23 * Redwood City, CA 94063
25 * https://www.isc.org/
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''.
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,
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,
49 /* DHCP Option names, formats and codes, from RFC1533.
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
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
69 U - name of an option space (universe)
70 F - implicit flag - the presence of the option indicates that the
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
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
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 },
189 /* Note: RFC4280 fails to identify if the DHCPv4 option is to use
190 * compression pointers or not. Assume not.
192 { "bcms-controller-names", "D", &dhcp_universe, 88, 1 },
193 { "bcms-controller-address", "Ia", &dhcp_universe, 89, 1 },
195 /* 90 is the authentication option (RFC 3118) */
197 { "client-last-transaction-time", "L", &dhcp_universe, 91, 1 },
198 { "associated-ip", "Ia", &dhcp_universe, 92, 1 },
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 },
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 },
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.
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 },
228 /* Not defined by RFC yet */
229 { "tftp-server-address", "Ia", &dhcp_universe, 150, 1 },
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 },
239 /* Not defined by RFC yet */
240 { "vss-info", "BX", &dhcp_universe, 221, 1 },
242 { NULL, NULL, NULL, 0, 0 }
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 }
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).
269 * Note further that the DHCPv6 and DHCPv4 'fqdn' options use the same
270 * virtualized option space to store their work.
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 }
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 }
293 struct universe vendor_universe;
294 static struct option vendor_options[] = {
295 { "isc", "Eisc.", &vendor_universe, 2495, 1 },
296 { NULL, NULL, NULL, 0, 0 }
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 }
306 struct universe dhcpv6_universe;
307 static struct option dhcpv6_options[] = {
309 /* RFC3315 OPTIONS */
311 /* Client and server DUIDs are opaque fields, but marking them
312 * up somewhat makes configuration easier.
314 { "client-id", "X", &dhcpv6_universe, 1, 1 },
315 { "server-id", "X", &dhcpv6_universe, 2, 1 },
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").
322 { "ia-na", "X", &dhcpv6_universe, 3, 1 },
323 { "ia-ta", "X", &dhcpv6_universe, 4, 1 },
324 { "ia-addr", "X", &dhcpv6_universe, 5, 1 },
326 /* "oro" is DHCPv6 speak for "parameter-request-list" */
327 { "oro", "SA", &dhcpv6_universe, 6, 1 },
329 { "preference", "B", &dhcpv6_universe, 7, 1 },
330 { "elapsed-time", "S", &dhcpv6_universe, 8, 1 },
331 { "relay-msg", "X", &dhcpv6_universe, 9, 1 },
333 /* Option code 10 is curiously unassigned. */
335 * In draft-ietf-dhc-dhcpv6-25 there were two OPTION_CLIENT_MSG and
336 * OPTION_SERVER_MSG options. They were eventually unified as
337 * OPTION_RELAY_MSG, hence no option with value of 10.
340 /* XXX: missing suitable atoms for the auth option. We may want
341 * to 'virtually encapsulate' this option a la the fqdn option
342 * seeing as it is processed explicitly by the server and unlikely
343 * to be configured by hand by users as such.
345 { "auth", "Nauth-protocol.Nauth-algorithm.Nrdm-type.LLX",
346 &dhcpv6_universe, 11, 1 },
348 { "unicast", "6", &dhcpv6_universe, 12, 1 },
349 { "status-code", "Nstatus-codes.to", &dhcpv6_universe, 13, 1 },
350 { "rapid-commit", "Z", &dhcpv6_universe, 14, 1 },
352 /* XXX: user-class contents are of the form "StA" where the
353 * integer describes the length of the text field. We don't have
354 * an atom for pre-determined-length octet strings yet, so we
355 * can't quite do these two.
357 { "user-class", "X", &dhcpv6_universe, 15, 1 },
358 { "vendor-class", "X", &dhcpv6_universe, 16, 1 },
360 { "vendor-opts", "Evsio.", &dhcpv6_universe, 17, 1 },
361 { "interface-id", "X", &dhcpv6_universe, 18, 1 },
362 { "reconf-msg", "Ndhcpv6-messages.", &dhcpv6_universe, 19, 1 },
363 { "reconf-accept", "Z", &dhcpv6_universe, 20, 1 },
365 /* RFC3319 OPTIONS */
367 /* Of course: we would HAVE to have a different atom for
368 * domain names without compression. Typical.
370 { "sip-servers-names", "D", &dhcpv6_universe, 21, 1 },
371 { "sip-servers-addresses", "6A", &dhcpv6_universe, 22, 1 },
373 /* RFC3646 OPTIONS */
375 { "name-servers", "6A", &dhcpv6_universe, 23, 1 },
376 { "domain-search", "D", &dhcpv6_universe, 24, 1 },
378 /* RFC3633 OPTIONS */
380 { "ia-pd", "X", &dhcpv6_universe, 25, 1 },
381 { "ia-prefix", "X", &dhcpv6_universe, 26, 1 },
383 /* RFC3898 OPTIONS */
385 { "nis-servers", "6A", &dhcpv6_universe, 27, 1 },
386 { "nisp-servers", "6A", &dhcpv6_universe, 28, 1 },
387 { "nis-domain-name", "D", &dhcpv6_universe, 29, 1 },
388 { "nisp-domain-name", "D", &dhcpv6_universe, 30, 1 },
390 /* RFC4075 OPTIONS */
391 { "sntp-servers", "6A", &dhcpv6_universe, 31, 1 },
393 /* RFC4242 OPTIONS */
395 { "info-refresh-time", "T", &dhcpv6_universe, 32, 1 },
397 /* RFC4280 OPTIONS */
399 { "bcms-server-d", "D", &dhcpv6_universe, 33, 1 },
400 { "bcms-server-a", "6A", &dhcpv6_universe, 34, 1 },
402 /* Note that 35 is not assigned. */
404 /* Not yet considering for inclusion. */
406 /* RFC4776 OPTIONS */
408 { "geoconf-civic", "X", &dhcpv6_universe, 36, 1 },
411 /* RFC4649 OPTIONS */
413 /* The remote-id option looks like the VSIO option, but for all
414 * intents and purposes we only need to treat the entire field
415 * like a globally unique identifier (and if we create such an
416 * option, ensure the first 4 bytes are our enterprise-id followed
417 * by a globally unique ID so long as you're within that enterprise
418 * id). So we'll use "X" for now unless someone grumbles.
420 { "remote-id", "X", &dhcpv6_universe, 37, 1 },
422 /* RFC4580 OPTIONS */
424 { "subscriber-id", "X", &dhcpv6_universe, 38, 1 },
426 /* RFC4704 OPTIONS */
428 /* The DHCPv6 FQDN option is...weird.
430 * We use the same "virtual" encapsulated space as DHCPv4's FQDN
431 * option, so it can all be configured in one place. Since the
432 * options system does not support multiple inheritance, we use
433 * a 'shill' layer to perform the different protocol conversions,
434 * and to redirect any queries in the DHCPv4 FQDN's space.
436 { "fqdn", "Efqdn6-if-you-see-me-its-a-bug-bug-bug.",
437 &dhcpv6_universe, 39, 1 },
439 /* Not yet considering for inclusion. */
441 /* draft-ietf-dhc-paa-option-05 */
442 { "pana-agent", "6A", &dhcpv6_universe, 40, 1 },
444 /* RFC4833 OPTIONS */
446 { "new-posix-timezone", "t", &dhcpv6_universe, 41, 1 },
447 { "new-tzdb-timezone", "t", &dhcpv6_universe, 42, 1 },
449 /* RFC4994 OPTIONS */
451 { "ero", "SA", &dhcpv6_universe, 43, 1 },
454 /* RFC5007 OPTIONS */
456 { "lq-query", "X", &dhcpv6_universe, 44, 1 },
457 { "client-data", "X", &dhcpv6_universe, 45, 1 },
458 { "clt-time", "L", &dhcpv6_universe, 46, 1 },
459 { "lq-relay-data", "6X", &dhcpv6_universe, 47, 1 },
460 { "lq-client-link", "6A", &dhcpv6_universe, 48, 1 },
462 { NULL, NULL, NULL, 0, 0 }
465 struct enumeration_value dhcpv6_duid_type_values[] = {
466 { "duid-llt", DUID_LLT }, /* Link-Local Plus Time */
467 { "duid-en", DUID_EN }, /* DUID based upon enterprise-ID. */
468 { "duid-ll", DUID_LL }, /* DUID from Link Local address only. */
472 struct enumeration dhcpv6_duid_types = {
475 dhcpv6_duid_type_values
478 struct enumeration_value dhcpv6_status_code_values[] = {
479 { "success", 0 }, /* Success */
480 { "UnspecFail", 1 }, /* Failure, for unspecified reasons. */
481 { "NoAddrsAvail", 2 }, /* Server has no addresses to assign. */
482 { "NoBinding", 3 }, /* Client record (binding) unavailable. */
483 { "NotOnLink", 4 }, /* Bad prefix for the link. */
484 { "UseMulticast", 5 }, /* Not just good advice. It's the law. */
485 { "NoPrefixAvail", 6 }, /* Server has no prefixes to assign. */
486 { "UnknownQueryType", 7 }, /* Query-type unknown/unsupported. */
487 { "MalformedQuery", 8 }, /* Leasequery not valid. */
488 { "NotConfigured", 9 }, /* The target address is not in config. */
489 { "NotAllowed", 10 }, /* Server doesn't allow the leasequery. */
493 struct enumeration dhcpv6_status_codes = {
496 dhcpv6_status_code_values
499 struct enumeration_value lq6_query_type_values[] = {
500 { "query-by-address", 1 },
501 { "query-by-clientid", 2 },
505 struct enumeration lq6_query_types = {
508 lq6_query_type_values
511 struct enumeration_value dhcpv6_message_values[] = {
521 { "RECONFIGURE", 10 },
522 { "INFORMATION-REQUEST", 11 },
523 { "RELAY-FORW", 12 },
524 { "RELAY-REPL", 13 },
525 { "LEASEQUERY", 14 },
526 { "LEASEQUERY-REPLY", 15 },
530 /* Some code refers to a different table. */
531 const char *dhcpv6_type_names[] = {
543 "Information-request",
549 const int dhcpv6_type_name_max =
550 (sizeof(dhcpv6_type_names) / sizeof(dhcpv6_type_names[0]));
552 struct enumeration dhcpv6_messages = {
554 "dhcpv6-messages", 1,
555 dhcpv6_message_values
558 struct universe vsio_universe;
559 static struct option vsio_options[] = {
560 { "isc", "Eisc6.", &vsio_universe, 2495, 1 },
561 { NULL, NULL, NULL, 0, 0 }
564 struct universe isc6_universe;
565 static struct option isc6_options[] = {
566 { "media", "t", &isc6_universe, 1, 1 },
567 { "update-assist", "X", &isc6_universe, 2, 1 },
568 { NULL, NULL, NULL, 0, 0 }
571 const char *hardware_types [] = {
829 universe_hash_t *universe_hash;
830 struct universe **universes;
831 int universe_count, universe_max;
833 /* Universe containing names of configuration options, which, rather than
834 writing "option universe-name.option-name ...;", can be set by writing
835 "option-name ...;". */
837 struct universe *config_universe;
839 /* XXX: omapi must die...all the below keeps us from having to make the
840 * option structures omapi typed objects, which is a bigger headache.
843 char *default_option_format = (char *) "X";
845 /* Must match hash_reference/dereference types in omapip/hash.h. */
847 option_reference(struct option **dest, struct option *src,
848 const char * file, int line)
851 return DHCP_R_INVALIDARG;
854 #if defined(POINTER_DEBUG)
855 log_fatal("%s(%d): reference store into non-null pointer!",
858 return DHCP_R_INVALIDARG;
864 rc_register(file, line, dest, src, src->refcnt, 0, RC_MISC);
865 return(ISC_R_SUCCESS);
869 option_dereference(struct option **dest, const char *file, int line)
872 return DHCP_R_INVALIDARG;
875 #if defined (POINTER_DEBUG)
876 log_fatal("%s(%d): dereference of null pointer!", file, line);
878 return DHCP_R_INVALIDARG;
882 if ((*dest)->refcnt <= 0) {
883 #if defined (POINTER_DEBUG)
884 log_fatal("%s(%d): dereference of <= 0 refcnt!", file, line);
886 return DHCP_R_INVALIDARG;
892 rc_register(file, line, dest, (*dest), (*dest)->refcnt, 1, RC_MISC);
894 if ((*dest)->refcnt == 0) {
895 /* The option name may be packed in the same alloc as the
898 if ((char *) (*dest)->name != (char *) ((*dest) + 1))
899 dfree((char *) (*dest)->name, file, line);
901 /* It's either a user-configured format (allocated), or the
902 * default static format.
904 if (((*dest)->format != NULL) &&
905 ((*dest)->format != default_option_format)) {
906 dfree((char *) (*dest)->format, file, line);
909 dfree(*dest, file, line);
913 return ISC_R_SUCCESS;
916 void initialize_common_option_spaces()
921 /* The 'universes' table is dynamically grown to contain
922 * universe as they're configured - except during startup.
923 * Since we know how many we put down in .c files, we can
924 * allocate a more-than-right-sized buffer now, leaving some
925 * space for user-configured option spaces.
927 * 1: dhcp_universe (dhcpv4 options)
928 * 2: nwip_universe (dhcpv4 NWIP option)
929 * 3: fqdn_universe (dhcpv4 fqdn option - reusable for v6)
930 * 4: vendor_class_universe (VIVCO)
931 * 5: vendor_universe (VIVSO)
932 * 6: isc_universe (dhcpv4 isc config space)
933 * 7: dhcpv6_universe (dhcpv6 options)
934 * 8: vsio_universe (DHCPv6 Vendor-Identified space)
935 * 9: isc6_universe (ISC's Vendor universe in DHCPv6 VSIO)
936 * 10: fqdn6_universe (dhcpv6 fqdn option shill to v4)
937 * 11: agent_universe (dhcpv4 relay agent - see server/stables.c)
938 * 12: server_universe (server's config, see server/stables.c)
940 * 14: more user-config
941 * 15: more user-config
942 * 16: more user-config
945 i = universe_max * sizeof(struct universe *);
947 log_fatal("Ludicrous initial size option space table.");
948 universes = dmalloc(i, MDL);
949 if (universes == NULL)
950 log_fatal("Can't allocate option space table.");
951 memset(universes, 0, i);
953 /* Set up the DHCP option universe... */
954 dhcp_universe.name = "dhcp";
955 dhcp_universe.concat_duplicates = 1;
956 dhcp_universe.lookup_func = lookup_hashed_option;
957 dhcp_universe.option_state_dereference =
958 hashed_option_state_dereference;
959 dhcp_universe.save_func = save_hashed_option;
960 dhcp_universe.delete_func = delete_hashed_option;
961 dhcp_universe.encapsulate = hashed_option_space_encapsulate;
962 dhcp_universe.foreach = hashed_option_space_foreach;
963 dhcp_universe.decode = parse_option_buffer;
964 dhcp_universe.length_size = 1;
965 dhcp_universe.tag_size = 1;
966 dhcp_universe.get_tag = getUChar;
967 dhcp_universe.store_tag = putUChar;
968 dhcp_universe.get_length = getUChar;
969 dhcp_universe.store_length = putUChar;
970 dhcp_universe.site_code_min = 0;
971 dhcp_universe.end = DHO_END;
972 dhcp_universe.index = universe_count++;
973 universes [dhcp_universe.index] = &dhcp_universe;
974 if (!option_name_new_hash(&dhcp_universe.name_hash,
975 BYTE_NAME_HASH_SIZE, MDL) ||
976 !option_code_new_hash(&dhcp_universe.code_hash,
977 BYTE_CODE_HASH_SIZE, MDL))
978 log_fatal ("Can't allocate dhcp option hash table.");
979 for (i = 0 ; dhcp_options[i].name ; i++) {
980 option_code_hash_add(dhcp_universe.code_hash,
981 &dhcp_options[i].code, 0,
982 &dhcp_options[i], MDL);
983 option_name_hash_add(dhcp_universe.name_hash,
984 dhcp_options [i].name, 0,
985 &dhcp_options [i], MDL);
987 #if defined(REPORT_HASH_PERFORMANCE)
988 log_info("DHCP name hash: %s",
989 option_name_hash_report(dhcp_universe.name_hash));
990 log_info("DHCP code hash: %s",
991 option_code_hash_report(dhcp_universe.code_hash));
994 /* Set up the Novell option universe (for option 63)... */
995 nwip_universe.name = "nwip";
996 nwip_universe.concat_duplicates = 0; /* XXX: reference? */
997 nwip_universe.lookup_func = lookup_linked_option;
998 nwip_universe.option_state_dereference =
999 linked_option_state_dereference;
1000 nwip_universe.save_func = save_linked_option;
1001 nwip_universe.delete_func = delete_linked_option;
1002 nwip_universe.encapsulate = nwip_option_space_encapsulate;
1003 nwip_universe.foreach = linked_option_space_foreach;
1004 nwip_universe.decode = parse_option_buffer;
1005 nwip_universe.length_size = 1;
1006 nwip_universe.tag_size = 1;
1007 nwip_universe.get_tag = getUChar;
1008 nwip_universe.store_tag = putUChar;
1009 nwip_universe.get_length = getUChar;
1010 nwip_universe.store_length = putUChar;
1011 nwip_universe.site_code_min = 0;
1012 nwip_universe.end = 0;
1013 code = DHO_NWIP_SUBOPTIONS;
1014 nwip_universe.enc_opt = NULL;
1015 if (!option_code_hash_lookup(&nwip_universe.enc_opt,
1016 dhcp_universe.code_hash, &code, 0, MDL))
1017 log_fatal("Unable to find NWIP parent option (%s:%d).", MDL);
1018 nwip_universe.index = universe_count++;
1019 universes [nwip_universe.index] = &nwip_universe;
1020 if (!option_name_new_hash(&nwip_universe.name_hash,
1021 NWIP_HASH_SIZE, MDL) ||
1022 !option_code_new_hash(&nwip_universe.code_hash,
1023 NWIP_HASH_SIZE, MDL))
1024 log_fatal ("Can't allocate nwip option hash table.");
1025 for (i = 0 ; nwip_options[i].name ; i++) {
1026 option_code_hash_add(nwip_universe.code_hash,
1027 &nwip_options[i].code, 0,
1028 &nwip_options[i], MDL);
1029 option_name_hash_add(nwip_universe.name_hash,
1030 nwip_options[i].name, 0,
1031 &nwip_options[i], MDL);
1033 #if defined(REPORT_HASH_PERFORMANCE)
1034 log_info("NWIP name hash: %s",
1035 option_name_hash_report(nwip_universe.name_hash));
1036 log_info("NWIP code hash: %s",
1037 option_code_hash_report(nwip_universe.code_hash));
1040 /* Set up the FQDN option universe... */
1041 fqdn_universe.name = "fqdn";
1042 fqdn_universe.concat_duplicates = 0;
1043 fqdn_universe.lookup_func = lookup_linked_option;
1044 fqdn_universe.option_state_dereference =
1045 linked_option_state_dereference;
1046 fqdn_universe.save_func = save_linked_option;
1047 fqdn_universe.delete_func = delete_linked_option;
1048 fqdn_universe.encapsulate = fqdn_option_space_encapsulate;
1049 fqdn_universe.foreach = linked_option_space_foreach;
1050 fqdn_universe.decode = fqdn_universe_decode;
1051 fqdn_universe.length_size = 1;
1052 fqdn_universe.tag_size = 1;
1053 fqdn_universe.get_tag = getUChar;
1054 fqdn_universe.store_tag = putUChar;
1055 fqdn_universe.get_length = getUChar;
1056 fqdn_universe.store_length = putUChar;
1057 fqdn_universe.site_code_min = 0;
1058 fqdn_universe.end = 0;
1059 fqdn_universe.index = universe_count++;
1061 fqdn_universe.enc_opt = NULL;
1062 if (!option_code_hash_lookup(&fqdn_universe.enc_opt,
1063 dhcp_universe.code_hash, &code, 0, MDL))
1064 log_fatal("Unable to find FQDN parent option (%s:%d).", MDL);
1065 universes [fqdn_universe.index] = &fqdn_universe;
1066 if (!option_name_new_hash(&fqdn_universe.name_hash,
1067 FQDN_HASH_SIZE, MDL) ||
1068 !option_code_new_hash(&fqdn_universe.code_hash,
1069 FQDN_HASH_SIZE, MDL))
1070 log_fatal ("Can't allocate fqdn option hash table.");
1071 for (i = 0 ; fqdn_options[i].name ; i++) {
1072 option_code_hash_add(fqdn_universe.code_hash,
1073 &fqdn_options[i].code, 0,
1074 &fqdn_options[i], MDL);
1075 option_name_hash_add(fqdn_universe.name_hash,
1076 fqdn_options[i].name, 0,
1077 &fqdn_options[i], MDL);
1079 #if defined(REPORT_HASH_PERFORMANCE)
1080 log_info("FQDN name hash: %s",
1081 option_name_hash_report(fqdn_universe.name_hash));
1082 log_info("FQDN code hash: %s",
1083 option_code_hash_report(fqdn_universe.code_hash));
1086 /* Set up the Vendor Identified Vendor Class options (for option
1089 vendor_class_universe.name = "vendor-class";
1090 vendor_class_universe.concat_duplicates = 0; /* XXX: reference? */
1091 vendor_class_universe.lookup_func = lookup_hashed_option;
1092 vendor_class_universe.option_state_dereference =
1093 hashed_option_state_dereference;
1094 vendor_class_universe.save_func = save_hashed_option;
1095 vendor_class_universe.delete_func = delete_hashed_option;
1096 vendor_class_universe.encapsulate = hashed_option_space_encapsulate;
1097 vendor_class_universe.foreach = hashed_option_space_foreach;
1098 vendor_class_universe.decode = parse_option_buffer;
1099 vendor_class_universe.length_size = 1;
1100 vendor_class_universe.tag_size = 4;
1101 vendor_class_universe.get_tag = getULong;
1102 vendor_class_universe.store_tag = putULong;
1103 vendor_class_universe.get_length = getUChar;
1104 vendor_class_universe.store_length = putUChar;
1105 vendor_class_universe.site_code_min = 0;
1106 vendor_class_universe.end = 0;
1107 code = DHO_VIVCO_SUBOPTIONS;
1108 vendor_class_universe.enc_opt = NULL;
1109 if (!option_code_hash_lookup(&vendor_class_universe.enc_opt,
1110 dhcp_universe.code_hash, &code, 0, MDL))
1111 log_fatal("Unable to find VIVCO parent option (%s:%d).", MDL);
1112 vendor_class_universe.index = universe_count++;
1113 universes[vendor_class_universe.index] = &vendor_class_universe;
1114 if (!option_name_new_hash(&vendor_class_universe.name_hash,
1115 VIVCO_HASH_SIZE, MDL) ||
1116 !option_code_new_hash(&vendor_class_universe.code_hash,
1117 VIVCO_HASH_SIZE, MDL))
1118 log_fatal("Can't allocate Vendor Identified Vendor Class "
1119 "option hash table.");
1120 for (i = 0 ; vendor_class_options[i].name ; i++) {
1121 option_code_hash_add(vendor_class_universe.code_hash,
1122 &vendor_class_options[i].code, 0,
1123 &vendor_class_options[i], MDL);
1124 option_name_hash_add(vendor_class_universe.name_hash,
1125 vendor_class_options[i].name, 0,
1126 &vendor_class_options[i], MDL);
1128 #if defined(REPORT_HASH_PERFORMANCE)
1129 log_info("VIVCO name hash: %s",
1130 option_name_hash_report(vendor_class_universe.name_hash));
1131 log_info("VIVCO code hash: %s",
1132 option_code_hash_report(vendor_class_universe.code_hash));
1135 /* Set up the Vendor Identified Vendor Sub-options (option 126)... */
1136 vendor_universe.name = "vendor";
1137 vendor_universe.concat_duplicates = 0; /* XXX: reference? */
1138 vendor_universe.lookup_func = lookup_hashed_option;
1139 vendor_universe.option_state_dereference =
1140 hashed_option_state_dereference;
1141 vendor_universe.save_func = save_hashed_option;
1142 vendor_universe.delete_func = delete_hashed_option;
1143 vendor_universe.encapsulate = hashed_option_space_encapsulate;
1144 vendor_universe.foreach = hashed_option_space_foreach;
1145 vendor_universe.decode = parse_option_buffer;
1146 vendor_universe.length_size = 1;
1147 vendor_universe.tag_size = 4;
1148 vendor_universe.get_tag = getULong;
1149 vendor_universe.store_tag = putULong;
1150 vendor_universe.get_length = getUChar;
1151 vendor_universe.store_length = putUChar;
1152 vendor_universe.site_code_min = 0;
1153 vendor_universe.end = 0;
1154 code = DHO_VIVSO_SUBOPTIONS;
1155 vendor_universe.enc_opt = NULL;
1156 if (!option_code_hash_lookup(&vendor_universe.enc_opt,
1157 dhcp_universe.code_hash, &code, 0, MDL))
1158 log_fatal("Unable to find VIVSO parent option (%s:%d).", MDL);
1159 vendor_universe.index = universe_count++;
1160 universes[vendor_universe.index] = &vendor_universe;
1161 if (!option_name_new_hash(&vendor_universe.name_hash,
1162 VIVSO_HASH_SIZE, MDL) ||
1163 !option_code_new_hash(&vendor_universe.code_hash,
1164 VIVSO_HASH_SIZE, MDL))
1165 log_fatal("Can't allocate Vendor Identified Vendor Sub-"
1166 "options hash table.");
1167 for (i = 0 ; vendor_options[i].name ; i++) {
1168 option_code_hash_add(vendor_universe.code_hash,
1169 &vendor_options[i].code, 0,
1170 &vendor_options[i], MDL);
1171 option_name_hash_add(vendor_universe.name_hash,
1172 vendor_options[i].name, 0,
1173 &vendor_options[i], MDL);
1175 #if defined(REPORT_HASH_PERFORMANCE)
1176 log_info("VIVSO name hash: %s",
1177 option_name_hash_report(vendor_universe.name_hash));
1178 log_info("VIVSO code hash: %s",
1179 option_code_hash_report(vendor_universe.code_hash));
1182 /* Set up the ISC Vendor-option universe (for option 125.2495)... */
1183 isc_universe.name = "isc";
1184 isc_universe.concat_duplicates = 0; /* XXX: check VIVSO ref */
1185 isc_universe.lookup_func = lookup_linked_option;
1186 isc_universe.option_state_dereference =
1187 linked_option_state_dereference;
1188 isc_universe.save_func = save_linked_option;
1189 isc_universe.delete_func = delete_linked_option;
1190 isc_universe.encapsulate = linked_option_space_encapsulate;
1191 isc_universe.foreach = linked_option_space_foreach;
1192 isc_universe.decode = parse_option_buffer;
1193 isc_universe.length_size = 2;
1194 isc_universe.tag_size = 2;
1195 isc_universe.get_tag = getUShort;
1196 isc_universe.store_tag = putUShort;
1197 isc_universe.get_length = getUShort;
1198 isc_universe.store_length = putUShort;
1199 isc_universe.site_code_min = 0;
1200 isc_universe.end = 0;
1201 code = VENDOR_ISC_SUBOPTIONS;
1202 isc_universe.enc_opt = NULL;
1203 if (!option_code_hash_lookup(&isc_universe.enc_opt,
1204 vendor_universe.code_hash, &code, 0, MDL))
1205 log_fatal("Unable to find ISC parent option (%s:%d).", MDL);
1206 isc_universe.index = universe_count++;
1207 universes[isc_universe.index] = &isc_universe;
1208 if (!option_name_new_hash(&isc_universe.name_hash,
1209 VIV_ISC_HASH_SIZE, MDL) ||
1210 !option_code_new_hash(&isc_universe.code_hash,
1211 VIV_ISC_HASH_SIZE, MDL))
1212 log_fatal("Can't allocate ISC Vendor options hash table.");
1213 for (i = 0 ; isc_options[i].name ; i++) {
1214 option_code_hash_add(isc_universe.code_hash,
1215 &isc_options[i].code, 0,
1216 &isc_options[i], MDL);
1217 option_name_hash_add(isc_universe.name_hash,
1218 isc_options[i].name, 0,
1219 &isc_options[i], MDL);
1221 #if defined(REPORT_HASH_PERFORMANCE)
1222 log_info("ISC name hash: %s",
1223 option_name_hash_report(isc_universe.name_hash));
1224 log_info("ISC code hash: %s",
1225 option_code_hash_report(isc_universe.code_hash));
1228 /* Set up the DHCPv6 root universe. */
1229 dhcpv6_universe.name = "dhcp6";
1230 dhcpv6_universe.concat_duplicates = 0;
1231 dhcpv6_universe.lookup_func = lookup_hashed_option;
1232 dhcpv6_universe.option_state_dereference =
1233 hashed_option_state_dereference;
1234 dhcpv6_universe.save_func = save_hashed_option;
1235 dhcpv6_universe.delete_func = delete_hashed_option;
1236 dhcpv6_universe.encapsulate = hashed_option_space_encapsulate;
1237 dhcpv6_universe.foreach = hashed_option_space_foreach;
1238 dhcpv6_universe.decode = parse_option_buffer;
1239 dhcpv6_universe.length_size = 2;
1240 dhcpv6_universe.tag_size = 2;
1241 dhcpv6_universe.get_tag = getUShort;
1242 dhcpv6_universe.store_tag = putUShort;
1243 dhcpv6_universe.get_length = getUShort;
1244 dhcpv6_universe.store_length = putUShort;
1245 dhcpv6_universe.site_code_min = 0;
1246 /* DHCPv6 has no END option. */
1247 dhcpv6_universe.end = 0x00;
1248 dhcpv6_universe.index = universe_count++;
1249 universes[dhcpv6_universe.index] = &dhcpv6_universe;
1250 if (!option_name_new_hash(&dhcpv6_universe.name_hash,
1251 WORD_NAME_HASH_SIZE, MDL) ||
1252 !option_code_new_hash(&dhcpv6_universe.code_hash,
1253 WORD_CODE_HASH_SIZE, MDL))
1254 log_fatal("Can't allocate dhcpv6 option hash tables.");
1255 for (i = 0 ; dhcpv6_options[i].name ; i++) {
1256 option_code_hash_add(dhcpv6_universe.code_hash,
1257 &dhcpv6_options[i].code, 0,
1258 &dhcpv6_options[i], MDL);
1259 option_name_hash_add(dhcpv6_universe.name_hash,
1260 dhcpv6_options[i].name, 0,
1261 &dhcpv6_options[i], MDL);
1264 /* Add DHCPv6 protocol enumeration sets. */
1265 add_enumeration(&dhcpv6_duid_types);
1266 add_enumeration(&dhcpv6_status_codes);
1267 add_enumeration(&dhcpv6_messages);
1269 /* Set up DHCPv6 VSIO universe. */
1270 vsio_universe.name = "vsio";
1271 vsio_universe.concat_duplicates = 0;
1272 vsio_universe.lookup_func = lookup_hashed_option;
1273 vsio_universe.option_state_dereference =
1274 hashed_option_state_dereference;
1275 vsio_universe.save_func = save_hashed_option;
1276 vsio_universe.delete_func = delete_hashed_option;
1277 vsio_universe.encapsulate = hashed_option_space_encapsulate;
1278 vsio_universe.foreach = hashed_option_space_foreach;
1279 vsio_universe.decode = parse_option_buffer;
1280 vsio_universe.length_size = 0;
1281 vsio_universe.tag_size = 4;
1282 vsio_universe.get_tag = getULong;
1283 vsio_universe.store_tag = putULong;
1284 vsio_universe.get_length = NULL;
1285 vsio_universe.store_length = NULL;
1286 vsio_universe.site_code_min = 0;
1287 /* No END option. */
1288 vsio_universe.end = 0x00;
1289 code = D6O_VENDOR_OPTS;
1290 if (!option_code_hash_lookup(&vsio_universe.enc_opt,
1291 dhcpv6_universe.code_hash, &code, 0, MDL))
1292 log_fatal("Unable to find VSIO parent option (%s:%d).", MDL);
1293 vsio_universe.index = universe_count++;
1294 universes[vsio_universe.index] = &vsio_universe;
1295 if (!option_name_new_hash(&vsio_universe.name_hash,
1296 VSIO_HASH_SIZE, MDL) ||
1297 !option_code_new_hash(&vsio_universe.code_hash,
1298 VSIO_HASH_SIZE, MDL))
1299 log_fatal("Can't allocate Vendor Specific Information "
1301 for (i = 0 ; vsio_options[i].name != NULL ; i++) {
1302 option_code_hash_add(vsio_universe.code_hash,
1303 &vsio_options[i].code, 0,
1304 &vsio_options[i], MDL);
1305 option_name_hash_add(vsio_universe.name_hash,
1306 vsio_options[i].name, 0,
1307 &vsio_options[i], MDL);
1310 /* Add ISC VSIO sub-sub-option space. */
1311 isc6_universe.name = "isc6";
1312 isc6_universe.concat_duplicates = 0;
1313 isc6_universe.lookup_func = lookup_hashed_option;
1314 isc6_universe.option_state_dereference =
1315 hashed_option_state_dereference;
1316 isc6_universe.save_func = save_hashed_option;
1317 isc6_universe.delete_func = delete_hashed_option;
1318 isc6_universe.encapsulate = hashed_option_space_encapsulate;
1319 isc6_universe.foreach = hashed_option_space_foreach;
1320 isc6_universe.decode = parse_option_buffer;
1321 isc6_universe.length_size = 0;
1322 isc6_universe.tag_size = 4;
1323 isc6_universe.get_tag = getULong;
1324 isc6_universe.store_tag = putULong;
1325 isc6_universe.get_length = NULL;
1326 isc6_universe.store_length = NULL;
1327 isc6_universe.site_code_min = 0;
1328 /* No END option. */
1329 isc6_universe.end = 0x00;
1331 if (!option_code_hash_lookup(&isc6_universe.enc_opt,
1332 vsio_universe.code_hash, &code, 0, MDL))
1333 log_fatal("Unable to find ISC parent option (%s:%d).", MDL);
1334 isc6_universe.index = universe_count++;
1335 universes[isc6_universe.index] = &isc6_universe;
1336 if (!option_name_new_hash(&isc6_universe.name_hash,
1337 VIV_ISC_HASH_SIZE, MDL) ||
1338 !option_code_new_hash(&isc6_universe.code_hash,
1339 VIV_ISC_HASH_SIZE, MDL))
1340 log_fatal("Can't allocate Vendor Specific Information "
1342 for (i = 0 ; isc6_options[i].name != NULL ; i++) {
1343 option_code_hash_add(isc6_universe.code_hash,
1344 &isc6_options[i].code, 0,
1345 &isc6_options[i], MDL);
1346 option_name_hash_add(isc6_universe.name_hash,
1347 isc6_options[i].name, 0,
1348 &isc6_options[i], MDL);
1351 /* The fqdn6 option space is a protocol-wrapper shill for the
1354 fqdn6_universe.name = "fqdn6-if-you-see-me-its-a-bug-bug-bug";
1355 fqdn6_universe.lookup_func = lookup_fqdn6_option;
1356 fqdn6_universe.option_state_dereference = NULL; /* Covered by v4. */
1357 fqdn6_universe.save_func = save_fqdn6_option;
1358 fqdn6_universe.delete_func = delete_fqdn6_option;
1359 fqdn6_universe.encapsulate = fqdn6_option_space_encapsulate;
1360 fqdn6_universe.foreach = fqdn6_option_space_foreach;
1361 fqdn6_universe.decode = fqdn6_universe_decode;
1362 /* This is not a 'normal' encapsulated space, so these values are
1365 fqdn6_universe.length_size = 0;
1366 fqdn6_universe.tag_size = 0;
1367 fqdn6_universe.get_tag = NULL;
1368 fqdn6_universe.store_tag = NULL;
1369 fqdn6_universe.get_length = NULL;
1370 fqdn6_universe.store_length = NULL;
1371 fqdn6_universe.site_code_min = 0;
1372 fqdn6_universe.end = 0;
1373 fqdn6_universe.index = universe_count++;
1374 code = D6O_CLIENT_FQDN;
1375 fqdn6_universe.enc_opt = NULL;
1376 if (!option_code_hash_lookup(&fqdn6_universe.enc_opt,
1377 dhcpv6_universe.code_hash, &code, 0, MDL))
1378 log_fatal("Unable to find FQDN v6 parent option. (%s:%d).",
1380 universes[fqdn6_universe.index] = &fqdn6_universe;
1381 /* The fqdn6 space shares the same option space as the v4 space.
1382 * So there are no name or code hashes on the v6 side.
1384 fqdn6_universe.name_hash = NULL;
1385 fqdn6_universe.code_hash = NULL;
1388 /* Set up the hash of DHCPv4 universes. */
1389 universe_new_hash(&universe_hash, UNIVERSE_HASH_SIZE, MDL);
1390 universe_hash_add(universe_hash, dhcp_universe.name, 0,
1391 &dhcp_universe, MDL);
1392 universe_hash_add(universe_hash, nwip_universe.name, 0,
1393 &nwip_universe, MDL);
1394 universe_hash_add(universe_hash, fqdn_universe.name, 0,
1395 &fqdn_universe, MDL);
1396 universe_hash_add(universe_hash, vendor_class_universe.name, 0,
1397 &vendor_class_universe, MDL);
1398 universe_hash_add(universe_hash, vendor_universe.name, 0,
1399 &vendor_universe, MDL);
1400 universe_hash_add(universe_hash, isc_universe.name, 0,
1401 &isc_universe, MDL);
1403 /* Set up hashes for DHCPv6 universes. */
1404 universe_hash_add(universe_hash, dhcpv6_universe.name, 0,
1405 &dhcpv6_universe, MDL);
1406 universe_hash_add(universe_hash, vsio_universe.name, 0,
1407 &vsio_universe, MDL);
1408 universe_hash_add(universe_hash, isc6_universe.name, 0,
1409 &isc6_universe, MDL);
1410 /* This should not be necessary. Listing here just for consistency.
1411 * universe_hash_add(universe_hash, fqdn6_universe.name, 0,
1412 * &fqdn6_universe, MDL);