xref: /minix/external/bsd/dhcp/dist/server/stables.c (revision fb9c64b2)
1 /*	$NetBSD: stables.c,v 1.1.1.2 2014/07/12 11:58:16 spz Exp $	*/
2 /* stables.c
3 
4    Tables of information only used by server... */
5 
6 /*
7  * Copyright (c) 2004-2011,2013-2014 by Internet Systems Consortium, Inc. ("ISC")
8  * Copyright (c) 1995-2003 by Internet Software Consortium
9  *
10  * Permission to use, copy, modify, and distribute this software for any
11  * purpose with or without fee is hereby granted, provided that the above
12  * copyright notice and this permission notice appear in all copies.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
15  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
17  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
20  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21  *
22  *   Internet Systems Consortium, Inc.
23  *   950 Charter Street
24  *   Redwood City, CA 94063
25  *   <info@isc.org>
26  *   https://www.isc.org/
27  *
28  */
29 
30 #include <sys/cdefs.h>
31 __RCSID("$NetBSD: stables.c,v 1.1.1.2 2014/07/12 11:58:16 spz Exp $");
32 
33 #include "dhcpd.h"
34 #include <syslog.h>
35 
36 #if defined (FAILOVER_PROTOCOL)
37 
38 /* This is used to indicate some kind of failure when generating a
39    failover option. */
40 failover_option_t null_failover_option = { 0, 0 };
41 failover_option_t skip_failover_option = { 0, 0 };
42 
43 /* Information about failover options, for printing, encoding
44    and decoding. */
45 struct failover_option_info ft_options [] =
46 {
47 	{ 0, "unused", FT_UNDEF, 0, 0, 0 },
48 	{ FTO_ADDRESSES_TRANSFERRED, "addresses-transferred", FT_UINT32, 1,
49 	  FM_OFFSET(addresses_transferred), FTB_ADDRESSES_TRANSFERRED },
50 	{ FTO_ASSIGNED_IP_ADDRESS, "assigned-IP-address", FT_IPADDR, 1,
51 	  FM_OFFSET(assigned_addr), FTB_ASSIGNED_IP_ADDRESS },
52 	{ FTO_BINDING_STATUS, "binding-status", FT_UINT8, 1,
53 	  FM_OFFSET(binding_status), FTB_BINDING_STATUS },
54 	{ FTO_CLIENT_IDENTIFIER, "client-identifier", FT_BYTES, 0,
55 	  FM_OFFSET(client_identifier), FTB_CLIENT_IDENTIFIER },
56 	{ FTO_CHADDR, "client-hardware-address", FT_BYTES, 0,
57 	  FM_OFFSET(chaddr), FTB_CHADDR },
58 	{ FTO_CLTT, "client-last-transaction-time", FT_UINT32, 1,
59 	  FM_OFFSET(cltt), FTB_CLTT },
60 	{ FTO_REPLY_OPTIONS, "client-reply-options", FT_BYTES, 0,
61 	  FM_OFFSET(reply_options), FTB_REPLY_OPTIONS },
62 	{ FTO_REQUEST_OPTIONS, "client-request-options", FT_BYTES, 0,
63 	  FM_OFFSET(request_options), FTB_REQUEST_OPTIONS },
64 	{ FTO_DDNS, "DDNS", FT_DDNS, 1, FM_OFFSET(ddns), FTB_DDNS },
65 	{ FTO_DELAYED_SERVICE, "delayed-service", FT_UINT8, 1,
66 	  FM_OFFSET(delayed_service), FTB_DELAYED_SERVICE },
67 	{ FTO_HBA, "hash-bucket-assignment", FT_BYTES, 0,
68 	  FM_OFFSET(hba), FTB_HBA },
69 	{ FTO_IP_FLAGS, "IP-flags", FT_UINT16, 1,
70 	  FM_OFFSET(ip_flags), FTB_IP_FLAGS },
71 	{ FTO_LEASE_EXPIRY, "lease-expiration-time", FT_UINT32, 1,
72 	  FM_OFFSET(expiry), FTB_LEASE_EXPIRY },
73 	{ FTO_MAX_UNACKED, "max-unacked-bndupd", FT_UINT32, 1,
74 	  FM_OFFSET(max_unacked), FTB_MAX_UNACKED },
75 	{ FTO_MCLT, "MCLT", FT_UINT32, 1, FM_OFFSET(mclt), FTB_MCLT },
76 	{ FTO_MESSAGE, "message", FT_TEXT, 0,
77 	  FM_OFFSET(message), FTB_MESSAGE },
78 	{ FTO_MESSAGE_DIGEST, "message-digest", FT_BYTES, 0,
79 	  FM_OFFSET(message_digest), FTB_MESSAGE_DIGEST },
80 	{ FTO_POTENTIAL_EXPIRY, "potential-expiration-time", FT_UINT32, 1,
81 	  FM_OFFSET(potential_expiry), FTB_POTENTIAL_EXPIRY },
82 	{ FTO_RECEIVE_TIMER, "receive-timer", FT_UINT32, 1,
83 	  FM_OFFSET(receive_timer), FTB_RECEIVE_TIMER },
84 	{ FTO_PROTOCOL_VERSION, "protocol-version", FT_UINT8, 1,
85 	  FM_OFFSET(protocol_version), FTB_PROTOCOL_VERSION },
86 	{ FTO_REJECT_REASON, "reject-reason", FT_UINT8, 1,
87 	  FM_OFFSET(reject_reason), FTB_REJECT_REASON },
88 	{ FTO_RELATIONSHIP_NAME, "relationship-name", FT_BYTES, 0,
89 	  FM_OFFSET(relationship_name), FTB_RELATIONSHIP_NAME },
90 	{ FTO_SERVER_FLAGS, "server-flags", FT_UINT8, 1,
91 	  FM_OFFSET(server_flags), FTB_SERVER_FLAGS },
92 	{ FTO_SERVER_STATE, "server-state", FT_UINT8, 1,
93 	  FM_OFFSET(server_state), FTB_SERVER_STATE },
94 	{ FTO_STOS, "start-time-of-state", FT_UINT32, 1,
95 	  FM_OFFSET(stos), FTB_STOS },
96 	{ FTO_TLS_REPLY, "TLS-reply", FT_UINT8, 1,
97 	  FM_OFFSET(tls_reply), FTB_TLS_REPLY },
98 	{ FTO_TLS_REQUEST, "TLS-request", FT_UINT8, 1,
99 	  FM_OFFSET(tls_request), FTB_TLS_REQUEST },
100 	{ FTO_VENDOR_CLASS, "vendor-class-identifier", FT_BYTES, 0,
101 	  FM_OFFSET(vendor_class), FTB_VENDOR_CLASS },
102 	{ FTO_VENDOR_OPTIONS, "vendor-specific-options", FT_BYTES, 0,
103 	  FM_OFFSET(vendor_options), FTB_VENDOR_OPTIONS }
104 };
105 
106 /* These are really options that make sense for a particular request - if
107    some other option comes in, we're not going to use it, so we can just
108    discard it.  Note that the message-digest option is allowed for all
109    message types, but is not saved - it's just used to validate the message
110    and then discarded - so it's not mentioned here. */
111 
112 u_int32_t fto_allowed [] = {
113 	0,	/* 0 unused */
114 	0,	/* 1 POOLREQ */
115 	FTB_ADDRESSES_TRANSFERRED, /* 2 POOLRESP */
116 	(FTB_ASSIGNED_IP_ADDRESS | FTB_BINDING_STATUS | FTB_CLIENT_IDENTIFIER |
117 	 FTB_CHADDR | FTB_DDNS | FTB_IP_FLAGS | FTB_LEASE_EXPIRY |
118 	 FTB_POTENTIAL_EXPIRY | FTB_STOS | FTB_CLTT | FTB_REQUEST_OPTIONS |
119 	 FTB_REPLY_OPTIONS), /* 3 BNDUPD */
120 	(FTB_ASSIGNED_IP_ADDRESS | FTB_BINDING_STATUS | FTB_CLIENT_IDENTIFIER |
121 	 FTB_CHADDR | FTB_DDNS | FTB_IP_FLAGS | FTB_LEASE_EXPIRY |
122 	 FTB_POTENTIAL_EXPIRY | FTB_STOS | FTB_CLTT | FTB_REQUEST_OPTIONS |
123 	 FTB_REPLY_OPTIONS | FTB_REJECT_REASON | FTB_MESSAGE), /* 4 BNDACK */
124 	(FTB_RELATIONSHIP_NAME | FTB_MAX_UNACKED | FTB_RECEIVE_TIMER |
125 	 FTB_VENDOR_CLASS | FTB_PROTOCOL_VERSION | FTB_TLS_REQUEST |
126 	 FTB_MCLT | FTB_HBA), /* 5 CONNECT */
127 	(FTB_RELATIONSHIP_NAME | FTB_MAX_UNACKED | FTB_RECEIVE_TIMER |
128 	 FTB_VENDOR_CLASS | FTB_PROTOCOL_VERSION | FTB_TLS_REPLY |
129 	 FTB_REJECT_REASON | FTB_MESSAGE), /* CONNECTACK */
130 	0, /* 7 UPDREQALL */
131 	0, /* 8 UPDDONE */
132 	0, /* 9 UPDREQ */
133 	(FTB_SERVER_STATE | FTB_SERVER_FLAGS | FTB_STOS), /* 10 STATE */
134 	0,	/* 11 CONTACT */
135 	(FTB_REJECT_REASON | FTB_MESSAGE) /* 12 DISCONNECT */
136 };
137 
138 /* Sizes of the various types. */
139 int ft_sizes [] = {
140 	1, /* FT_UINT8 */
141 	4, /* FT_IPADDR */
142 	4, /* FT_UINT32 */
143 	1, /* FT_BYTES */
144 	1, /* FT_TEXT_OR_BYTES */
145 	0, /* FT_DDNS */
146 	0, /* FT_DDNS1 */
147 	2, /* FT_UINT16 */
148 	1, /* FT_TEXT */
149 	0, /* FT_UNDEF */
150 	0, /* FT_DIGEST */
151 };
152 
153 /* Names of the various failover link states. */
154 const char *dhcp_flink_state_names [] = {
155 	"invalid state 0",
156 	"startup",
157 	"message length wait",
158 	"message wait",
159 	"disconnected"
160 };
161 #endif /* FAILOVER_PROTOCOL */
162 
163 /* Failover binding state names.   These are used even if there is no
164    failover protocol support. */
165 const char *binding_state_names [] = {
166 	"free", "active", "expired", "released", "abandoned",
167 	"reset", "backup" };
168 
169 struct universe agent_universe;
170 static struct option agent_options[] = {
171 	{ "circuit-id", "X",			&agent_universe,   1, 1 },
172 	{ "remote-id", "X",			&agent_universe,   2, 1 },
173 	{ "agent-id", "I",			&agent_universe,   3, 1 },
174 	{ "DOCSIS-device-class", "L",		&agent_universe,   4, 1 },
175 	{ "link-selection", "I",		&agent_universe,   5, 1 },
176 	{ NULL, NULL, NULL, 0, 0 }
177 };
178 
179 struct universe server_universe;
180 static struct option server_options[] = {
181 	{ "default-lease-time", "T",		&server_universe,   1, 1 },
182 	{ "max-lease-time", "T",		&server_universe,   2, 1 },
183 	{ "min-lease-time", "T",		&server_universe,   3, 1 },
184 	{ "dynamic-bootp-lease-cutoff", "T",	&server_universe,   4, 1 },
185 	{ "dynamic-bootp-lease-length", "L",	&server_universe,   5, 1 },
186 	{ "boot-unknown-clients", "f",		&server_universe,   6, 1 },
187 	{ "dynamic-bootp", "f",			&server_universe,   7, 1 },
188 	{ "allow-bootp", "f",			&server_universe,   8, 1 },
189 	{ "allow-booting", "f",			&server_universe,   9, 1 },
190 	{ "one-lease-per-client", "f",		&server_universe,  10, 1 },
191 	{ "get-lease-hostnames", "f",		&server_universe,  11, 1 },
192 	{ "use-host-decl-names", "f",		&server_universe,  12, 1 },
193 	{ "use-lease-addr-for-default-route", "f",
194 						&server_universe,  13, 1 },
195 	{ "min-secs", "B",			&server_universe,  14, 1 },
196 	{ "filename", "t",			&server_universe,  15, 1 },
197 	{ "server-name", "t",			&server_universe,  16, 1 },
198 	{ "next-server", "I",			&server_universe,  17, 1 },
199 	{ "authoritative", "f",			&server_universe,  18, 1 },
200 	{ "vendor-option-space", "U",		&server_universe,  19, 1 },
201 	{ "always-reply-rfc1048", "f",		&server_universe,  20, 1 },
202 	{ "site-option-space", "X",		&server_universe,  21, 1 },
203 	{ "always-broadcast", "f",		&server_universe,  22, 1 },
204 	{ "ddns-domainname", "t",		&server_universe,  23, 1 },
205 	{ "ddns-hostname", "t",			&server_universe,  24, 1 },
206 	{ "ddns-rev-domainname", "t",		&server_universe,  25, 1 },
207 	{ "lease-file-name", "t",		&server_universe,  26, 1 },
208 	{ "pid-file-name", "t",			&server_universe,  27, 1 },
209 	{ "duplicates", "f",			&server_universe,  28, 1 },
210 	{ "declines", "f",			&server_universe,  29, 1 },
211 	{ "ddns-updates", "f",			&server_universe,  30, 1 },
212 	{ "omapi-port", "S",			&server_universe,  31, 1 },
213 	{ "local-port", "S",			&server_universe,  32, 1 },
214 	{ "limited-broadcast-address", "I",	&server_universe,  33, 1 },
215 	{ "remote-port", "S",			&server_universe,  34, 1 },
216 	{ "local-address", "I",			&server_universe,  35, 1 },
217 	{ "omapi-key", "d",			&server_universe,  36, 1 },
218 	{ "stash-agent-options", "f",		&server_universe,  37, 1 },
219 	{ "ddns-ttl", "T",			&server_universe,  38, 1 },
220 	{ "ddns-update-style", "Nddns-styles.",	&server_universe,  39, 1 },
221 	{ "client-updates", "f",		&server_universe,  40, 1 },
222 	{ "update-optimization", "f",		&server_universe,  41, 1 },
223 	{ "ping-check", "f",			&server_universe,  42, 1 },
224 	{ "update-static-leases", "f",		&server_universe,  43, 1 },
225 	{ "log-facility", "Nsyslog-facilities.",
226 						&server_universe,  44, 1 },
227 	{ "do-forward-updates", "f",		&server_universe,  45, 1 },
228 	{ "ping-timeout", "T",			&server_universe,  46, 1 },
229 	{ "infinite-is-reserved", "f",		&server_universe,  47, 1 },
230 	{ "update-conflict-detection", "f",	&server_universe,  48, 1 },
231 	{ "leasequery", "f",			&server_universe,  49, 1 },
232 	{ "adaptive-lease-time-threshold", "B",	&server_universe,  50, 1 },
233 	{ "do-reverse-updates", "f",		&server_universe,  51, 1 },
234 	{ "fqdn-reply", "f",			&server_universe,  52, 1 },
235 	{ "preferred-lifetime", "T",		&server_universe,  53, 1 },
236 	{ "dhcpv6-lease-file-name", "t",	&server_universe,  54, 1 },
237 	{ "dhcpv6-pid-file-name", "t",		&server_universe,  55, 1 },
238 	{ "limit-addrs-per-ia", "L",		&server_universe,  56, 1 },
239 	{ "limit-prefs-per-ia", "L",		&server_universe,  57, 1 },
240 /* Assert a configuration parsing error if delayed-ack isn't compiled in. */
241 #if defined(DELAYED_ACK)
242 	{ "delayed-ack", "S",			&server_universe,  58, 1 },
243 	{ "max-ack-delay", "L",			&server_universe,  59, 1 },
244 #endif
245 #if defined(LDAP_CONFIGURATION)
246 	{ "ldap-server", "t",			&server_universe,  60, 1 },
247 	{ "ldap-port", "d",			&server_universe,  61, 1 },
248 	{ "ldap-username", "t",			&server_universe,  62, 1 },
249 	{ "ldap-password", "t",			&server_universe,  63, 1 },
250 	{ "ldap-base-dn", "t",			&server_universe,  64, 1 },
251 	{ "ldap-method", "Nldap-methods.",	&server_universe,  65, 1 },
252 	{ "ldap-debug-file", "t",		&server_universe,  66, 1 },
253 	{ "ldap-dhcp-server-cn", "t",		&server_universe,  67, 1 },
254 	{ "ldap-referrals", "f",		&server_universe,  68, 1 },
255 #if defined(LDAP_USE_SSL)
256 	{ "ldap-ssl", "Nldap-ssl-usage.",	&server_universe,  69, 1 },
257 	{ "ldap-tls-reqcert", "Nldap-tls-reqcert.",	&server_universe,  70, 1 },
258 	{ "ldap-tls-ca-file", "t",		&server_universe,  71, 1 },
259 	{ "ldap-tls-ca-dir", "t",		&server_universe,  72, 1 },
260 	{ "ldap-tls-cert", "t",			&server_universe,  73, 1 },
261 	{ "ldap-tls-key", "t",			&server_universe,  74, 1 },
262 	{ "ldap-tls-crlcheck", "Nldap-tls-crlcheck.",	&server_universe,  75, 1 },
263 	{ "ldap-tls-ciphers", "t",		&server_universe,  76, 1 },
264 	{ "ldap-tls-randfile", "t",		&server_universe,  77, 1 },
265 #endif /* LDAP_USE_SSL */
266 #endif /* LDAP_CONFIGURATION */
267 	{ "dhcp-cache-threshold", "B",		&server_universe,  78, 1 },
268 	{ "dont-use-fsync", "f",		&server_universe,  79, 1 },
269 	{ "ddns-local-address4", "I",		&server_universe,  80, 1 },
270 	{ "ddns-local-address6", "6",		&server_universe,  81, 1 },
271 	{ "ignore-client-uids", "f",		&server_universe,  82, 1 },
272 	{ NULL, NULL, NULL, 0, 0 }
273 };
274 
275 #if defined(LDAP_CONFIGURATION)
276 struct enumeration_value ldap_values [] = {
277 	{ "static", LDAP_METHOD_STATIC },
278 	{ "dynamic", LDAP_METHOD_DYNAMIC },
279 	{ (char *) 0, 0 }
280 };
281 
282 struct enumeration ldap_methods = {
283 	(struct enumeration *)0,
284 	"ldap-methods", 1,
285 	ldap_values
286 };
287 
288 #if defined(LDAP_USE_SSL)
289 struct enumeration_value ldap_ssl_usage_values [] = {
290 	{ "off", LDAP_SSL_OFF },
291 	{ "on",LDAP_SSL_ON },
292 	{ "ldaps", LDAP_SSL_LDAPS },
293 	{ "start_tls", LDAP_SSL_TLS },
294 	{ (char *) 0, 0 }
295 };
296 
297 struct enumeration ldap_ssl_usage_enum = {
298 	(struct enumeration *)0,
299 	"ldap-ssl-usage", 1,
300 	ldap_ssl_usage_values
301 };
302 
303 struct enumeration_value ldap_tls_reqcert_values [] = {
304 	{ "never", LDAP_OPT_X_TLS_NEVER },
305 	{ "hard", LDAP_OPT_X_TLS_HARD  },
306 	{ "demand", LDAP_OPT_X_TLS_DEMAND},
307 	{ "allow", LDAP_OPT_X_TLS_ALLOW },
308 	{ "try", LDAP_OPT_X_TLS_TRY   },
309 	{ (char *) 0, 0 }
310 };
311 struct enumeration ldap_tls_reqcert_enum = {
312 	(struct enumeration *)0,
313 	"ldap-tls-reqcert", 1,
314 	ldap_tls_reqcert_values
315 };
316 
317 struct enumeration_value ldap_tls_crlcheck_values [] = {
318 	{ "none", LDAP_OPT_X_TLS_CRL_NONE},
319 	{ "peer", LDAP_OPT_X_TLS_CRL_PEER},
320 	{ "all",  LDAP_OPT_X_TLS_CRL_ALL },
321 	{ (char *) 0, 0 }
322 };
323 struct enumeration ldap_tls_crlcheck_enum = {
324 	(struct enumeration *)0,
325 	"ldap-tls-crlcheck", 1,
326 	ldap_tls_crlcheck_values
327 };
328 #endif
329 #endif
330 
331 struct enumeration_value ddns_styles_values [] = {
332 	{ "none", 0 },
333 	{ "ad-hoc", 1 },
334 	{ "interim", 2 },
335 	{ "standard", 3 },
336 	{ (char *)0, 0 }
337 };
338 
339 struct enumeration ddns_styles = {
340 	(struct enumeration *)0,
341 	"ddns-styles", 1,
342 	ddns_styles_values
343 };
344 
345 struct enumeration_value syslog_values [] = {
346 #if defined (LOG_KERN)
347 	{ "kern", LOG_KERN },
348 #endif
349 #if defined (LOG_USER)
350 	{ "user", LOG_USER },
351 #endif
352 #if defined (LOG_MAIL)
353 	{ "mail", LOG_MAIL },
354 #endif
355 #if defined (LOG_DAEMON)
356 	{ "daemon", LOG_DAEMON },
357 #endif
358 #if defined (LOG_AUTH)
359 	{ "auth", LOG_AUTH },
360 #endif
361 #if defined (LOG_SYSLOG)
362 	{ "syslog", LOG_SYSLOG },
363 #endif
364 #if defined (LOG_LPR)
365 	{ "lpr", LOG_LPR },
366 #endif
367 #if defined (LOG_NEWS)
368 	{ "news", LOG_NEWS },
369 #endif
370 #if defined (LOG_UUCP)
371 	{ "uucp", LOG_UUCP },
372 #endif
373 #if defined (LOG_CRON)
374 	{ "cron", LOG_CRON },
375 #endif
376 #if defined (LOG_AUTHPRIV)
377 	{ "authpriv", LOG_AUTHPRIV },
378 #endif
379 #if defined (LOG_FTP)
380 	{ "ftp", LOG_FTP },
381 #endif
382 #if defined (LOG_LOCAL0)
383 	{ "local0", LOG_LOCAL0 },
384 #endif
385 #if defined (LOG_LOCAL1)
386 	{ "local1", LOG_LOCAL1 },
387 #endif
388 #if defined (LOG_LOCAL2)
389 	{ "local2", LOG_LOCAL2 },
390 #endif
391 #if defined (LOG_LOCAL3)
392 	{ "local3", LOG_LOCAL3 },
393 #endif
394 #if defined (LOG_LOCAL4)
395 	{ "local4", LOG_LOCAL4 },
396 #endif
397 #if defined (LOG_LOCAL5)
398 	{ "local5", LOG_LOCAL5 },
399 #endif
400 #if defined (LOG_LOCAL6)
401 	{ "local6", LOG_LOCAL6 },
402 #endif
403 #if defined (LOG_LOCAL7)
404 	{ "local7", LOG_LOCAL7 },
405 #endif
406 	{ (char *)0, 0 }
407 };
408 
409 struct enumeration syslog_enum = {
410 	(struct enumeration *)0,
411 	"syslog-facilities", 1,
412 	syslog_values
413 };
414 
415 void initialize_server_option_spaces()
416 {
417 	int i;
418 	unsigned code;
419 
420 	/* Set up the Relay Agent Information Option suboption space... */
421 	agent_universe.name = "agent";
422 	agent_universe.concat_duplicates = 0;
423 	agent_universe.option_state_dereference =
424 		linked_option_state_dereference;
425 	agent_universe.lookup_func = lookup_linked_option;
426 	agent_universe.save_func = save_linked_option;
427 	agent_universe.delete_func = delete_linked_option;
428 	agent_universe.encapsulate = linked_option_space_encapsulate;
429 	agent_universe.foreach = linked_option_space_foreach;
430 	agent_universe.decode = parse_option_buffer;
431 	agent_universe.index = universe_count++;
432 	agent_universe.length_size = 1;
433 	agent_universe.tag_size = 1;
434 	agent_universe.get_tag = getUChar;
435 	agent_universe.store_tag = putUChar;
436 	agent_universe.get_length = getUChar;
437 	agent_universe.store_length = putUChar;
438 	agent_universe.site_code_min = 0;
439 	agent_universe.end = 0;
440 	universes [agent_universe.index] = &agent_universe;
441 	if (!option_name_new_hash(&agent_universe.name_hash,
442 				  AGENT_HASH_SIZE, MDL) ||
443 	    !option_code_new_hash(&agent_universe.code_hash,
444 				  AGENT_HASH_SIZE, MDL))
445 		log_fatal ("Can't allocate agent option hash table.");
446 	for (i = 0 ; agent_options[i].name ; i++) {
447 		option_code_hash_add(agent_universe.code_hash,
448 				     &agent_options[i].code, 0,
449 				     &agent_options[i], MDL);
450 		option_name_hash_add(agent_universe.name_hash,
451 				     agent_options[i].name, 0,
452 				     &agent_options[i], MDL);
453 	}
454 #if defined(REPORT_HASH_PERFORMANCE)
455 	log_info("Relay Agent name hash: %s",
456 		 option_name_hash_report(agent_universe.name_hash));
457 	log_info("Relay Agent code hash: %s",
458 		 option_code_hash_report(agent_universe.code_hash));
459 #endif
460 	code = DHO_DHCP_AGENT_OPTIONS;
461 	option_code_hash_lookup(&agent_universe.enc_opt,
462 				dhcp_universe.code_hash, &code, 0, MDL);
463 
464 	/* Set up the server option universe... */
465 	server_universe.name = "server";
466 	server_universe.concat_duplicates = 0;
467 	server_universe.lookup_func = lookup_hashed_option;
468 	server_universe.option_state_dereference =
469 		hashed_option_state_dereference;
470 	server_universe.save_func = save_hashed_option;
471 	server_universe.delete_func = delete_hashed_option;
472 	server_universe.encapsulate = hashed_option_space_encapsulate;
473 	server_universe.foreach = hashed_option_space_foreach;
474 	server_universe.length_size = 1; /* Never used ... */
475 	server_universe.tag_size = 4;
476 	server_universe.store_tag = putUChar;
477 	server_universe.store_length = putUChar;
478 	server_universe.site_code_min = 0;
479 	server_universe.end = 0;
480 	server_universe.index = universe_count++;
481 	universes [server_universe.index] = &server_universe;
482 	if (!option_name_new_hash(&server_universe.name_hash,
483 				  SERVER_HASH_SIZE, MDL) ||
484 	    !option_code_new_hash(&server_universe.code_hash,
485 				  SERVER_HASH_SIZE, MDL))
486 		log_fatal ("Can't allocate server option hash table.");
487 	for (i = 0 ; server_options[i].name ; i++) {
488 		option_code_hash_add(server_universe.code_hash,
489 				     &server_options[i].code, 0,
490 				     &server_options[i], MDL);
491 		option_name_hash_add(server_universe.name_hash,
492 				     server_options[i].name, 0,
493 				     &server_options[i], MDL);
494 	}
495 #if defined(REPORT_HASH_PERFORMANCE)
496 	log_info("Server-Config Option name hash: %s",
497 		 option_name_hash_report(server_universe.name_hash));
498 	log_info("Server-Config Option code hash: %s",
499 		 option_code_hash_report(server_universe.code_hash));
500 #endif
501 
502 	/* Add the server and agent option spaces to the option space hash. */
503 	universe_hash_add (universe_hash,
504 			   agent_universe.name, 0, &agent_universe, MDL);
505 	universe_hash_add (universe_hash,
506 			   server_universe.name, 0, &server_universe, MDL);
507 
508 	/* Make the server universe the configuration option universe. */
509 	config_universe = &server_universe;
510 
511 	code = SV_VENDOR_OPTION_SPACE;
512 	option_code_hash_lookup(&vendor_cfg_option, server_universe.code_hash,
513 				&code, 0, MDL);
514 }
515