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>
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 * f - flag (true or false)
63 * A - array of whatever precedes (e.g., IA means array of IP addresses)
66 struct universe dhcp_universe;
67 struct option dhcp_options[256] = {
68 { "pad", "", &dhcp_universe, 0 },
69 { "subnet-mask", "I", &dhcp_universe, 1 },
70 { "time-offset", "l", &dhcp_universe, 2 },
71 { "routers", "IA", &dhcp_universe, 3 },
72 { "time-servers", "IA", &dhcp_universe, 4 },
73 { "ien116-name-servers", "IA", &dhcp_universe, 5 },
74 { "domain-name-servers", "IA", &dhcp_universe, 6 },
75 { "log-servers", "IA", &dhcp_universe, 7 },
76 { "cookie-servers", "IA", &dhcp_universe, 8 },
77 { "lpr-servers", "IA", &dhcp_universe, 9 },
78 { "impress-servers", "IA", &dhcp_universe, 10 },
79 { "resource-location-servers", "IA", &dhcp_universe, 11 },
80 { "host-name", "t", &dhcp_universe, 12 },
81 { "boot-size", "S", &dhcp_universe, 13 },
82 { "merit-dump", "t", &dhcp_universe, 14 },
83 { "domain-name", "t", &dhcp_universe, 15 },
84 { "swap-server", "I", &dhcp_universe, 16 },
85 { "root-path", "t", &dhcp_universe, 17 },
86 { "extensions-path", "t", &dhcp_universe, 18 },
87 { "ip-forwarding", "f", &dhcp_universe, 19 },
88 { "non-local-source-routing", "f", &dhcp_universe, 20 },
89 { "policy-filter", "IIA", &dhcp_universe, 21 },
90 { "max-dgram-reassembly", "S", &dhcp_universe, 22 },
91 { "default-ip-ttl", "B", &dhcp_universe, 23 },
92 { "path-mtu-aging-timeout", "L", &dhcp_universe, 24 },
93 { "path-mtu-plateau-table", "SA", &dhcp_universe, 25 },
94 { "interface-mtu", "S", &dhcp_universe, 26 },
95 { "all-subnets-local", "f", &dhcp_universe, 27 },
96 { "broadcast-address", "I", &dhcp_universe, 28 },
97 { "perform-mask-discovery", "f", &dhcp_universe, 29 },
98 { "mask-supplier", "f", &dhcp_universe, 30 },
99 { "router-discovery", "f", &dhcp_universe, 31 },
100 { "router-solicitation-address", "I", &dhcp_universe, 32 },
101 { "static-routes", "IIA", &dhcp_universe, 33 },
102 { "trailer-encapsulation", "f", &dhcp_universe, 34 },
103 { "arp-cache-timeout", "L", &dhcp_universe, 35 },
104 { "ieee802-3-encapsulation", "f", &dhcp_universe, 36 },
105 { "default-tcp-ttl", "B", &dhcp_universe, 37 },
106 { "tcp-keepalive-interval", "L", &dhcp_universe, 38 },
107 { "tcp-keepalive-garbage", "f", &dhcp_universe, 39 },
108 { "nis-domain", "t", &dhcp_universe, 40 },
109 { "nis-servers", "IA", &dhcp_universe, 41 },
110 { "ntp-servers", "IA", &dhcp_universe, 42 },
111 { "vendor-encapsulated-options", "X", &dhcp_universe, 43 },
112 { "netbios-name-servers", "IA", &dhcp_universe, 44 },
113 { "netbios-dd-server", "IA", &dhcp_universe, 45 },
114 { "netbios-node-type", "B", &dhcp_universe, 46 },
115 { "netbios-scope", "t", &dhcp_universe, 47 },
116 { "font-servers", "IA", &dhcp_universe, 48 },
117 { "x-display-manager", "IA", &dhcp_universe, 49 },
118 { "dhcp-requested-address", "I", &dhcp_universe, 50 },
119 { "dhcp-lease-time", "L", &dhcp_universe, 51 },
120 { "dhcp-option-overload", "B", &dhcp_universe, 52 },
121 { "dhcp-message-type", "B", &dhcp_universe, 53 },
122 { "dhcp-server-identifier", "I", &dhcp_universe, 54 },
123 { "dhcp-parameter-request-list", "BA", &dhcp_universe, 55 },
124 { "dhcp-message", "t", &dhcp_universe, 56 },
125 { "dhcp-max-message-size", "S", &dhcp_universe, 57 },
126 { "dhcp-renewal-time", "L", &dhcp_universe, 58 },
127 { "dhcp-rebinding-time", "L", &dhcp_universe, 59 },
128 { "dhcp-class-identifier", "t", &dhcp_universe, 60 },
129 { "dhcp-client-identifier", "X", &dhcp_universe, 61 },
130 { "option-62", "X", &dhcp_universe, 62 },
131 { "option-63", "X", &dhcp_universe, 63 },
132 { "nisplus-domain", "t", &dhcp_universe, 64 },
133 { "nisplus-servers", "IA", &dhcp_universe, 65 },
134 { "tftp-server-name", "t", &dhcp_universe, 66 },
135 { "bootfile-name", "t", &dhcp_universe, 67 },
136 { "mobile-ip-home-agent", "IA", &dhcp_universe, 68 },
137 { "smtp-server", "IA", &dhcp_universe, 69 },
138 { "pop-server", "IA", &dhcp_universe, 70 },
139 { "nntp-server", "IA", &dhcp_universe, 71 },
140 { "www-server", "IA", &dhcp_universe, 72 },
141 { "finger-server", "IA", &dhcp_universe, 73 },
142 { "irc-server", "IA", &dhcp_universe, 74 },
143 { "streettalk-server", "IA", &dhcp_universe, 75 },
144 { "streettalk-directory-assistance-server", "IA", &dhcp_universe, 76 },
145 { "user-class", "t", &dhcp_universe, 77 },
146 { "option-78", "X", &dhcp_universe, 78 },
147 { "option-79", "X", &dhcp_universe, 79 },
148 { "option-80", "X", &dhcp_universe, 80 },
149 { "option-81", "X", &dhcp_universe, 81 },
150 { "option-82", "X", &dhcp_universe, 82 },
151 { "option-83", "X", &dhcp_universe, 83 },
152 { "option-84", "X", &dhcp_universe, 84 },
153 { "nds-servers", "IA", &dhcp_universe, 85 },
154 { "nds-tree-name", "X", &dhcp_universe, 86 },
155 { "nds-context", "X", &dhcp_universe, 87 },
156 { "option-88", "X", &dhcp_universe, 88 },
157 { "option-89", "X", &dhcp_universe, 89 },
158 { "option-90", "X", &dhcp_universe, 90 },
159 { "option-91", "X", &dhcp_universe, 91 },
160 { "option-92", "X", &dhcp_universe, 92 },
161 { "option-93", "X", &dhcp_universe, 93 },
162 { "option-94", "X", &dhcp_universe, 94 },
163 { "option-95", "X", &dhcp_universe, 95 },
164 { "option-96", "X", &dhcp_universe, 96 },
165 { "option-97", "X", &dhcp_universe, 97 },
166 { "option-98", "X", &dhcp_universe, 98 },
167 { "option-99", "X", &dhcp_universe, 99 },
168 { "option-100", "X", &dhcp_universe, 100 },
169 { "option-101", "X", &dhcp_universe, 101 },
170 { "option-102", "X", &dhcp_universe, 102 },
171 { "option-103", "X", &dhcp_universe, 103 },
172 { "option-104", "X", &dhcp_universe, 104 },
173 { "option-105", "X", &dhcp_universe, 105 },
174 { "option-106", "X", &dhcp_universe, 106 },
175 { "option-107", "X", &dhcp_universe, 107 },
176 { "option-108", "X", &dhcp_universe, 108 },
177 { "option-109", "X", &dhcp_universe, 109 },
178 { "option-110", "X", &dhcp_universe, 110 },
179 { "option-111", "X", &dhcp_universe, 111 },
180 { "option-112", "X", &dhcp_universe, 112 },
181 { "option-113", "X", &dhcp_universe, 113 },
182 { "url", "t", &dhcp_universe, 114 },
183 { "option-115", "X", &dhcp_universe, 115 },
184 { "option-116", "X", &dhcp_universe, 116 },
185 { "option-117", "X", &dhcp_universe, 117 },
186 { "option-118", "X", &dhcp_universe, 118 },
187 { "domain-search", "t", &dhcp_universe, 119 },
188 { "option-120", "X", &dhcp_universe, 120 },
189 { "classless-routes", "BA", &dhcp_universe, 121 },
190 { "option-122", "X", &dhcp_universe, 122 },
191 { "option-123", "X", &dhcp_universe, 123 },
192 { "option-124", "X", &dhcp_universe, 124 },
193 { "option-125", "X", &dhcp_universe, 125 },
194 { "option-126", "X", &dhcp_universe, 126 },
195 { "option-127", "X", &dhcp_universe, 127 },
196 { "option-128", "X", &dhcp_universe, 128 },
197 { "option-129", "X", &dhcp_universe, 129 },
198 { "option-130", "X", &dhcp_universe, 130 },
199 { "option-131", "X", &dhcp_universe, 131 },
200 { "option-132", "X", &dhcp_universe, 132 },
201 { "option-133", "X", &dhcp_universe, 133 },
202 { "option-134", "X", &dhcp_universe, 134 },
203 { "option-135", "X", &dhcp_universe, 135 },
204 { "option-136", "X", &dhcp_universe, 136 },
205 { "option-137", "X", &dhcp_universe, 137 },
206 { "option-138", "X", &dhcp_universe, 138 },
207 { "option-139", "X", &dhcp_universe, 139 },
208 { "option-140", "X", &dhcp_universe, 140 },
209 { "option-141", "X", &dhcp_universe, 141 },
210 { "option-142", "X", &dhcp_universe, 142 },
211 { "option-143", "X", &dhcp_universe, 143 },
212 { "option-144", "X", &dhcp_universe, 144 },
213 { "option-145", "X", &dhcp_universe, 145 },
214 { "option-146", "X", &dhcp_universe, 146 },
215 { "option-147", "X", &dhcp_universe, 147 },
216 { "option-148", "X", &dhcp_universe, 148 },
217 { "option-149", "X", &dhcp_universe, 149 },
218 { "option-150", "X", &dhcp_universe, 150 },
219 { "option-151", "X", &dhcp_universe, 151 },
220 { "option-152", "X", &dhcp_universe, 152 },
221 { "option-153", "X", &dhcp_universe, 153 },
222 { "option-154", "X", &dhcp_universe, 154 },
223 { "option-155", "X", &dhcp_universe, 155 },
224 { "option-156", "X", &dhcp_universe, 156 },
225 { "option-157", "X", &dhcp_universe, 157 },
226 { "option-158", "X", &dhcp_universe, 158 },
227 { "option-159", "X", &dhcp_universe, 159 },
228 { "option-160", "X", &dhcp_universe, 160 },
229 { "option-161", "X", &dhcp_universe, 161 },
230 { "option-162", "X", &dhcp_universe, 162 },
231 { "option-163", "X", &dhcp_universe, 163 },
232 { "option-164", "X", &dhcp_universe, 164 },
233 { "option-165", "X", &dhcp_universe, 165 },
234 { "option-166", "X", &dhcp_universe, 166 },
235 { "option-167", "X", &dhcp_universe, 167 },
236 { "option-168", "X", &dhcp_universe, 168 },
237 { "option-169", "X", &dhcp_universe, 169 },
238 { "option-170", "X", &dhcp_universe, 170 },
239 { "option-171", "X", &dhcp_universe, 171 },
240 { "option-172", "X", &dhcp_universe, 172 },
241 { "option-173", "X", &dhcp_universe, 173 },
242 { "option-174", "X", &dhcp_universe, 174 },
243 { "option-175", "X", &dhcp_universe, 175 },
244 { "option-176", "X", &dhcp_universe, 176 },
245 { "option-177", "X", &dhcp_universe, 177 },
246 { "option-178", "X", &dhcp_universe, 178 },
247 { "option-179", "X", &dhcp_universe, 179 },
248 { "option-180", "X", &dhcp_universe, 180 },
249 { "option-181", "X", &dhcp_universe, 181 },
250 { "option-182", "X", &dhcp_universe, 182 },
251 { "option-183", "X", &dhcp_universe, 183 },
252 { "option-184", "X", &dhcp_universe, 184 },
253 { "option-185", "X", &dhcp_universe, 185 },
254 { "option-186", "X", &dhcp_universe, 186 },
255 { "option-187", "X", &dhcp_universe, 187 },
256 { "option-188", "X", &dhcp_universe, 188 },
257 { "option-189", "X", &dhcp_universe, 189 },
258 { "option-190", "X", &dhcp_universe, 190 },
259 { "option-191", "X", &dhcp_universe, 191 },
260 { "option-192", "X", &dhcp_universe, 192 },
261 { "option-193", "X", &dhcp_universe, 193 },
262 { "option-194", "X", &dhcp_universe, 194 },
263 { "option-195", "X", &dhcp_universe, 195 },
264 { "option-196", "X", &dhcp_universe, 196 },
265 { "option-197", "X", &dhcp_universe, 197 },
266 { "option-198", "X", &dhcp_universe, 198 },
267 { "option-199", "X", &dhcp_universe, 199 },
268 { "option-200", "X", &dhcp_universe, 200 },
269 { "option-201", "X", &dhcp_universe, 201 },
270 { "option-202", "X", &dhcp_universe, 202 },
271 { "option-203", "X", &dhcp_universe, 203 },
272 { "option-204", "X", &dhcp_universe, 204 },
273 { "option-205", "X", &dhcp_universe, 205 },
274 { "option-206", "X", &dhcp_universe, 206 },
275 { "option-207", "X", &dhcp_universe, 207 },
276 { "option-208", "X", &dhcp_universe, 208 },
277 { "option-209", "X", &dhcp_universe, 209 },
278 { "option-210", "X", &dhcp_universe, 210 },
279 { "option-211", "X", &dhcp_universe, 211 },
280 { "option-212", "X", &dhcp_universe, 212 },
281 { "option-213", "X", &dhcp_universe, 213 },
282 { "option-214", "X", &dhcp_universe, 214 },
283 { "option-215", "X", &dhcp_universe, 215 },
284 { "option-216", "X", &dhcp_universe, 216 },
285 { "option-217", "X", &dhcp_universe, 217 },
286 { "option-218", "X", &dhcp_universe, 218 },
287 { "option-219", "X", &dhcp_universe, 219 },
288 { "option-220", "X", &dhcp_universe, 220 },
289 { "option-221", "X", &dhcp_universe, 221 },
290 { "option-222", "X", &dhcp_universe, 222 },
291 { "option-223", "X", &dhcp_universe, 223 },
292 { "option-224", "X", &dhcp_universe, 224 },
293 { "option-225", "X", &dhcp_universe, 225 },
294 { "option-226", "X", &dhcp_universe, 226 },
295 { "option-227", "X", &dhcp_universe, 227 },
296 { "option-228", "X", &dhcp_universe, 228 },
297 { "option-229", "X", &dhcp_universe, 229 },
298 { "option-230", "X", &dhcp_universe, 230 },
299 { "option-231", "X", &dhcp_universe, 231 },
300 { "option-232", "X", &dhcp_universe, 232 },
301 { "option-233", "X", &dhcp_universe, 233 },
302 { "option-234", "X", &dhcp_universe, 234 },
303 { "option-235", "X", &dhcp_universe, 235 },
304 { "option-236", "X", &dhcp_universe, 236 },
305 { "option-237", "X", &dhcp_universe, 237 },
306 { "option-238", "X", &dhcp_universe, 238 },
307 { "option-239", "X", &dhcp_universe, 239 },
308 { "option-240", "X", &dhcp_universe, 240 },
309 { "option-241", "X", &dhcp_universe, 241 },
310 { "option-242", "X", &dhcp_universe, 242 },
311 { "option-243", "X", &dhcp_universe, 243 },
312 { "option-244", "X", &dhcp_universe, 244 },
313 { "option-245", "X", &dhcp_universe, 245 },
314 { "option-246", "X", &dhcp_universe, 246 },
315 { "option-247", "X", &dhcp_universe, 247 },
316 { "option-248", "X", &dhcp_universe, 248 },
317 { "option-249", "X", &dhcp_universe, 249 },
318 { "option-250", "X", &dhcp_universe, 250 },
319 { "option-251", "X", &dhcp_universe, 251 },
320 { "option-252", "X", &dhcp_universe, 252 },
321 { "option-253", "X", &dhcp_universe, 253 },
322 { "option-254", "X", &dhcp_universe, 254 },
323 { "option-end", "e", &dhcp_universe, 255 },
327 * Default dhcp option priority list (this is ad hoc and should not be
328 * mistaken for a carefully crafted and optimized list).
330 unsigned char dhcp_option_default_priority_list[] = {
331 DHO_DHCP_REQUESTED_ADDRESS,
332 DHO_DHCP_OPTION_OVERLOAD,
333 DHO_DHCP_MAX_MESSAGE_SIZE,
334 DHO_DHCP_RENEWAL_TIME,
335 DHO_DHCP_REBINDING_TIME,
336 DHO_DHCP_CLASS_IDENTIFIER,
337 DHO_DHCP_CLIENT_IDENTIFIER,
340 DHO_CLASSLESS_ROUTES,
344 DHO_DOMAIN_NAME_SERVERS,
350 DHO_RESOURCE_LOCATION_SERVERS,
359 DHO_NON_LOCAL_SOURCE_ROUTING,
361 DHO_MAX_DGRAM_REASSEMBLY,
363 DHO_PATH_MTU_AGING_TIMEOUT,
364 DHO_PATH_MTU_PLATEAU_TABLE,
366 DHO_ALL_SUBNETS_LOCAL,
367 DHO_BROADCAST_ADDRESS,
368 DHO_PERFORM_MASK_DISCOVERY,
370 DHO_ROUTER_DISCOVERY,
371 DHO_ROUTER_SOLICITATION_ADDRESS,
373 DHO_TRAILER_ENCAPSULATION,
374 DHO_ARP_CACHE_TIMEOUT,
375 DHO_IEEE802_3_ENCAPSULATION,
377 DHO_TCP_KEEPALIVE_INTERVAL,
378 DHO_TCP_KEEPALIVE_GARBAGE,
382 DHO_VENDOR_ENCAPSULATED_OPTIONS,
383 DHO_NETBIOS_NAME_SERVERS,
384 DHO_NETBIOS_DD_SERVER,
385 DHO_NETBIOS_NODE_TYPE,
388 DHO_X_DISPLAY_MANAGER,
389 DHO_DHCP_PARAMETER_REQUEST_LIST,
392 DHO_TFTP_SERVER_NAME,
394 DHO_MOBILE_IP_HOME_AGENT,
401 DHO_STREETTALK_SERVER,
402 DHO_STREETTALK_DA_SERVER,
403 DHO_DHCP_USER_CLASS_ID,
407 /* Presently-undefined options... */
408 62, 63, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
409 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
410 106, 107, 108, 109, 110, 111, 112, 113, 115, 116, 117,
411 118, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130,
412 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
413 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
414 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166,
415 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178,
416 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
417 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202,
418 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
419 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226,
420 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238,
421 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250,
425 int sizeof_dhcp_option_default_priority_list =
426 sizeof(dhcp_option_default_priority_list);
428 struct hash_table universe_hash;
431 initialize_universes(void)
435 dhcp_universe.name = "dhcp";
436 dhcp_universe.hash = new_hash();
437 if (!dhcp_universe.hash)
438 error("Can't allocate dhcp option hash table.");
439 for (i = 0; i < 256; i++) {
440 dhcp_universe.options[i] = &dhcp_options[i];
441 add_hash(dhcp_universe.hash,
442 (const unsigned char *)dhcp_options[i].name, 0,
443 (unsigned char *)&dhcp_options[i]);
445 universe_hash.hash_count = DEFAULT_HASH_SIZE;
446 add_hash(&universe_hash,
447 (const unsigned char *)dhcp_universe.name, 0,
448 (unsigned char *)&dhcp_universe);