]>
Commit | Line | Data |
---|---|---|
5020567a TL |
1 | /* stables.c |
2 | ||
3 | Tables of information only used by server... */ | |
4 | ||
5 | /* | |
4d2eaafb | 6 | * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") |
98311e4b | 7 | * Copyright (c) 1995-2003 by Internet Software Consortium |
5020567a | 8 | * |
98311e4b DH |
9 | * Permission to use, copy, modify, and distribute this software for any |
10 | * purpose with or without fee is hereby granted, provided that the above | |
11 | * copyright notice and this permission notice appear in all copies. | |
5020567a | 12 | * |
98311e4b DH |
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. | |
5020567a | 20 | * |
98311e4b DH |
21 | * Internet Systems Consortium, Inc. |
22 | * 950 Charter Street | |
23 | * Redwood City, CA 94063 | |
24 | * <info@isc.org> | |
25 | * http://www.isc.org/ | |
49733f31 | 26 | * |
98311e4b | 27 | * This software has been written for Internet Systems Consortium |
49733f31 | 28 | * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc. |
98311e4b | 29 | * To learn more about Internet Systems Consortium, see |
49733f31 TL |
30 | * ``http://www.isc.org/''. To learn more about Vixie Enterprises, |
31 | * see ``http://www.vix.com''. To learn more about Nominum, Inc., see | |
32 | * ``http://www.nominum.com''. | |
5020567a TL |
33 | */ |
34 | ||
5020567a | 35 | #include "dhcpd.h" |
3af71c19 | 36 | #include <syslog.h> |
5020567a TL |
37 | |
38 | #if defined (FAILOVER_PROTOCOL) | |
f64d028b TL |
39 | |
40 | /* This is used to indicate some kind of failure when generating a | |
41 | failover option. */ | |
42 | failover_option_t null_failover_option = { 0, 0 }; | |
3d8b4d91 | 43 | failover_option_t skip_failover_option = { 0, 0 }; |
f64d028b TL |
44 | |
45 | /* Information about failover options, for printing, encoding | |
46 | and decoding. */ | |
d9eefc5d | 47 | struct failover_option_info ft_options [] = |
5020567a | 48 | { |
d9eefc5d | 49 | { 0, "unused", FT_UNDEF, 0, 0, 0 }, |
a55ccdd0 DH |
50 | { FTO_ADDRESSES_TRANSFERRED, "addresses-transferred", FT_UINT32, 1, |
51 | FM_OFFSET(addresses_transferred), FTB_ADDRESSES_TRANSFERRED }, | |
52 | { FTO_ASSIGNED_IP_ADDRESS, "assigned-IP-address", FT_IPADDR, 1, | |
53 | FM_OFFSET(assigned_addr), FTB_ASSIGNED_IP_ADDRESS }, | |
54 | { FTO_BINDING_STATUS, "binding-status", FT_UINT8, 1, | |
55 | FM_OFFSET(binding_status), FTB_BINDING_STATUS }, | |
56 | { FTO_CLIENT_IDENTIFIER, "client-identifier", FT_BYTES, 0, | |
57 | FM_OFFSET(client_identifier), FTB_CLIENT_IDENTIFIER }, | |
58 | { FTO_CHADDR, "client-hardware-address", FT_BYTES, 0, | |
59 | FM_OFFSET(chaddr), FTB_CHADDR }, | |
60 | { FTO_CLTT, "client-last-transaction-time", FT_UINT32, 1, | |
61 | FM_OFFSET(cltt), FTB_CLTT }, | |
62 | { FTO_REPLY_OPTIONS, "client-reply-options", FT_BYTES, 0, | |
63 | FM_OFFSET(reply_options), FTB_REPLY_OPTIONS }, | |
64 | { FTO_REQUEST_OPTIONS, "client-request-options", FT_BYTES, 0, | |
65 | FM_OFFSET(request_options), FTB_REQUEST_OPTIONS }, | |
66 | { FTO_DDNS, "DDNS", FT_DDNS, 1, FM_OFFSET(ddns), FTB_DDNS }, | |
67 | { FTO_DELAYED_SERVICE, "delayed-service", FT_UINT8, 1, | |
68 | FM_OFFSET(delayed_service), FTB_DELAYED_SERVICE }, | |
69 | { FTO_HBA, "hash-bucket-assignment", FT_BYTES, 0, | |
70 | FM_OFFSET(hba), FTB_HBA }, | |
71 | { FTO_IP_FLAGS, "IP-flags", FT_UINT16, 1, | |
72 | FM_OFFSET(ip_flags), FTB_IP_FLAGS }, | |
73 | { FTO_LEASE_EXPIRY, "lease-expiration-time", FT_UINT32, 1, | |
74 | FM_OFFSET(expiry), FTB_LEASE_EXPIRY }, | |
75 | { FTO_MAX_UNACKED, "max-unacked-bndupd", FT_UINT32, 1, | |
76 | FM_OFFSET(max_unacked), FTB_MAX_UNACKED }, | |
77 | { FTO_MCLT, "MCLT", FT_UINT32, 1, FM_OFFSET(mclt), FTB_MCLT }, | |
78 | { FTO_MESSAGE, "message", FT_TEXT, 0, | |
79 | FM_OFFSET(message), FTB_MESSAGE }, | |
80 | { FTO_MESSAGE_DIGEST, "message-digest", FT_BYTES, 0, | |
81 | FM_OFFSET(message_digest), FTB_MESSAGE_DIGEST }, | |
82 | { FTO_POTENTIAL_EXPIRY, "potential-expiration-time", FT_UINT32, 1, | |
83 | FM_OFFSET(potential_expiry), FTB_POTENTIAL_EXPIRY }, | |
84 | { FTO_RECEIVE_TIMER, "receive-timer", FT_UINT32, 1, | |
85 | FM_OFFSET(receive_timer), FTB_RECEIVE_TIMER }, | |
86 | { FTO_PROTOCOL_VERSION, "protocol-version", FT_UINT8, 1, | |
87 | FM_OFFSET(protocol_version), FTB_PROTOCOL_VERSION }, | |
88 | { FTO_REJECT_REASON, "reject-reason", FT_UINT8, 1, | |
89 | FM_OFFSET(reject_reason), FTB_REJECT_REASON }, | |
90 | { FTO_RELATIONSHIP_NAME, "relationship-name", FT_BYTES, 0, | |
91 | FM_OFFSET(relationship_name), FTB_RELATIONSHIP_NAME }, | |
92 | { FTO_SERVER_FLAGS, "server-flags", FT_UINT8, 1, | |
93 | FM_OFFSET(server_flags), FTB_SERVER_FLAGS }, | |
94 | { FTO_SERVER_STATE, "server-state", FT_UINT8, 1, | |
95 | FM_OFFSET(server_state), FTB_SERVER_STATE }, | |
96 | { FTO_STOS, "start-time-of-state", FT_UINT32, 1, | |
97 | FM_OFFSET(stos), FTB_STOS }, | |
98 | { FTO_TLS_REPLY, "TLS-reply", FT_UINT8, 1, | |
99 | FM_OFFSET(tls_reply), FTB_TLS_REPLY }, | |
100 | { FTO_TLS_REQUEST, "TLS-request", FT_UINT8, 1, | |
101 | FM_OFFSET(tls_request), FTB_TLS_REQUEST }, | |
102 | { FTO_VENDOR_CLASS, "vendor-class-identifier", FT_BYTES, 0, | |
103 | FM_OFFSET(vendor_class), FTB_VENDOR_CLASS }, | |
104 | { FTO_VENDOR_OPTIONS, "vendor-specific-options", FT_BYTES, 0, | |
105 | FM_OFFSET(vendor_options), FTB_VENDOR_OPTIONS } | |
5020567a TL |
106 | }; |
107 | ||
108 | /* These are really options that make sense for a particular request - if | |
109 | some other option comes in, we're not going to use it, so we can just | |
110 | discard it. Note that the message-digest option is allowed for all | |
111 | message types, but is not saved - it's just used to validate the message | |
112 | and then discarded - so it's not mentioned here. */ | |
113 | ||
114 | u_int32_t fto_allowed [] = { | |
115 | 0, /* 0 unused */ | |
116 | 0, /* 1 POOLREQ */ | |
117 | FTB_ADDRESSES_TRANSFERRED, /* 2 POOLRESP */ | |
118 | (FTB_ASSIGNED_IP_ADDRESS | FTB_BINDING_STATUS | FTB_CLIENT_IDENTIFIER | | |
a55ccdd0 DH |
119 | FTB_CHADDR | FTB_DDNS | FTB_IP_FLAGS | FTB_LEASE_EXPIRY | |
120 | FTB_POTENTIAL_EXPIRY | FTB_STOS | FTB_CLTT | FTB_REQUEST_OPTIONS | | |
121 | FTB_REPLY_OPTIONS), /* 3 BNDUPD */ | |
5020567a | 122 | (FTB_ASSIGNED_IP_ADDRESS | FTB_BINDING_STATUS | FTB_CLIENT_IDENTIFIER | |
a55ccdd0 DH |
123 | FTB_CHADDR | FTB_DDNS | FTB_IP_FLAGS | FTB_LEASE_EXPIRY | |
124 | FTB_POTENTIAL_EXPIRY | FTB_STOS | FTB_CLTT | FTB_REQUEST_OPTIONS | | |
125 | FTB_REPLY_OPTIONS | FTB_REJECT_REASON | FTB_MESSAGE), /* 4 BNDACK */ | |
126 | (FTB_RELATIONSHIP_NAME | FTB_MAX_UNACKED | FTB_RECEIVE_TIMER | | |
5020567a TL |
127 | FTB_VENDOR_CLASS | FTB_PROTOCOL_VERSION | FTB_TLS_REQUEST | |
128 | FTB_MCLT | FTB_HBA), /* 5 CONNECT */ | |
a55ccdd0 | 129 | (FTB_RELATIONSHIP_NAME | FTB_MAX_UNACKED | FTB_RECEIVE_TIMER | |
5020567a TL |
130 | FTB_VENDOR_CLASS | FTB_PROTOCOL_VERSION | FTB_TLS_REPLY | |
131 | FTB_REJECT_REASON | FTB_MESSAGE), /* CONNECTACK */ | |
a55ccdd0 | 132 | 0, /* 7 UPDREQALL */ |
3505ef68 | 133 | 0, /* 8 UPDDONE */ |
a55ccdd0 | 134 | 0, /* 9 UPDREQ */ |
f64d028b | 135 | (FTB_SERVER_STATE | FTB_SERVER_FLAGS | FTB_STOS), /* 10 STATE */ |
5020567a TL |
136 | 0, /* 11 CONTACT */ |
137 | (FTB_REJECT_REASON | FTB_MESSAGE) /* 12 DISCONNECT */ | |
138 | }; | |
139 | ||
f64d028b | 140 | /* Sizes of the various types. */ |
5020567a TL |
141 | int ft_sizes [] = { |
142 | 1, /* FT_UINT8 */ | |
143 | 4, /* FT_IPADDR */ | |
144 | 4, /* FT_UINT32 */ | |
145 | 1, /* FT_BYTES */ | |
f64d028b | 146 | 1, /* FT_TEXT_OR_BYTES */ |
5020567a | 147 | 0, /* FT_DDNS */ |
f64d028b | 148 | 0, /* FT_DDNS1 */ |
5020567a TL |
149 | 2, /* FT_UINT16 */ |
150 | 1, /* FT_TEXT */ | |
151 | 0, /* FT_UNDEF */ | |
152 | 0, /* FT_DIGEST */ | |
153 | }; | |
d9eefc5d | 154 | |
f64d028b TL |
155 | /* Names of the various failover link states. */ |
156 | const char *dhcp_flink_state_names [] = { | |
d9eefc5d TL |
157 | "invalid state 0", |
158 | "startup", | |
159 | "message length wait", | |
160 | "message wait", | |
161 | "disconnected" | |
162 | }; | |
5020567a TL |
163 | #endif /* FAILOVER_PROTOCOL */ |
164 | ||
007e3ee4 TL |
165 | /* Failover binding state names. These are used even if there is no |
166 | failover protocol support. */ | |
167 | const char *binding_state_names [] = { | |
168 | "free", "active", "expired", "released", "abandoned", | |
a55ccdd0 | 169 | "reset", "backup" }; |
007e3ee4 | 170 | |
5020567a | 171 | struct universe agent_universe; |
f7fdb216 DH |
172 | static struct option agent_options[] = { |
173 | { "circuit-id", "X", &agent_universe, 1, 1 }, | |
174 | { "remote-id", "X", &agent_universe, 2, 1 }, | |
175 | { "agent-id", "I", &agent_universe, 3, 1 }, | |
176 | { "DOCSIS-device-class", "L", &agent_universe, 4, 1 }, | |
334bf491 | 177 | { "link-selection", "I", &agent_universe, 5, 1 }, |
f7fdb216 | 178 | { NULL, NULL, NULL, 0, 0 } |
5020567a TL |
179 | }; |
180 | ||
181 | struct universe server_universe; | |
f7fdb216 DH |
182 | static struct option server_options[] = { |
183 | { "default-lease-time", "T", &server_universe, 1, 1 }, | |
184 | { "max-lease-time", "T", &server_universe, 2, 1 }, | |
185 | { "min-lease-time", "T", &server_universe, 3, 1 }, | |
186 | { "dynamic-bootp-lease-cutoff", "T", &server_universe, 4, 1 }, | |
187 | { "dynamic-bootp-lease-length", "L", &server_universe, 5, 1 }, | |
188 | { "boot-unknown-clients", "f", &server_universe, 6, 1 }, | |
189 | { "dynamic-bootp", "f", &server_universe, 7, 1 }, | |
190 | { "allow-bootp", "f", &server_universe, 8, 1 }, | |
191 | { "allow-booting", "f", &server_universe, 9, 1 }, | |
192 | { "one-lease-per-client", "f", &server_universe, 10, 1 }, | |
193 | { "get-lease-hostnames", "f", &server_universe, 11, 1 }, | |
194 | { "use-host-decl-names", "f", &server_universe, 12, 1 }, | |
195 | { "use-lease-addr-for-default-route", "f", | |
196 | &server_universe, 13, 1 }, | |
197 | { "min-secs", "B", &server_universe, 14, 1 }, | |
198 | { "filename", "t", &server_universe, 15, 1 }, | |
199 | { "server-name", "t", &server_universe, 16, 1 }, | |
200 | { "next-server", "I", &server_universe, 17, 1 }, | |
201 | { "authoritative", "f", &server_universe, 18, 1 }, | |
202 | { "vendor-option-space", "U", &server_universe, 19, 1 }, | |
203 | { "always-reply-rfc1048", "f", &server_universe, 20, 1 }, | |
204 | { "site-option-space", "X", &server_universe, 21, 1 }, | |
205 | { "always-broadcast", "f", &server_universe, 22, 1 }, | |
206 | { "ddns-domainname", "t", &server_universe, 23, 1 }, | |
207 | { "ddns-hostname", "t", &server_universe, 24, 1 }, | |
208 | { "ddns-rev-domainname", "t", &server_universe, 25, 1 }, | |
209 | { "lease-file-name", "t", &server_universe, 26, 1 }, | |
210 | { "pid-file-name", "t", &server_universe, 27, 1 }, | |
211 | { "duplicates", "f", &server_universe, 28, 1 }, | |
212 | { "declines", "f", &server_universe, 29, 1 }, | |
213 | { "ddns-updates", "f", &server_universe, 30, 1 }, | |
214 | { "omapi-port", "S", &server_universe, 31, 1 }, | |
215 | { "local-port", "S", &server_universe, 32, 1 }, | |
216 | { "limited-broadcast-address", "I", &server_universe, 33, 1 }, | |
217 | { "remote-port", "S", &server_universe, 34, 1 }, | |
218 | { "local-address", "I", &server_universe, 35, 1 }, | |
219 | { "omapi-key", "d", &server_universe, 36, 1 }, | |
220 | { "stash-agent-options", "f", &server_universe, 37, 1 }, | |
221 | { "ddns-ttl", "T", &server_universe, 38, 1 }, | |
222 | { "ddns-update-style", "Nddns-styles.", &server_universe, 39, 1 }, | |
223 | { "client-updates", "f", &server_universe, 40, 1 }, | |
224 | { "update-optimization", "f", &server_universe, 41, 1 }, | |
225 | { "ping-check", "f", &server_universe, 42, 1 }, | |
226 | { "update-static-leases", "f", &server_universe, 43, 1 }, | |
227 | { "log-facility", "Nsyslog-facilities.", | |
228 | &server_universe, 44, 1 }, | |
229 | { "do-forward-updates", "f", &server_universe, 45, 1 }, | |
230 | { "ping-timeout", "T", &server_universe, 46, 1 }, | |
1db5e2c0 | 231 | { "infinite-is-reserved", "f", &server_universe, 47, 1 }, |
3004bebf | 232 | { "update-conflict-detection", "f", &server_universe, 48, 1 }, |
bd2bc2fa | 233 | { "leasequery", "f", &server_universe, 49, 1 }, |
b22de500 | 234 | { "adaptive-lease-time-threshold", "B", &server_universe, 50, 1 }, |
4d2eaafb | 235 | { "do-reverse-updates", "f", &server_universe, 51, 1 }, |
1ba87b37 | 236 | { "fqdn-reply", "f", &server_universe, 52, 1 }, |
98bd7ca0 | 237 | { "preferred-lifetime", "T", &server_universe, 53, 1 }, |
75135a3f EH |
238 | { "dhcpv6-lease-file-name", "t", &server_universe, 54, 1 }, |
239 | { "dhcpv6-pid-file-name", "t", &server_universe, 55, 1 }, | |
b024480e | 240 | { "limit-addrs-per-ia", "L", &server_universe, 56, 1 }, |
f7fdb216 | 241 | { NULL, NULL, NULL, 0, 0 } |
5020567a TL |
242 | }; |
243 | ||
a256fd85 TL |
244 | struct enumeration_value ddns_styles_values [] = { |
245 | { "none", 0 }, | |
246 | { "ad-hoc", 1 }, | |
247 | { "interim", 2 }, | |
248 | { (char *)0, 0 } | |
249 | }; | |
250 | ||
251 | struct enumeration ddns_styles = { | |
252 | (struct enumeration *)0, | |
98bd7ca0 | 253 | "ddns-styles", 1, |
a256fd85 TL |
254 | ddns_styles_values |
255 | }; | |
256 | ||
0feab074 TL |
257 | struct enumeration_value syslog_values [] = { |
258 | #if defined (LOG_KERN) | |
259 | { "kern", LOG_KERN }, | |
260 | #endif | |
261 | #if defined (LOG_USER) | |
262 | { "user", LOG_USER }, | |
263 | #endif | |
264 | #if defined (LOG_MAIL) | |
265 | { "mail", LOG_MAIL }, | |
266 | #endif | |
267 | #if defined (LOG_DAEMON) | |
268 | { "daemon", LOG_DAEMON }, | |
269 | #endif | |
270 | #if defined (LOG_AUTH) | |
271 | { "auth", LOG_AUTH }, | |
272 | #endif | |
273 | #if defined (LOG_SYSLOG) | |
274 | { "syslog", LOG_SYSLOG }, | |
275 | #endif | |
276 | #if defined (LOG_LPR) | |
277 | { "lpr", LOG_LPR }, | |
278 | #endif | |
279 | #if defined (LOG_NEWS) | |
280 | { "news", LOG_NEWS }, | |
281 | #endif | |
282 | #if defined (LOG_UUCP) | |
283 | { "uucp", LOG_UUCP }, | |
284 | #endif | |
285 | #if defined (LOG_CRON) | |
286 | { "cron", LOG_CRON }, | |
287 | #endif | |
288 | #if defined (LOG_AUTHPRIV) | |
289 | { "authpriv", LOG_AUTHPRIV }, | |
290 | #endif | |
291 | #if defined (LOG_FTP) | |
292 | { "ftp", LOG_FTP }, | |
293 | #endif | |
294 | #if defined (LOG_LOCAL0) | |
295 | { "local0", LOG_LOCAL0 }, | |
296 | #endif | |
297 | #if defined (LOG_LOCAL1) | |
298 | { "local1", LOG_LOCAL1 }, | |
299 | #endif | |
300 | #if defined (LOG_LOCAL2) | |
301 | { "local2", LOG_LOCAL2 }, | |
302 | #endif | |
303 | #if defined (LOG_LOCAL3) | |
304 | { "local3", LOG_LOCAL3 }, | |
305 | #endif | |
306 | #if defined (LOG_LOCAL4) | |
307 | { "local4", LOG_LOCAL4 }, | |
308 | #endif | |
309 | #if defined (LOG_LOCAL5) | |
310 | { "local5", LOG_LOCAL5 }, | |
311 | #endif | |
312 | #if defined (LOG_LOCAL6) | |
313 | { "local6", LOG_LOCAL6 }, | |
314 | #endif | |
315 | #if defined (LOG_LOCAL7) | |
316 | { "local7", LOG_LOCAL7 }, | |
317 | #endif | |
318 | { (char *)0, 0 } | |
319 | }; | |
320 | ||
321 | struct enumeration syslog_enum = { | |
322 | (struct enumeration *)0, | |
98bd7ca0 | 323 | "syslog-facilities", 1, |
0feab074 TL |
324 | syslog_values |
325 | }; | |
326 | ||
5020567a TL |
327 | void initialize_server_option_spaces() |
328 | { | |
329 | int i; | |
f7fdb216 | 330 | unsigned code; |
5020567a TL |
331 | |
332 | /* Set up the Relay Agent Information Option suboption space... */ | |
333 | agent_universe.name = "agent"; | |
98bd7ca0 | 334 | agent_universe.concat_duplicates = 0; |
5020567a | 335 | agent_universe.option_state_dereference = |
e929278f TL |
336 | linked_option_state_dereference; |
337 | agent_universe.lookup_func = lookup_linked_option; | |
338 | agent_universe.save_func = save_linked_option; | |
339 | agent_universe.delete_func = delete_linked_option; | |
340 | agent_universe.encapsulate = linked_option_space_encapsulate; | |
341 | agent_universe.foreach = linked_option_space_foreach; | |
342 | agent_universe.decode = parse_option_buffer; | |
5020567a TL |
343 | agent_universe.index = universe_count++; |
344 | agent_universe.length_size = 1; | |
345 | agent_universe.tag_size = 1; | |
f7fdb216 | 346 | agent_universe.get_tag = getUChar; |
5020567a | 347 | agent_universe.store_tag = putUChar; |
f7fdb216 | 348 | agent_universe.get_length = getUChar; |
5020567a | 349 | agent_universe.store_length = putUChar; |
2c9bf1f4 DH |
350 | agent_universe.site_code_min = 0; |
351 | agent_universe.end = 0; | |
5020567a | 352 | universes [agent_universe.index] = &agent_universe; |
f7fdb216 DH |
353 | if (!option_name_new_hash(&agent_universe.name_hash, |
354 | AGENT_HASH_SIZE, MDL) || | |
355 | !option_code_new_hash(&agent_universe.code_hash, | |
356 | AGENT_HASH_SIZE, MDL)) | |
5020567a | 357 | log_fatal ("Can't allocate agent option hash table."); |
f7fdb216 DH |
358 | for (i = 0 ; agent_options[i].name ; i++) { |
359 | option_code_hash_add(agent_universe.code_hash, | |
360 | &agent_options[i].code, 0, | |
361 | &agent_options[i], MDL); | |
362 | option_name_hash_add(agent_universe.name_hash, | |
363 | agent_options[i].name, 0, | |
364 | &agent_options[i], MDL); | |
5020567a | 365 | } |
6708d944 DH |
366 | #if defined(REPORT_HASH_PERFORMANCE) |
367 | log_info("Relay Agent name hash: %s", | |
368 | option_name_hash_report(agent_universe.name_hash)); | |
369 | log_info("Relay Agent code hash: %s", | |
370 | option_code_hash_report(agent_universe.code_hash)); | |
371 | #endif | |
f7fdb216 DH |
372 | code = DHO_DHCP_AGENT_OPTIONS; |
373 | option_code_hash_lookup(&agent_universe.enc_opt, | |
374 | dhcp_universe.code_hash, &code, 0, MDL); | |
5020567a TL |
375 | |
376 | /* Set up the server option universe... */ | |
377 | server_universe.name = "server"; | |
98bd7ca0 | 378 | server_universe.concat_duplicates = 0; |
5020567a TL |
379 | server_universe.lookup_func = lookup_hashed_option; |
380 | server_universe.option_state_dereference = | |
381 | hashed_option_state_dereference; | |
5020567a TL |
382 | server_universe.save_func = save_hashed_option; |
383 | server_universe.delete_func = delete_hashed_option; | |
384 | server_universe.encapsulate = hashed_option_space_encapsulate; | |
e929278f | 385 | server_universe.foreach = hashed_option_space_foreach; |
f7fdb216 DH |
386 | server_universe.length_size = 1; /* Never used ... */ |
387 | server_universe.tag_size = 4; | |
5020567a TL |
388 | server_universe.store_tag = putUChar; |
389 | server_universe.store_length = putUChar; | |
2c9bf1f4 DH |
390 | server_universe.site_code_min = 0; |
391 | server_universe.end = 0; | |
5020567a TL |
392 | server_universe.index = universe_count++; |
393 | universes [server_universe.index] = &server_universe; | |
f7fdb216 DH |
394 | if (!option_name_new_hash(&server_universe.name_hash, |
395 | SERVER_HASH_SIZE, MDL) || | |
396 | !option_code_new_hash(&server_universe.code_hash, | |
397 | SERVER_HASH_SIZE, MDL)) | |
5020567a | 398 | log_fatal ("Can't allocate server option hash table."); |
f7fdb216 DH |
399 | for (i = 0 ; server_options[i].name ; i++) { |
400 | option_code_hash_add(server_universe.code_hash, | |
401 | &server_options[i].code, 0, | |
402 | &server_options[i], MDL); | |
403 | option_name_hash_add(server_universe.name_hash, | |
404 | server_options[i].name, 0, | |
405 | &server_options[i], MDL); | |
5020567a | 406 | } |
6708d944 DH |
407 | #if defined(REPORT_HASH_PERFORMANCE) |
408 | log_info("Server-Config Option name hash: %s", | |
409 | option_name_hash_report(server_universe.name_hash)); | |
410 | log_info("Server-Config Option code hash: %s", | |
411 | option_code_hash_report(server_universe.code_hash)); | |
412 | #endif | |
5020567a TL |
413 | |
414 | /* Add the server and agent option spaces to the option space hash. */ | |
20916cae TL |
415 | universe_hash_add (universe_hash, |
416 | agent_universe.name, 0, &agent_universe, MDL); | |
417 | universe_hash_add (universe_hash, | |
418 | server_universe.name, 0, &server_universe, MDL); | |
588af269 TL |
419 | |
420 | /* Make the server universe the configuration option universe. */ | |
421 | config_universe = &server_universe; | |
f7fdb216 DH |
422 | |
423 | code = SV_VENDOR_OPTION_SPACE; | |
424 | option_code_hash_lookup(&vendor_cfg_option, server_universe.code_hash, | |
425 | &code, 0, MDL); | |
5020567a | 426 | } |