1 /* $OpenBSD: tables.c,v 1.4 2004/05/04 20:28:40 deraadt Exp $ */
3 /* Tables of information... */
6 * SPDX-License-Identifier: BSD-3-Clause
8 * Copyright (c) 1995, 1996 The Internet Software Consortium.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of The Internet Software Consortium nor the names
21 * of its contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
25 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
26 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
29 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
32 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
33 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
34 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
35 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * This software has been written for the Internet Software Consortium
39 * by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
40 * Enterprises. To learn more about the Internet Software Consortium,
41 * see ``http://www.vix.com/isc''. To learn more about Vixie
42 * Enterprises, see ``http://www.vix.com''.
45 #include <sys/cdefs.h>
46 __FBSDID("$FreeBSD$");
51 * DHCP Option names, formats and codes, from RFC1533.
57 * l - 32-bit signed integer
58 * L - 32-bit unsigned integer
59 * s - 16-bit signed integer
60 * S - 16-bit unsigned integer
61 * b - 8-bit signed integer
62 * B - 8-bit unsigned integer
64 * f - flag (true or false)
65 * A - array of whatever precedes (e.g., IA means array of IP addresses)
68 struct universe dhcp_universe;
69 struct option dhcp_options[256] = {
70 { "pad", "", &dhcp_universe, 0 },
71 { "subnet-mask", "I", &dhcp_universe, 1 },
72 { "time-offset", "l", &dhcp_universe, 2 },
73 { "routers", "IA", &dhcp_universe, 3 },
74 { "time-servers", "IA", &dhcp_universe, 4 },
75 { "ien116-name-servers", "IA", &dhcp_universe, 5 },
76 { "domain-name-servers", "IA", &dhcp_universe, 6 },
77 { "log-servers", "IA", &dhcp_universe, 7 },
78 { "cookie-servers", "IA", &dhcp_universe, 8 },
79 { "lpr-servers", "IA", &dhcp_universe, 9 },
80 { "impress-servers", "IA", &dhcp_universe, 10 },
81 { "resource-location-servers", "IA", &dhcp_universe, 11 },
82 { "host-name", "t", &dhcp_universe, 12 },
83 { "boot-size", "S", &dhcp_universe, 13 },
84 { "merit-dump", "t", &dhcp_universe, 14 },
85 { "domain-name", "t", &dhcp_universe, 15 },
86 { "swap-server", "I", &dhcp_universe, 16 },
87 { "root-path", "t", &dhcp_universe, 17 },
88 { "extensions-path", "t", &dhcp_universe, 18 },
89 { "ip-forwarding", "f", &dhcp_universe, 19 },
90 { "non-local-source-routing", "f", &dhcp_universe, 20 },
91 { "policy-filter", "IIA", &dhcp_universe, 21 },
92 { "max-dgram-reassembly", "S", &dhcp_universe, 22 },
93 { "default-ip-ttl", "B", &dhcp_universe, 23 },
94 { "path-mtu-aging-timeout", "L", &dhcp_universe, 24 },
95 { "path-mtu-plateau-table", "SA", &dhcp_universe, 25 },
96 { "interface-mtu", "S", &dhcp_universe, 26 },
97 { "all-subnets-local", "f", &dhcp_universe, 27 },
98 { "broadcast-address", "I", &dhcp_universe, 28 },
99 { "perform-mask-discovery", "f", &dhcp_universe, 29 },
100 { "mask-supplier", "f", &dhcp_universe, 30 },
101 { "router-discovery", "f", &dhcp_universe, 31 },
102 { "router-solicitation-address", "I", &dhcp_universe, 32 },
103 { "static-routes", "IIA", &dhcp_universe, 33 },
104 { "trailer-encapsulation", "f", &dhcp_universe, 34 },
105 { "arp-cache-timeout", "L", &dhcp_universe, 35 },
106 { "ieee802-3-encapsulation", "f", &dhcp_universe, 36 },
107 { "default-tcp-ttl", "B", &dhcp_universe, 37 },
108 { "tcp-keepalive-interval", "L", &dhcp_universe, 38 },
109 { "tcp-keepalive-garbage", "f", &dhcp_universe, 39 },
110 { "nis-domain", "t", &dhcp_universe, 40 },
111 { "nis-servers", "IA", &dhcp_universe, 41 },
112 { "ntp-servers", "IA", &dhcp_universe, 42 },
113 { "vendor-encapsulated-options", "X", &dhcp_universe, 43 },
114 { "netbios-name-servers", "IA", &dhcp_universe, 44 },
115 { "netbios-dd-server", "IA", &dhcp_universe, 45 },
116 { "netbios-node-type", "B", &dhcp_universe, 46 },
117 { "netbios-scope", "t", &dhcp_universe, 47 },
118 { "font-servers", "IA", &dhcp_universe, 48 },
119 { "x-display-manager", "IA", &dhcp_universe, 49 },
120 { "dhcp-requested-address", "I", &dhcp_universe, 50 },
121 { "dhcp-lease-time", "L", &dhcp_universe, 51 },
122 { "dhcp-option-overload", "B", &dhcp_universe, 52 },
123 { "dhcp-message-type", "B", &dhcp_universe, 53 },
124 { "dhcp-server-identifier", "I", &dhcp_universe, 54 },
125 { "dhcp-parameter-request-list", "BA", &dhcp_universe, 55 },
126 { "dhcp-message", "t", &dhcp_universe, 56 },
127 { "dhcp-max-message-size", "S", &dhcp_universe, 57 },
128 { "dhcp-renewal-time", "L", &dhcp_universe, 58 },
129 { "dhcp-rebinding-time", "L", &dhcp_universe, 59 },
130 { "dhcp-class-identifier", "t", &dhcp_universe, 60 },
131 { "dhcp-client-identifier", "X", &dhcp_universe, 61 },
132 { "option-62", "X", &dhcp_universe, 62 },
133 { "option-63", "X", &dhcp_universe, 63 },
134 { "nisplus-domain", "t", &dhcp_universe, 64 },
135 { "nisplus-servers", "IA", &dhcp_universe, 65 },
136 { "tftp-server-name", "t", &dhcp_universe, 66 },
137 { "bootfile-name", "t", &dhcp_universe, 67 },
138 { "mobile-ip-home-agent", "IA", &dhcp_universe, 68 },
139 { "smtp-server", "IA", &dhcp_universe, 69 },
140 { "pop-server", "IA", &dhcp_universe, 70 },
141 { "nntp-server", "IA", &dhcp_universe, 71 },
142 { "www-server", "IA", &dhcp_universe, 72 },
143 { "finger-server", "IA", &dhcp_universe, 73 },
144 { "irc-server", "IA", &dhcp_universe, 74 },
145 { "streettalk-server", "IA", &dhcp_universe, 75 },
146 { "streettalk-directory-assistance-server", "IA", &dhcp_universe, 76 },
147 { "user-class", "t", &dhcp_universe, 77 },
148 { "option-78", "X", &dhcp_universe, 78 },
149 { "option-79", "X", &dhcp_universe, 79 },
150 { "option-80", "X", &dhcp_universe, 80 },
151 { "option-81", "X", &dhcp_universe, 81 },
152 { "option-82", "X", &dhcp_universe, 82 },
153 { "option-83", "X", &dhcp_universe, 83 },
154 { "option-84", "X", &dhcp_universe, 84 },
155 { "nds-servers", "IA", &dhcp_universe, 85 },
156 { "nds-tree-name", "X", &dhcp_universe, 86 },
157 { "nds-context", "X", &dhcp_universe, 87 },
158 { "option-88", "X", &dhcp_universe, 88 },
159 { "option-89", "X", &dhcp_universe, 89 },
160 { "option-90", "X", &dhcp_universe, 90 },
161 { "option-91", "X", &dhcp_universe, 91 },
162 { "option-92", "X", &dhcp_universe, 92 },
163 { "option-93", "X", &dhcp_universe, 93 },
164 { "option-94", "X", &dhcp_universe, 94 },
165 { "option-95", "X", &dhcp_universe, 95 },
166 { "option-96", "X", &dhcp_universe, 96 },
167 { "option-97", "X", &dhcp_universe, 97 },
168 { "option-98", "X", &dhcp_universe, 98 },
169 { "option-99", "X", &dhcp_universe, 99 },
170 { "option-100", "X", &dhcp_universe, 100 },
171 { "option-101", "X", &dhcp_universe, 101 },
172 { "option-102", "X", &dhcp_universe, 102 },
173 { "option-103", "X", &dhcp_universe, 103 },
174 { "option-104", "X", &dhcp_universe, 104 },
175 { "option-105", "X", &dhcp_universe, 105 },
176 { "option-106", "X", &dhcp_universe, 106 },
177 { "option-107", "X", &dhcp_universe, 107 },
178 { "option-108", "X", &dhcp_universe, 108 },
179 { "option-109", "X", &dhcp_universe, 109 },
180 { "option-110", "X", &dhcp_universe, 110 },
181 { "option-111", "X", &dhcp_universe, 111 },
182 { "option-112", "X", &dhcp_universe, 112 },
183 { "option-113", "X", &dhcp_universe, 113 },
184 { "option-114", "X", &dhcp_universe, 114 },
185 { "option-115", "X", &dhcp_universe, 115 },
186 { "option-116", "X", &dhcp_universe, 116 },
187 { "option-117", "X", &dhcp_universe, 117 },
188 { "option-118", "X", &dhcp_universe, 118 },
189 { "domain-search", "t", &dhcp_universe, 119 },
190 { "option-120", "X", &dhcp_universe, 120 },
191 { "classless-routes", "BA", &dhcp_universe, 121 },
192 { "option-122", "X", &dhcp_universe, 122 },
193 { "option-123", "X", &dhcp_universe, 123 },
194 { "option-124", "X", &dhcp_universe, 124 },
195 { "option-125", "X", &dhcp_universe, 125 },
196 { "option-126", "X", &dhcp_universe, 126 },
197 { "option-127", "X", &dhcp_universe, 127 },
198 { "option-128", "X", &dhcp_universe, 128 },
199 { "option-129", "X", &dhcp_universe, 129 },
200 { "option-130", "X", &dhcp_universe, 130 },
201 { "option-131", "X", &dhcp_universe, 131 },
202 { "option-132", "X", &dhcp_universe, 132 },
203 { "option-133", "X", &dhcp_universe, 133 },
204 { "option-134", "X", &dhcp_universe, 134 },
205 { "option-135", "X", &dhcp_universe, 135 },
206 { "option-136", "X", &dhcp_universe, 136 },
207 { "option-137", "X", &dhcp_universe, 137 },
208 { "option-138", "X", &dhcp_universe, 138 },
209 { "option-139", "X", &dhcp_universe, 139 },
210 { "option-140", "X", &dhcp_universe, 140 },
211 { "option-141", "X", &dhcp_universe, 141 },
212 { "option-142", "X", &dhcp_universe, 142 },
213 { "option-143", "X", &dhcp_universe, 143 },
214 { "option-144", "X", &dhcp_universe, 144 },
215 { "option-145", "X", &dhcp_universe, 145 },
216 { "option-146", "X", &dhcp_universe, 146 },
217 { "option-147", "X", &dhcp_universe, 147 },
218 { "option-148", "X", &dhcp_universe, 148 },
219 { "option-149", "X", &dhcp_universe, 149 },
220 { "option-150", "X", &dhcp_universe, 150 },
221 { "option-151", "X", &dhcp_universe, 151 },
222 { "option-152", "X", &dhcp_universe, 152 },
223 { "option-153", "X", &dhcp_universe, 153 },
224 { "option-154", "X", &dhcp_universe, 154 },
225 { "option-155", "X", &dhcp_universe, 155 },
226 { "option-156", "X", &dhcp_universe, 156 },
227 { "option-157", "X", &dhcp_universe, 157 },
228 { "option-158", "X", &dhcp_universe, 158 },
229 { "option-159", "X", &dhcp_universe, 159 },
230 { "option-160", "X", &dhcp_universe, 160 },
231 { "option-161", "X", &dhcp_universe, 161 },
232 { "option-162", "X", &dhcp_universe, 162 },
233 { "option-163", "X", &dhcp_universe, 163 },
234 { "option-164", "X", &dhcp_universe, 164 },
235 { "option-165", "X", &dhcp_universe, 165 },
236 { "option-166", "X", &dhcp_universe, 166 },
237 { "option-167", "X", &dhcp_universe, 167 },
238 { "option-168", "X", &dhcp_universe, 168 },
239 { "option-169", "X", &dhcp_universe, 169 },
240 { "option-170", "X", &dhcp_universe, 170 },
241 { "option-171", "X", &dhcp_universe, 171 },
242 { "option-172", "X", &dhcp_universe, 172 },
243 { "option-173", "X", &dhcp_universe, 173 },
244 { "option-174", "X", &dhcp_universe, 174 },
245 { "option-175", "X", &dhcp_universe, 175 },
246 { "option-176", "X", &dhcp_universe, 176 },
247 { "option-177", "X", &dhcp_universe, 177 },
248 { "option-178", "X", &dhcp_universe, 178 },
249 { "option-179", "X", &dhcp_universe, 179 },
250 { "option-180", "X", &dhcp_universe, 180 },
251 { "option-181", "X", &dhcp_universe, 181 },
252 { "option-182", "X", &dhcp_universe, 182 },
253 { "option-183", "X", &dhcp_universe, 183 },
254 { "option-184", "X", &dhcp_universe, 184 },
255 { "option-185", "X", &dhcp_universe, 185 },
256 { "option-186", "X", &dhcp_universe, 186 },
257 { "option-187", "X", &dhcp_universe, 187 },
258 { "option-188", "X", &dhcp_universe, 188 },
259 { "option-189", "X", &dhcp_universe, 189 },
260 { "option-190", "X", &dhcp_universe, 190 },
261 { "option-191", "X", &dhcp_universe, 191 },
262 { "option-192", "X", &dhcp_universe, 192 },
263 { "option-193", "X", &dhcp_universe, 193 },
264 { "option-194", "X", &dhcp_universe, 194 },
265 { "option-195", "X", &dhcp_universe, 195 },
266 { "option-196", "X", &dhcp_universe, 196 },
267 { "option-197", "X", &dhcp_universe, 197 },
268 { "option-198", "X", &dhcp_universe, 198 },
269 { "option-199", "X", &dhcp_universe, 199 },
270 { "option-200", "X", &dhcp_universe, 200 },
271 { "option-201", "X", &dhcp_universe, 201 },
272 { "option-202", "X", &dhcp_universe, 202 },
273 { "option-203", "X", &dhcp_universe, 203 },
274 { "option-204", "X", &dhcp_universe, 204 },
275 { "option-205", "X", &dhcp_universe, 205 },
276 { "option-206", "X", &dhcp_universe, 206 },
277 { "option-207", "X", &dhcp_universe, 207 },
278 { "option-208", "X", &dhcp_universe, 208 },
279 { "option-209", "X", &dhcp_universe, 209 },
280 { "option-210", "X", &dhcp_universe, 210 },
281 { "option-211", "X", &dhcp_universe, 211 },
282 { "option-212", "X", &dhcp_universe, 212 },
283 { "option-213", "X", &dhcp_universe, 213 },
284 { "option-214", "X", &dhcp_universe, 214 },
285 { "option-215", "X", &dhcp_universe, 215 },
286 { "option-216", "X", &dhcp_universe, 216 },
287 { "option-217", "X", &dhcp_universe, 217 },
288 { "option-218", "X", &dhcp_universe, 218 },
289 { "option-219", "X", &dhcp_universe, 219 },
290 { "option-220", "X", &dhcp_universe, 220 },
291 { "option-221", "X", &dhcp_universe, 221 },
292 { "option-222", "X", &dhcp_universe, 222 },
293 { "option-223", "X", &dhcp_universe, 223 },
294 { "option-224", "X", &dhcp_universe, 224 },
295 { "option-225", "X", &dhcp_universe, 225 },
296 { "option-226", "X", &dhcp_universe, 226 },
297 { "option-227", "X", &dhcp_universe, 227 },
298 { "option-228", "X", &dhcp_universe, 228 },
299 { "option-229", "X", &dhcp_universe, 229 },
300 { "option-230", "X", &dhcp_universe, 230 },
301 { "option-231", "X", &dhcp_universe, 231 },
302 { "option-232", "X", &dhcp_universe, 232 },
303 { "option-233", "X", &dhcp_universe, 233 },
304 { "option-234", "X", &dhcp_universe, 234 },
305 { "option-235", "X", &dhcp_universe, 235 },
306 { "option-236", "X", &dhcp_universe, 236 },
307 { "option-237", "X", &dhcp_universe, 237 },
308 { "option-238", "X", &dhcp_universe, 238 },
309 { "option-239", "X", &dhcp_universe, 239 },
310 { "option-240", "X", &dhcp_universe, 240 },
311 { "option-241", "X", &dhcp_universe, 241 },
312 { "option-242", "X", &dhcp_universe, 242 },
313 { "option-243", "X", &dhcp_universe, 243 },
314 { "option-244", "X", &dhcp_universe, 244 },
315 { "option-245", "X", &dhcp_universe, 245 },
316 { "option-246", "X", &dhcp_universe, 246 },
317 { "option-247", "X", &dhcp_universe, 247 },
318 { "option-248", "X", &dhcp_universe, 248 },
319 { "option-249", "X", &dhcp_universe, 249 },
320 { "option-250", "X", &dhcp_universe, 250 },
321 { "option-251", "X", &dhcp_universe, 251 },
322 { "option-252", "X", &dhcp_universe, 252 },
323 { "option-253", "X", &dhcp_universe, 253 },
324 { "option-254", "X", &dhcp_universe, 254 },
325 { "option-end", "e", &dhcp_universe, 255 },
329 * Default dhcp option priority list (this is ad hoc and should not be
330 * mistaken for a carefully crafted and optimized list).
332 unsigned char dhcp_option_default_priority_list[] = {
333 DHO_DHCP_REQUESTED_ADDRESS,
334 DHO_DHCP_OPTION_OVERLOAD,
335 DHO_DHCP_MAX_MESSAGE_SIZE,
336 DHO_DHCP_RENEWAL_TIME,
337 DHO_DHCP_REBINDING_TIME,
338 DHO_DHCP_CLASS_IDENTIFIER,
339 DHO_DHCP_CLIENT_IDENTIFIER,
342 DHO_CLASSLESS_ROUTES,
346 DHO_DOMAIN_NAME_SERVERS,
352 DHO_RESOURCE_LOCATION_SERVERS,
361 DHO_NON_LOCAL_SOURCE_ROUTING,
363 DHO_MAX_DGRAM_REASSEMBLY,
365 DHO_PATH_MTU_AGING_TIMEOUT,
366 DHO_PATH_MTU_PLATEAU_TABLE,
368 DHO_ALL_SUBNETS_LOCAL,
369 DHO_BROADCAST_ADDRESS,
370 DHO_PERFORM_MASK_DISCOVERY,
372 DHO_ROUTER_DISCOVERY,
373 DHO_ROUTER_SOLICITATION_ADDRESS,
375 DHO_TRAILER_ENCAPSULATION,
376 DHO_ARP_CACHE_TIMEOUT,
377 DHO_IEEE802_3_ENCAPSULATION,
379 DHO_TCP_KEEPALIVE_INTERVAL,
380 DHO_TCP_KEEPALIVE_GARBAGE,
384 DHO_VENDOR_ENCAPSULATED_OPTIONS,
385 DHO_NETBIOS_NAME_SERVERS,
386 DHO_NETBIOS_DD_SERVER,
387 DHO_NETBIOS_NODE_TYPE,
390 DHO_X_DISPLAY_MANAGER,
391 DHO_DHCP_PARAMETER_REQUEST_LIST,
394 DHO_TFTP_SERVER_NAME,
396 DHO_MOBILE_IP_HOME_AGENT,
403 DHO_STREETTALK_SERVER,
404 DHO_STREETTALK_DA_SERVER,
405 DHO_DHCP_USER_CLASS_ID,
408 /* Presently-undefined options... */
409 62, 63, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
410 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
411 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
412 118, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130,
413 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
414 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
415 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166,
416 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178,
417 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
418 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202,
419 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
420 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226,
421 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238,
422 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250,
426 int sizeof_dhcp_option_default_priority_list =
427 sizeof(dhcp_option_default_priority_list);
429 struct hash_table universe_hash;
432 initialize_universes(void)
436 dhcp_universe.name = "dhcp";
437 dhcp_universe.hash = new_hash();
438 if (!dhcp_universe.hash)
439 error("Can't allocate dhcp option hash table.");
440 for (i = 0; i < 256; i++) {
441 dhcp_universe.options[i] = &dhcp_options[i];
442 add_hash(dhcp_universe.hash,
443 (const unsigned char *)dhcp_options[i].name, 0,
444 (unsigned char *)&dhcp_options[i]);
446 universe_hash.hash_count = DEFAULT_HASH_SIZE;
447 add_hash(&universe_hash,
448 (const unsigned char *)dhcp_universe.name, 0,
449 (unsigned char *)&dhcp_universe);