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