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