ISC DHCP  4.4.1
A reference DHCPv4 and DHCPv6 implementation
stables.c
Go to the documentation of this file.
1 /* stables.c
2 
3  Tables of information only used by server... */
4 
5 /*
6  * Copyright (c) 2004-2017 by Internet Systems Consortium, Inc. ("ISC")
7  * Copyright (c) 1995-2003 by Internet Software Consortium
8  *
9  * This Source Code Form is subject to the terms of the Mozilla Public
10  * License, v. 2.0. If a copy of the MPL was not distributed with this
11  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
12  *
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.
20  *
21  * Internet Systems Consortium, Inc.
22  * 950 Charter Street
23  * Redwood City, CA 94063
24  * <info@isc.org>
25  * https://www.isc.org/
26  *
27  */
28 
29 #include "dhcpd.h"
30 #include <syslog.h>
31 
32 #if defined (FAILOVER_PROTOCOL)
33 
34 /* This is used to indicate some kind of failure when generating a
35  failover option. */
36 failover_option_t null_failover_option = { 0, 0 };
37 failover_option_t skip_failover_option = { 0, 0 };
38 
39 /* Information about failover options, for printing, encoding
40  and decoding. */
41 struct failover_option_info ft_options [] =
42 {
43  { 0, "unused", FT_UNDEF, 0, 0, 0 },
44  { FTO_ADDRESSES_TRANSFERRED, "addresses-transferred", FT_UINT32, 1,
45  FM_OFFSET(addresses_transferred), FTB_ADDRESSES_TRANSFERRED },
46  { FTO_ASSIGNED_IP_ADDRESS, "assigned-IP-address", FT_IPADDR, 1,
47  FM_OFFSET(assigned_addr), FTB_ASSIGNED_IP_ADDRESS },
48  { FTO_BINDING_STATUS, "binding-status", FT_UINT8, 1,
49  FM_OFFSET(binding_status), FTB_BINDING_STATUS },
50  { FTO_CLIENT_IDENTIFIER, "client-identifier", FT_BYTES, 0,
51  FM_OFFSET(client_identifier), FTB_CLIENT_IDENTIFIER },
52  { FTO_CHADDR, "client-hardware-address", FT_BYTES, 0,
53  FM_OFFSET(chaddr), FTB_CHADDR },
54  { FTO_CLTT, "client-last-transaction-time", FT_UINT32, 1,
55  FM_OFFSET(cltt), FTB_CLTT },
56  { FTO_REPLY_OPTIONS, "client-reply-options", FT_BYTES, 0,
57  FM_OFFSET(reply_options), FTB_REPLY_OPTIONS },
58  { FTO_REQUEST_OPTIONS, "client-request-options", FT_BYTES, 0,
59  FM_OFFSET(request_options), FTB_REQUEST_OPTIONS },
60  { FTO_DDNS, "DDNS", FT_DDNS, 1, FM_OFFSET(ddns), FTB_DDNS },
61  { FTO_DELAYED_SERVICE, "delayed-service", FT_UINT8, 1,
62  FM_OFFSET(delayed_service), FTB_DELAYED_SERVICE },
63  { FTO_HBA, "hash-bucket-assignment", FT_BYTES, 0,
64  FM_OFFSET(hba), FTB_HBA },
65  { FTO_IP_FLAGS, "IP-flags", FT_UINT16, 1,
66  FM_OFFSET(ip_flags), FTB_IP_FLAGS },
67  { FTO_LEASE_EXPIRY, "lease-expiration-time", FT_UINT32, 1,
68  FM_OFFSET(expiry), FTB_LEASE_EXPIRY },
69  { FTO_MAX_UNACKED, "max-unacked-bndupd", FT_UINT32, 1,
70  FM_OFFSET(max_unacked), FTB_MAX_UNACKED },
71  { FTO_MCLT, "MCLT", FT_UINT32, 1, FM_OFFSET(mclt), FTB_MCLT },
72  { FTO_MESSAGE, "message", FT_TEXT, 0,
73  FM_OFFSET(message), FTB_MESSAGE },
74  { FTO_MESSAGE_DIGEST, "message-digest", FT_BYTES, 0,
75  FM_OFFSET(message_digest), FTB_MESSAGE_DIGEST },
76  { FTO_POTENTIAL_EXPIRY, "potential-expiration-time", FT_UINT32, 1,
77  FM_OFFSET(potential_expiry), FTB_POTENTIAL_EXPIRY },
78  { FTO_RECEIVE_TIMER, "receive-timer", FT_UINT32, 1,
79  FM_OFFSET(receive_timer), FTB_RECEIVE_TIMER },
80  { FTO_PROTOCOL_VERSION, "protocol-version", FT_UINT8, 1,
81  FM_OFFSET(protocol_version), FTB_PROTOCOL_VERSION },
82  { FTO_REJECT_REASON, "reject-reason", FT_UINT8, 1,
83  FM_OFFSET(reject_reason), FTB_REJECT_REASON },
84  { FTO_RELATIONSHIP_NAME, "relationship-name", FT_BYTES, 0,
85  FM_OFFSET(relationship_name), FTB_RELATIONSHIP_NAME },
86  { FTO_SERVER_FLAGS, "server-flags", FT_UINT8, 1,
87  FM_OFFSET(server_flags), FTB_SERVER_FLAGS },
88  { FTO_SERVER_STATE, "server-state", FT_UINT8, 1,
89  FM_OFFSET(server_state), FTB_SERVER_STATE },
90  { FTO_STOS, "start-time-of-state", FT_UINT32, 1,
91  FM_OFFSET(stos), FTB_STOS },
92  { FTO_TLS_REPLY, "TLS-reply", FT_UINT8, 1,
93  FM_OFFSET(tls_reply), FTB_TLS_REPLY },
94  { FTO_TLS_REQUEST, "TLS-request", FT_UINT8, 1,
95  FM_OFFSET(tls_request), FTB_TLS_REQUEST },
96  { FTO_VENDOR_CLASS, "vendor-class-identifier", FT_BYTES, 0,
97  FM_OFFSET(vendor_class), FTB_VENDOR_CLASS },
98  { FTO_VENDOR_OPTIONS, "vendor-specific-options", FT_BYTES, 0,
99  FM_OFFSET(vendor_options), FTB_VENDOR_OPTIONS }
100 };
101 
102 /* These are really options that make sense for a particular request - if
103  some other option comes in, we're not going to use it, so we can just
104  discard it. Note that the message-digest option is allowed for all
105  message types, but is not saved - it's just used to validate the message
106  and then discarded - so it's not mentioned here. */
107 
108 u_int32_t fto_allowed [] = {
109  0, /* 0 unused */
110  0, /* 1 POOLREQ */
111  FTB_ADDRESSES_TRANSFERRED, /* 2 POOLRESP */
112  (FTB_ASSIGNED_IP_ADDRESS | FTB_BINDING_STATUS | FTB_CLIENT_IDENTIFIER |
113  FTB_CHADDR | FTB_DDNS | FTB_IP_FLAGS | FTB_LEASE_EXPIRY |
114  FTB_POTENTIAL_EXPIRY | FTB_STOS | FTB_CLTT | FTB_REQUEST_OPTIONS |
115  FTB_REPLY_OPTIONS), /* 3 BNDUPD */
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 | FTB_REJECT_REASON | FTB_MESSAGE), /* 4 BNDACK */
120  (FTB_RELATIONSHIP_NAME | FTB_MAX_UNACKED | FTB_RECEIVE_TIMER |
121  FTB_VENDOR_CLASS | FTB_PROTOCOL_VERSION | FTB_TLS_REQUEST |
122  FTB_MCLT | FTB_HBA), /* 5 CONNECT */
123  (FTB_RELATIONSHIP_NAME | FTB_MAX_UNACKED | FTB_RECEIVE_TIMER |
124  FTB_VENDOR_CLASS | FTB_PROTOCOL_VERSION | FTB_TLS_REPLY |
125  FTB_REJECT_REASON | FTB_MESSAGE), /* CONNECTACK */
126  0, /* 7 UPDREQALL */
127  0, /* 8 UPDDONE */
128  0, /* 9 UPDREQ */
129  (FTB_SERVER_STATE | FTB_SERVER_FLAGS | FTB_STOS), /* 10 STATE */
130  0, /* 11 CONTACT */
131  (FTB_REJECT_REASON | FTB_MESSAGE) /* 12 DISCONNECT */
132 };
133 
134 /* Sizes of the various types. */
135 int ft_sizes [] = {
136  1, /* FT_UINT8 */
137  4, /* FT_IPADDR */
138  4, /* FT_UINT32 */
139  1, /* FT_BYTES */
140  1, /* FT_TEXT_OR_BYTES */
141  0, /* FT_DDNS */
142  0, /* FT_DDNS1 */
143  2, /* FT_UINT16 */
144  1, /* FT_TEXT */
145  0, /* FT_UNDEF */
146  0, /* FT_DIGEST */
147 };
148 
149 /* Names of the various failover link states. */
150 const char *dhcp_flink_state_names [] = {
151  "invalid state 0",
152  "startup",
153  "message length wait",
154  "message wait",
155  "disconnected"
156 };
157 #endif /* FAILOVER_PROTOCOL */
158 
159 /* Failover binding state names. These are used even if there is no
160  failover protocol support. */
161 const char *binding_state_names [] = {
162  "free", "active", "expired", "released", "abandoned",
163  "reset", "backup" };
164 
166 static struct option agent_options[] = {
167  { "circuit-id", "X", &agent_universe, 1, 1 },
168  { "remote-id", "X", &agent_universe, 2, 1 },
169  { "agent-id", "I", &agent_universe, 3, 1 },
170  { "DOCSIS-device-class", "L", &agent_universe, 4, 1 },
171  { "link-selection", "I", &agent_universe, 5, 1 },
172  { "relay-port", "Z", &agent_universe, 19, 1 },
173  { NULL, NULL, NULL, 0, 0 }
174 };
175 
177 static struct option server_options[] = {
178  { "default-lease-time", "T", &server_universe, 1, 1 },
179  { "max-lease-time", "T", &server_universe, 2, 1 },
180  { "min-lease-time", "T", &server_universe, 3, 1 },
181  { "dynamic-bootp-lease-cutoff", "T", &server_universe, 4, 1 },
182  { "dynamic-bootp-lease-length", "L", &server_universe, 5, 1 },
183  { "boot-unknown-clients", "f", &server_universe, 6, 1 },
184  { "dynamic-bootp", "f", &server_universe, 7, 1 },
185  { "allow-bootp", "f", &server_universe, 8, 1 },
186  { "allow-booting", "f", &server_universe, 9, 1 },
187  { "one-lease-per-client", "f", &server_universe, 10, 1 },
188  { "get-lease-hostnames", "f", &server_universe, 11, 1 },
189  { "use-host-decl-names", "f", &server_universe, 12, 1 },
190  { "use-lease-addr-for-default-route", "f",
191  &server_universe, 13, 1 },
192  { "min-secs", "B", &server_universe, 14, 1 },
193  { "filename", "t", &server_universe, 15, 1 },
194  { "server-name", "t", &server_universe, 16, 1 },
195  { "next-server", "I", &server_universe, 17, 1 },
196  { "authoritative", "f", &server_universe, 18, 1 },
197  { "vendor-option-space", "U", &server_universe, 19, 1 },
198  { "always-reply-rfc1048", "f", &server_universe, 20, 1 },
199  { "site-option-space", "X", &server_universe, 21, 1 },
200  { "always-broadcast", "f", &server_universe, 22, 1 },
201  { "ddns-domainname", "t", &server_universe, 23, 1 },
202  { "ddns-hostname", "t", &server_universe, 24, 1 },
203  { "ddns-rev-domainname", "t", &server_universe, 25, 1 },
204  { "lease-file-name", "t", &server_universe, 26, 1 },
205  { "pid-file-name", "t", &server_universe, 27, 1 },
206  { "duplicates", "f", &server_universe, 28, 1 },
207  { "declines", "f", &server_universe, 29, 1 },
208  { "ddns-updates", "f", &server_universe, 30, 1 },
209  { "omapi-port", "S", &server_universe, 31, 1 },
210  { "local-port", "S", &server_universe, 32, 1 },
211  { "limited-broadcast-address", "I", &server_universe, 33, 1 },
212  { "remote-port", "S", &server_universe, 34, 1 },
213  { "local-address", "I", &server_universe, 35, 1 },
214  { "omapi-key", "d", &server_universe, 36, 1 },
215  { "stash-agent-options", "f", &server_universe, 37, 1 },
216  { "ddns-ttl", "T", &server_universe, 38, 1 },
217  { "ddns-update-style", "Nddns-styles.", &server_universe, 39, 1 },
218  { "client-updates", "f", &server_universe, 40, 1 },
219  { "update-optimization", "f", &server_universe, 41, 1 },
220  { "ping-check", "f", &server_universe, 42, 1 },
221  { "update-static-leases", "f", &server_universe, 43, 1 },
222  { "log-facility", "Nsyslog-facilities.",
223  &server_universe, 44, 1 },
224  { "do-forward-updates", "f", &server_universe, 45, 1 },
225  { "ping-timeout", "T", &server_universe, 46, 1 },
226  { "infinite-is-reserved", "f", &server_universe, 47, 1 },
227  { "update-conflict-detection", "f", &server_universe, 48, 1 },
228  { "leasequery", "f", &server_universe, 49, 1 },
229  { "adaptive-lease-time-threshold", "B", &server_universe, 50, 1 },
230  { "do-reverse-updates", "f", &server_universe, 51, 1 },
231  { "fqdn-reply", "f", &server_universe, 52, 1 },
232  { "preferred-lifetime", "T", &server_universe, 53, 1 },
233  { "dhcpv6-lease-file-name", "t", &server_universe, 54, 1 },
234  { "dhcpv6-pid-file-name", "t", &server_universe, 55, 1 },
235  { "limit-addrs-per-ia", "L", &server_universe, 56, 1 },
236  { "limit-prefs-per-ia", "L", &server_universe, 57, 1 },
237 /* Assert a configuration parsing error if delayed-ack isn't compiled in. */
238 #if defined(DELAYED_ACK)
239  { "delayed-ack", "S", &server_universe, 58, 1 },
240  { "max-ack-delay", "L", &server_universe, 59, 1 },
241 #endif
242 #if defined(LDAP_CONFIGURATION)
243  { "ldap-server", "t", &server_universe, 60, 1 },
244  { "ldap-port", "d", &server_universe, 61, 1 },
245  { "ldap-username", "t", &server_universe, 62, 1 },
246  { "ldap-password", "t", &server_universe, 63, 1 },
247  { "ldap-base-dn", "t", &server_universe, 64, 1 },
248  { "ldap-method", "Nldap-methods.", &server_universe, 65, 1 },
249  { "ldap-debug-file", "t", &server_universe, 66, 1 },
250  { "ldap-dhcp-server-cn", "t", &server_universe, 67, 1 },
251  { "ldap-referrals", "f", &server_universe, 68, 1 },
252 #if defined(LDAP_USE_SSL)
253  { "ldap-ssl", "Nldap-ssl-usage.", &server_universe, 69, 1 },
254  { "ldap-tls-reqcert", "Nldap-tls-reqcert.", &server_universe, 70, 1 },
255  { "ldap-tls-ca-file", "t", &server_universe, 71, 1 },
256  { "ldap-tls-ca-dir", "t", &server_universe, 72, 1 },
257  { "ldap-tls-cert", "t", &server_universe, 73, 1 },
258  { "ldap-tls-key", "t", &server_universe, 74, 1 },
259  { "ldap-tls-crlcheck", "Nldap-tls-crlcheck.", &server_universe, 75, 1 },
260  { "ldap-tls-ciphers", "t", &server_universe, 76, 1 },
261  { "ldap-tls-randfile", "t", &server_universe, 77, 1 },
262  { "ldap-init-retry", "d", &server_universe, SV_LDAP_INIT_RETRY, 1 },
263 #endif /* LDAP_USE_SSL */
264 #if defined(LDAP_USE_GSSAPI)
265  { "ldap-gssapi-keytab", "t", &server_universe, SV_LDAP_GSSAPI_KEYTAB, 1},
266  { "ldap-gssapi-principal", "t", &server_universe, SV_LDAP_GSSAPI_PRINCIPAL, 1},
267 #endif /* LDAP_USE_GSSAPI */
268 #endif /* LDAP_CONFIGURATION */
269  { "dhcp-cache-threshold", "B", &server_universe, 78, 1 },
270  { "dont-use-fsync", "f", &server_universe, 79, 1 },
271  { "ddns-local-address4", "I", &server_universe, 80, 1 },
272  { "ddns-local-address6", "6", &server_universe, 81, 1 },
273  { "ignore-client-uids", "f", &server_universe, 82, 1 },
274  { "log-threshold-low", "B", &server_universe, 83, 1 },
275  { "log-threshold-high", "B", &server_universe, 84, 1 },
276  { "echo-client-id", "f", &server_universe, SV_ECHO_CLIENT_ID, 1 },
277  { "server-id-check", "f", &server_universe, SV_SERVER_ID_CHECK, 1 },
278  { "prefix-length-mode", "Nprefix_length_modes.", &server_universe, SV_PREFIX_LEN_MODE, 1 },
279  { "dhcpv6-set-tee-times", "f", &server_universe, SV_DHCPV6_SET_TEE_TIMES, 1 },
280  { "abandon-lease-time", "T", &server_universe, SV_ABANDON_LEASE_TIME, 1 },
281 #ifdef EUI_64
282  { "use-eui-64", "f", &server_universe, SV_USE_EUI_64, 1 },
283  { "persist-eui-64-leases", "f", &server_universe, SV_PERSIST_EUI_64_LEASES, 1 },
284 #endif
285 #if defined (FAILOVER_PROTOCOL)
286  { "check-secs-byte-order", "f", &server_universe, SV_CHECK_SECS_BYTE_ORDER, 1 },
287 #endif
288  { "ddns-dual-stack-mixed-mode", "f", &server_universe, SV_DDNS_DUAL_STACK_MIXED_MODE, 1 },
289  { "ddns-guard-id-must-match", "f", &server_universe, SV_DDNS_GUARD_ID_MUST_MATCH, 1 },
290  { "ddns-other-guard-is-dynamic", "f", &server_universe, SV_DDNS_OTHER_GUARD_IS_DYNAMIC, 1 },
291  { "release-on-roam", "f", &server_universe, SV_RELEASE_ON_ROAM, 1 },
292  { "local-address6", "6", &server_universe, SV_LOCAL_ADDRESS6, 1 },
293  { "bind-local-address6", "f", &server_universe, SV_BIND_LOCAL_ADDRESS6, 1 },
294  { NULL, NULL, NULL, 0, 0 }
295 };
296 
297 #if defined(LDAP_CONFIGURATION)
298 struct enumeration_value ldap_values [] = {
299  { "static", LDAP_METHOD_STATIC },
300  { "dynamic", LDAP_METHOD_DYNAMIC },
301  { (char *) 0, 0 }
302 };
303 
304 struct enumeration ldap_methods = {
305  (struct enumeration *)0,
306  "ldap-methods", 1,
307  ldap_values
308 };
309 
310 #if defined(LDAP_USE_SSL)
311 struct enumeration_value ldap_ssl_usage_values [] = {
312  { "off", LDAP_SSL_OFF },
313  { "on",LDAP_SSL_ON },
314  { "ldaps", LDAP_SSL_LDAPS },
315  { "start_tls", LDAP_SSL_TLS },
316  { (char *) 0, 0 }
317 };
318 
319 struct enumeration ldap_ssl_usage_enum = {
320  (struct enumeration *)0,
321  "ldap-ssl-usage", 1,
322  ldap_ssl_usage_values
323 };
324 
325 struct enumeration_value ldap_tls_reqcert_values [] = {
326  { "never", LDAP_OPT_X_TLS_NEVER },
327  { "hard", LDAP_OPT_X_TLS_HARD },
328  { "demand", LDAP_OPT_X_TLS_DEMAND},
329  { "allow", LDAP_OPT_X_TLS_ALLOW },
330  { "try", LDAP_OPT_X_TLS_TRY },
331  { (char *) 0, 0 }
332 };
333 struct enumeration ldap_tls_reqcert_enum = {
334  (struct enumeration *)0,
335  "ldap-tls-reqcert", 1,
336  ldap_tls_reqcert_values
337 };
338 
339 struct enumeration_value ldap_tls_crlcheck_values [] = {
340  { "none", LDAP_OPT_X_TLS_CRL_NONE},
341  { "peer", LDAP_OPT_X_TLS_CRL_PEER},
342  { "all", LDAP_OPT_X_TLS_CRL_ALL },
343  { (char *) 0, 0 }
344 };
345 struct enumeration ldap_tls_crlcheck_enum = {
346  (struct enumeration *)0,
347  "ldap-tls-crlcheck", 1,
348  ldap_tls_crlcheck_values
349 };
350 #endif
351 #endif
352 
354  { "none", 0 },
355  { "ad-hoc", 1 },
356  { "interim", 2 },
357  { "standard", 3 },
358  { (char *)0, 0 }
359 };
360 
362  (struct enumeration *)0,
363  "ddns-styles", 1,
365 };
366 
368  { "ignore", PLM_IGNORE },
369  { "prefer", PLM_PREFER },
370  { "exact", PLM_EXACT },
371  { "minimum", PLM_MINIMUM },
372  { "maximum", PLM_MAXIMUM },
373  { (char *)0, 0 }
374 };
375 
377  (struct enumeration *)0,
378  "prefix_length_modes", 1,
380 };
381 
383 #if defined (LOG_KERN)
384  { "kern", LOG_KERN },
385 #endif
386 #if defined (LOG_USER)
387  { "user", LOG_USER },
388 #endif
389 #if defined (LOG_MAIL)
390  { "mail", LOG_MAIL },
391 #endif
392 #if defined (LOG_DAEMON)
393  { "daemon", LOG_DAEMON },
394 #endif
395 #if defined (LOG_AUTH)
396  { "auth", LOG_AUTH },
397 #endif
398 #if defined (LOG_SYSLOG)
399  { "syslog", LOG_SYSLOG },
400 #endif
401 #if defined (LOG_LPR)
402  { "lpr", LOG_LPR },
403 #endif
404 #if defined (LOG_NEWS)
405  { "news", LOG_NEWS },
406 #endif
407 #if defined (LOG_UUCP)
408  { "uucp", LOG_UUCP },
409 #endif
410 #if defined (LOG_CRON)
411  { "cron", LOG_CRON },
412 #endif
413 #if defined (LOG_AUTHPRIV)
414  { "authpriv", LOG_AUTHPRIV },
415 #endif
416 #if defined (LOG_FTP)
417  { "ftp", LOG_FTP },
418 #endif
419 #if defined (LOG_LOCAL0)
420  { "local0", LOG_LOCAL0 },
421 #endif
422 #if defined (LOG_LOCAL1)
423  { "local1", LOG_LOCAL1 },
424 #endif
425 #if defined (LOG_LOCAL2)
426  { "local2", LOG_LOCAL2 },
427 #endif
428 #if defined (LOG_LOCAL3)
429  { "local3", LOG_LOCAL3 },
430 #endif
431 #if defined (LOG_LOCAL4)
432  { "local4", LOG_LOCAL4 },
433 #endif
434 #if defined (LOG_LOCAL5)
435  { "local5", LOG_LOCAL5 },
436 #endif
437 #if defined (LOG_LOCAL6)
438  { "local6", LOG_LOCAL6 },
439 #endif
440 #if defined (LOG_LOCAL7)
441  { "local7", LOG_LOCAL7 },
442 #endif
443  { (char *)0, 0 }
444 };
445 
447  (struct enumeration *)0,
448  "syslog-facilities", 1,
450 };
451 
453 {
454  int i;
455  unsigned code;
456 
457  /* Set up the Relay Agent Information Option suboption space... */
458  agent_universe.name = "agent";
476  agent_universe.end = 0;
478  if (!option_name_new_hash(&agent_universe.name_hash,
479  AGENT_HASH_SIZE, MDL) ||
480  !option_code_new_hash(&agent_universe.code_hash,
482  log_fatal ("Can't allocate agent option hash table.");
483  for (i = 0 ; agent_options[i].name ; i++) {
484  option_code_hash_add(agent_universe.code_hash,
485  &agent_options[i].code, 0,
486  &agent_options[i], MDL);
487  option_name_hash_add(agent_universe.name_hash,
488  agent_options[i].name, 0,
489  &agent_options[i], MDL);
490  }
491 #if defined(REPORT_HASH_PERFORMANCE)
492  log_info("Relay Agent name hash: %s",
493  option_name_hash_report(agent_universe.name_hash));
494  log_info("Relay Agent code hash: %s",
495  option_code_hash_report(agent_universe.code_hash));
496 #endif
497  code = DHO_DHCP_AGENT_OPTIONS;
498  option_code_hash_lookup(&agent_universe.enc_opt,
499  dhcp_universe.code_hash, &code, 0, MDL);
500 
501  /* Set up the server option universe... */
502  server_universe.name = "server";
511  server_universe.length_size = 1; /* Never used ... */
516  server_universe.end = 0;
519  if (!option_name_new_hash(&server_universe.name_hash,
520  SERVER_HASH_SIZE, MDL) ||
521  !option_code_new_hash(&server_universe.code_hash,
523  log_fatal ("Can't allocate server option hash table.");
524  for (i = 0 ; server_options[i].name ; i++) {
525  option_code_hash_add(server_universe.code_hash,
526  &server_options[i].code, 0,
527  &server_options[i], MDL);
528  option_name_hash_add(server_universe.name_hash,
529  server_options[i].name, 0,
530  &server_options[i], MDL);
531  }
532 #if defined(REPORT_HASH_PERFORMANCE)
533  log_info("Server-Config Option name hash: %s",
534  option_name_hash_report(server_universe.name_hash));
535  log_info("Server-Config Option code hash: %s",
536  option_code_hash_report(server_universe.code_hash));
537 #endif
538 
539  /* Add the server and agent option spaces to the option space hash. */
540  universe_hash_add (universe_hash,
542  universe_hash_add (universe_hash,
544 
545  /* Make the server universe the configuration option universe. */
547 
548  code = SV_VENDOR_OPTION_SPACE;
549  option_code_hash_lookup(&vendor_cfg_option, server_universe.code_hash,
550  &code, 0, MDL);
551 }
struct option_cache * lookup_hashed_option(struct universe *universe, struct option_state *options, unsigned code)
Definition: options.c:2480
const char * name
Definition: tree.h:302
#define SV_DDNS_GUARD_ID_MUST_MATCH
Definition: dhcpd.h:817
#define DHO_DHCP_AGENT_OPTIONS
Definition: dhcp.h:157
void save_linked_option(struct universe *universe, struct option_state *options, struct option_cache *oc, isc_boolean_t appendp)
Definition: options.c:3833
void(* save_func)(struct universe *, struct option_state *, struct option_cache *, isc_boolean_t)
Definition: tree.h:306
void(* foreach)(struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *, void(*)(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *))
Definition: tree.h:308
u_int32_t(* get_length)(const unsigned char *)
Definition: tree.h:332
#define SV_BIND_LOCAL_ADDRESS6
Definition: dhcpd.h:821
void delete_linked_option(struct universe *universe, struct option_state *options, int code)
Definition: options.c:3913
int hashed_option_space_encapsulate(struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *universe)
Definition: options.c:3211
int tag_size
Definition: tree.h:334
#define PLM_EXACT
Definition: dhcpd.h:876
#define MDL
Definition: omapip.h:567
int(* option_state_dereference)(struct universe *, struct option_state *, const char *, int)
Definition: tree.h:320
unsigned end
Definition: tree.h:335
#define PLM_PREFER
Definition: dhcpd.h:875
struct universe dhcp_universe
void(* delete_func)(struct universe *universe, struct option_state *, int)
Definition: tree.h:318
#define SV_RELEASE_ON_ROAM
Definition: dhcpd.h:819
struct universe agent_universe
Definition: stables.c:165
struct option_cache *(* lookup_func)(struct universe *, struct option_state *, unsigned)
Definition: tree.h:303
unsigned site_code_min
Definition: tree.h:335
#define SERVER_HASH_SIZE
Definition: dhcpd.h:217
int(* decode)(struct option_state *, const unsigned char *, unsigned, struct universe *)
Definition: tree.h:323
failover_option_t null_failover_option
Definition: tree.h:301
const char * binding_state_names[]
Definition: stables.c:161
void log_fatal(const char *,...) __attribute__((__format__(__printf__
#define SV_SERVER_ID_CHECK
Definition: dhcpd.h:805
const char * dhcp_flink_state_names[]
int parse_option_buffer(struct option_state *options, const unsigned char *buffer, unsigned length, struct universe *universe)
Definition: options.c:117
#define PLM_MINIMUM
Definition: dhcpd.h:877
u_int32_t fto_allowed[]
struct enumeration ddns_styles
Definition: stables.c:361
universe_hash_t * universe_hash
Definition: tables.c:966
#define AGENT_HASH_SIZE
Definition: dhcpd.h:207
failover_option_t skip_failover_option
int concat_duplicates
Definition: tree.h:342
int linked_option_state_dereference(struct universe *universe, struct option_state *state, const char *file, int line)
Definition: options.c:3967
struct universe * config_universe
Definition: tables.c:974
Definition: tree.h:345
void delete_hashed_option(struct universe *universe, struct option_state *options, int code)
Definition: options.c:2880
void(* store_length)(unsigned char *, u_int32_t)
Definition: tree.h:333
void linked_option_space_foreach(struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *u, void *stuff, void(*func)(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *))
Definition: options.c:3978
#define PLM_IGNORE
Definition: dhcpd.h:874
unsigned code
Definition: tree.h:349
#define PLM_MAXIMUM
Definition: dhcpd.h:878
#define SV_ECHO_CLIENT_ID
Definition: dhcpd.h:804
void save_hashed_option(struct universe *universe, struct option_state *options, struct option_cache *oc, isc_boolean_t appendp)
Definition: options.c:2801
option_name_hash_t * name_hash
Definition: tree.h:336
int linked_option_space_encapsulate(struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *universe)
Definition: options.c:3877
int index
Definition: tree.h:339
int hashed_option_state_dereference(struct universe *universe, struct option_state *state, const char *file, int line)
Definition: options.c:2965
const char * name
Definition: tree.h:346
#define SV_DHCPV6_SET_TEE_TIMES
Definition: dhcpd.h:807
struct enumeration syslog_enum
Definition: stables.c:446
int int log_info(const char *,...) __attribute__((__format__(__printf__
struct enumeration prefix_length_modes
Definition: stables.c:376
void initialize_server_option_spaces()
Definition: stables.c:452
struct enumeration_value syslog_values[]
Definition: stables.c:382
void putUChar(unsigned char *, u_int32_t)
Definition: convert.c:102
struct universe ** universes
Definition: tables.c:967
u_int32_t getUChar(const unsigned char *)
struct enumeration_value ddns_styles_values[]
Definition: stables.c:353
#define SV_ABANDON_LEASE_TIME
Definition: dhcpd.h:808
struct failover_option_info ft_options[]
#define SV_DDNS_OTHER_GUARD_IS_DYNAMIC
Definition: dhcpd.h:818
int length_size
Definition: tree.h:334
struct universe server_universe
Definition: stables.c:176
int(* encapsulate)(struct data_string *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *)
Definition: tree.h:325
u_int32_t(* get_tag)(const unsigned char *)
Definition: tree.h:330
void hashed_option_space_foreach(struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *u, void *stuff, void(*func)(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *))
Definition: options.c:3796
#define SV_LOCAL_ADDRESS6
Definition: dhcpd.h:820
#define SV_PREFIX_LEN_MODE
Definition: dhcpd.h:806
option_code_hash_t * code_hash
Definition: tree.h:337
int ft_sizes[]
struct option * enc_opt
Definition: tree.h:338
struct option * vendor_cfg_option
Definition: options.c:34
void(* store_tag)(unsigned char *, u_int32_t)
Definition: tree.h:331
#define SV_CHECK_SECS_BYTE_ORDER
Definition: dhcpd.h:814
#define SV_DDNS_DUAL_STACK_MIXED_MODE
Definition: dhcpd.h:816
int universe_count
Definition: tables.c:968
#define SV_VENDOR_OPTION_SPACE
Definition: dhcpd.h:729
struct option_cache * lookup_linked_option(struct universe *universe, struct option_state *options, unsigned code)
Definition: options.c:3942
struct enumeration_value prefix_length_modes_values[]
Definition: stables.c:367