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