1999-11-14 00:36:51 +00:00
|
|
|
/* stables.c
|
|
|
|
|
|
|
|
Tables of information only used by server... */
|
|
|
|
|
|
|
|
/*
|
2005-03-17 20:15:29 +00:00
|
|
|
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
|
|
|
* Copyright (c) 1995-2003 by Internet Software Consortium
|
1999-11-14 00:36:51 +00:00
|
|
|
*
|
2005-03-17 20:15:29 +00:00
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
1999-11-14 00:36:51 +00:00
|
|
|
*
|
2005-03-17 20:15:29 +00:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
|
|
|
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
1999-11-14 00:36:51 +00:00
|
|
|
*
|
2005-03-17 20:15:29 +00:00
|
|
|
* Internet Systems Consortium, Inc.
|
|
|
|
* 950 Charter Street
|
|
|
|
* Redwood City, CA 94063
|
|
|
|
* <info@isc.org>
|
|
|
|
* http://www.isc.org/
|
2000-03-17 04:00:32 +00:00
|
|
|
*
|
2005-03-17 20:15:29 +00:00
|
|
|
* This software has been written for Internet Systems Consortium
|
2000-03-17 04:00:32 +00:00
|
|
|
* by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
|
2005-03-17 20:15:29 +00:00
|
|
|
* To learn more about Internet Systems Consortium, see
|
2000-03-17 04:00:32 +00:00
|
|
|
* ``http://www.isc.org/''. To learn more about Vixie Enterprises,
|
|
|
|
* see ``http://www.vix.com''. To learn more about Nominum, Inc., see
|
|
|
|
* ``http://www.nominum.com''.
|
1999-11-14 00:36:51 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef lint
|
|
|
|
static char copyright[] =
|
2006-10-27 22:54:13 +00:00
|
|
|
"$Id: stables.c,v 1.34 2006/10/27 22:54:13 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
|
1999-11-14 00:36:51 +00:00
|
|
|
#endif /* not lint */
|
|
|
|
|
|
|
|
#include "dhcpd.h"
|
|
|
|
|
|
|
|
#if defined (FAILOVER_PROTOCOL)
|
1999-11-23 22:24:49 +00:00
|
|
|
|
|
|
|
/* This is used to indicate some kind of failure when generating a
|
|
|
|
failover option. */
|
|
|
|
failover_option_t null_failover_option = { 0, 0 };
|
2000-01-05 18:23:44 +00:00
|
|
|
failover_option_t skip_failover_option = { 0, 0 };
|
1999-11-23 22:24:49 +00:00
|
|
|
|
|
|
|
/* Information about failover options, for printing, encoding
|
|
|
|
and decoding. */
|
1999-11-20 18:36:32 +00:00
|
|
|
struct failover_option_info ft_options [] =
|
1999-11-14 00:36:51 +00:00
|
|
|
{
|
1999-11-20 18:36:32 +00:00
|
|
|
{ 0, "unused", FT_UNDEF, 0, 0, 0 },
|
2006-04-27 17:26:42 +00:00
|
|
|
{ FTO_ADDRESSES_TRANSFERRED, "addresses-transferred", FT_UINT32, 1,
|
|
|
|
FM_OFFSET(addresses_transferred), FTB_ADDRESSES_TRANSFERRED },
|
|
|
|
{ FTO_ASSIGNED_IP_ADDRESS, "assigned-IP-address", FT_IPADDR, 1,
|
|
|
|
FM_OFFSET(assigned_addr), FTB_ASSIGNED_IP_ADDRESS },
|
|
|
|
{ FTO_BINDING_STATUS, "binding-status", FT_UINT8, 1,
|
|
|
|
FM_OFFSET(binding_status), FTB_BINDING_STATUS },
|
|
|
|
{ FTO_CLIENT_IDENTIFIER, "client-identifier", FT_BYTES, 0,
|
|
|
|
FM_OFFSET(client_identifier), FTB_CLIENT_IDENTIFIER },
|
|
|
|
{ FTO_CHADDR, "client-hardware-address", FT_BYTES, 0,
|
|
|
|
FM_OFFSET(chaddr), FTB_CHADDR },
|
|
|
|
{ FTO_CLTT, "client-last-transaction-time", FT_UINT32, 1,
|
|
|
|
FM_OFFSET(cltt), FTB_CLTT },
|
|
|
|
{ FTO_REPLY_OPTIONS, "client-reply-options", FT_BYTES, 0,
|
|
|
|
FM_OFFSET(reply_options), FTB_REPLY_OPTIONS },
|
|
|
|
{ FTO_REQUEST_OPTIONS, "client-request-options", FT_BYTES, 0,
|
|
|
|
FM_OFFSET(request_options), FTB_REQUEST_OPTIONS },
|
|
|
|
{ FTO_DDNS, "DDNS", FT_DDNS, 1, FM_OFFSET(ddns), FTB_DDNS },
|
|
|
|
{ FTO_DELAYED_SERVICE, "delayed-service", FT_UINT8, 1,
|
|
|
|
FM_OFFSET(delayed_service), FTB_DELAYED_SERVICE },
|
|
|
|
{ FTO_HBA, "hash-bucket-assignment", FT_BYTES, 0,
|
|
|
|
FM_OFFSET(hba), FTB_HBA },
|
|
|
|
{ FTO_IP_FLAGS, "IP-flags", FT_UINT16, 1,
|
|
|
|
FM_OFFSET(ip_flags), FTB_IP_FLAGS },
|
|
|
|
{ FTO_LEASE_EXPIRY, "lease-expiration-time", FT_UINT32, 1,
|
|
|
|
FM_OFFSET(expiry), FTB_LEASE_EXPIRY },
|
|
|
|
{ FTO_MAX_UNACKED, "max-unacked-bndupd", FT_UINT32, 1,
|
|
|
|
FM_OFFSET(max_unacked), FTB_MAX_UNACKED },
|
|
|
|
{ FTO_MCLT, "MCLT", FT_UINT32, 1, FM_OFFSET(mclt), FTB_MCLT },
|
|
|
|
{ FTO_MESSAGE, "message", FT_TEXT, 0,
|
|
|
|
FM_OFFSET(message), FTB_MESSAGE },
|
|
|
|
{ FTO_MESSAGE_DIGEST, "message-digest", FT_BYTES, 0,
|
|
|
|
FM_OFFSET(message_digest), FTB_MESSAGE_DIGEST },
|
|
|
|
{ FTO_POTENTIAL_EXPIRY, "potential-expiration-time", FT_UINT32, 1,
|
|
|
|
FM_OFFSET(potential_expiry), FTB_POTENTIAL_EXPIRY },
|
|
|
|
{ FTO_RECEIVE_TIMER, "receive-timer", FT_UINT32, 1,
|
|
|
|
FM_OFFSET(receive_timer), FTB_RECEIVE_TIMER },
|
|
|
|
{ FTO_PROTOCOL_VERSION, "protocol-version", FT_UINT8, 1,
|
|
|
|
FM_OFFSET(protocol_version), FTB_PROTOCOL_VERSION },
|
|
|
|
{ FTO_REJECT_REASON, "reject-reason", FT_UINT8, 1,
|
|
|
|
FM_OFFSET(reject_reason), FTB_REJECT_REASON },
|
|
|
|
{ FTO_RELATIONSHIP_NAME, "relationship-name", FT_BYTES, 0,
|
|
|
|
FM_OFFSET(relationship_name), FTB_RELATIONSHIP_NAME },
|
|
|
|
{ FTO_SERVER_FLAGS, "server-flags", FT_UINT8, 1,
|
|
|
|
FM_OFFSET(server_flags), FTB_SERVER_FLAGS },
|
|
|
|
{ FTO_SERVER_STATE, "server-state", FT_UINT8, 1,
|
|
|
|
FM_OFFSET(server_state), FTB_SERVER_STATE },
|
|
|
|
{ FTO_STOS, "start-time-of-state", FT_UINT32, 1,
|
|
|
|
FM_OFFSET(stos), FTB_STOS },
|
|
|
|
{ FTO_TLS_REPLY, "TLS-reply", FT_UINT8, 1,
|
|
|
|
FM_OFFSET(tls_reply), FTB_TLS_REPLY },
|
|
|
|
{ FTO_TLS_REQUEST, "TLS-request", FT_UINT8, 1,
|
|
|
|
FM_OFFSET(tls_request), FTB_TLS_REQUEST },
|
|
|
|
{ FTO_VENDOR_CLASS, "vendor-class-identifier", FT_BYTES, 0,
|
|
|
|
FM_OFFSET(vendor_class), FTB_VENDOR_CLASS },
|
|
|
|
{ FTO_VENDOR_OPTIONS, "vendor-specific-options", FT_BYTES, 0,
|
|
|
|
FM_OFFSET(vendor_options), FTB_VENDOR_OPTIONS }
|
1999-11-14 00:36:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* These are really options that make sense for a particular request - if
|
|
|
|
some other option comes in, we're not going to use it, so we can just
|
|
|
|
discard it. Note that the message-digest option is allowed for all
|
|
|
|
message types, but is not saved - it's just used to validate the message
|
|
|
|
and then discarded - so it's not mentioned here. */
|
|
|
|
|
|
|
|
u_int32_t fto_allowed [] = {
|
|
|
|
0, /* 0 unused */
|
|
|
|
0, /* 1 POOLREQ */
|
|
|
|
FTB_ADDRESSES_TRANSFERRED, /* 2 POOLRESP */
|
|
|
|
(FTB_ASSIGNED_IP_ADDRESS | FTB_BINDING_STATUS | FTB_CLIENT_IDENTIFIER |
|
2006-04-27 17:26:42 +00:00
|
|
|
FTB_CHADDR | FTB_DDNS | FTB_IP_FLAGS | FTB_LEASE_EXPIRY |
|
|
|
|
FTB_POTENTIAL_EXPIRY | FTB_STOS | FTB_CLTT | FTB_REQUEST_OPTIONS |
|
|
|
|
FTB_REPLY_OPTIONS), /* 3 BNDUPD */
|
1999-11-14 00:36:51 +00:00
|
|
|
(FTB_ASSIGNED_IP_ADDRESS | FTB_BINDING_STATUS | FTB_CLIENT_IDENTIFIER |
|
2006-04-27 17:26:42 +00:00
|
|
|
FTB_CHADDR | FTB_DDNS | FTB_IP_FLAGS | FTB_LEASE_EXPIRY |
|
|
|
|
FTB_POTENTIAL_EXPIRY | FTB_STOS | FTB_CLTT | FTB_REQUEST_OPTIONS |
|
|
|
|
FTB_REPLY_OPTIONS | FTB_REJECT_REASON | FTB_MESSAGE), /* 4 BNDACK */
|
|
|
|
(FTB_RELATIONSHIP_NAME | FTB_MAX_UNACKED | FTB_RECEIVE_TIMER |
|
1999-11-14 00:36:51 +00:00
|
|
|
FTB_VENDOR_CLASS | FTB_PROTOCOL_VERSION | FTB_TLS_REQUEST |
|
|
|
|
FTB_MCLT | FTB_HBA), /* 5 CONNECT */
|
2006-04-27 17:26:42 +00:00
|
|
|
(FTB_RELATIONSHIP_NAME | FTB_MAX_UNACKED | FTB_RECEIVE_TIMER |
|
1999-11-14 00:36:51 +00:00
|
|
|
FTB_VENDOR_CLASS | FTB_PROTOCOL_VERSION | FTB_TLS_REPLY |
|
|
|
|
FTB_REJECT_REASON | FTB_MESSAGE), /* CONNECTACK */
|
2006-04-27 17:26:42 +00:00
|
|
|
0, /* 7 UPDREQALL */
|
2000-08-31 04:40:24 +00:00
|
|
|
0, /* 8 UPDDONE */
|
2006-04-27 17:26:42 +00:00
|
|
|
0, /* 9 UPDREQ */
|
1999-11-23 22:24:49 +00:00
|
|
|
(FTB_SERVER_STATE | FTB_SERVER_FLAGS | FTB_STOS), /* 10 STATE */
|
1999-11-14 00:36:51 +00:00
|
|
|
0, /* 11 CONTACT */
|
|
|
|
(FTB_REJECT_REASON | FTB_MESSAGE) /* 12 DISCONNECT */
|
|
|
|
};
|
|
|
|
|
1999-11-23 22:24:49 +00:00
|
|
|
/* Sizes of the various types. */
|
1999-11-14 00:36:51 +00:00
|
|
|
int ft_sizes [] = {
|
|
|
|
1, /* FT_UINT8 */
|
|
|
|
4, /* FT_IPADDR */
|
|
|
|
4, /* FT_UINT32 */
|
|
|
|
1, /* FT_BYTES */
|
1999-11-23 22:24:49 +00:00
|
|
|
1, /* FT_TEXT_OR_BYTES */
|
1999-11-14 00:36:51 +00:00
|
|
|
0, /* FT_DDNS */
|
1999-11-23 22:24:49 +00:00
|
|
|
0, /* FT_DDNS1 */
|
1999-11-14 00:36:51 +00:00
|
|
|
2, /* FT_UINT16 */
|
|
|
|
1, /* FT_TEXT */
|
|
|
|
0, /* FT_UNDEF */
|
|
|
|
0, /* FT_DIGEST */
|
|
|
|
};
|
1999-11-20 18:36:32 +00:00
|
|
|
|
1999-11-23 22:24:49 +00:00
|
|
|
/* Names of the various failover link states. */
|
|
|
|
const char *dhcp_flink_state_names [] = {
|
1999-11-20 18:36:32 +00:00
|
|
|
"invalid state 0",
|
|
|
|
"startup",
|
|
|
|
"message length wait",
|
|
|
|
"message wait",
|
|
|
|
"disconnected"
|
|
|
|
};
|
1999-11-14 00:36:51 +00:00
|
|
|
#endif /* FAILOVER_PROTOCOL */
|
|
|
|
|
2000-06-02 21:27:21 +00:00
|
|
|
/* Failover binding state names. These are used even if there is no
|
|
|
|
failover protocol support. */
|
|
|
|
const char *binding_state_names [] = {
|
|
|
|
"free", "active", "expired", "released", "abandoned",
|
2006-04-27 17:26:42 +00:00
|
|
|
"reset", "backup" };
|
2000-06-02 21:27:21 +00:00
|
|
|
|
1999-11-14 00:36:51 +00:00
|
|
|
struct universe agent_universe;
|
2006-06-01 20:23:18 +00:00
|
|
|
static struct option agent_options[] = {
|
|
|
|
{ "circuit-id", "X", &agent_universe, 1, 1 },
|
|
|
|
{ "remote-id", "X", &agent_universe, 2, 1 },
|
|
|
|
{ "agent-id", "I", &agent_universe, 3, 1 },
|
|
|
|
{ "DOCSIS-device-class", "L", &agent_universe, 4, 1 },
|
2006-07-17 15:16:43 +00:00
|
|
|
{ "link-selection", "I", &agent_universe, 5, 1 },
|
2006-06-01 20:23:18 +00:00
|
|
|
{ NULL, NULL, NULL, 0, 0 }
|
1999-11-14 00:36:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct universe server_universe;
|
2006-06-01 20:23:18 +00:00
|
|
|
static struct option server_options[] = {
|
|
|
|
{ "default-lease-time", "T", &server_universe, 1, 1 },
|
|
|
|
{ "max-lease-time", "T", &server_universe, 2, 1 },
|
|
|
|
{ "min-lease-time", "T", &server_universe, 3, 1 },
|
|
|
|
{ "dynamic-bootp-lease-cutoff", "T", &server_universe, 4, 1 },
|
|
|
|
{ "dynamic-bootp-lease-length", "L", &server_universe, 5, 1 },
|
|
|
|
{ "boot-unknown-clients", "f", &server_universe, 6, 1 },
|
|
|
|
{ "dynamic-bootp", "f", &server_universe, 7, 1 },
|
|
|
|
{ "allow-bootp", "f", &server_universe, 8, 1 },
|
|
|
|
{ "allow-booting", "f", &server_universe, 9, 1 },
|
|
|
|
{ "one-lease-per-client", "f", &server_universe, 10, 1 },
|
|
|
|
{ "get-lease-hostnames", "f", &server_universe, 11, 1 },
|
|
|
|
{ "use-host-decl-names", "f", &server_universe, 12, 1 },
|
|
|
|
{ "use-lease-addr-for-default-route", "f",
|
|
|
|
&server_universe, 13, 1 },
|
|
|
|
{ "min-secs", "B", &server_universe, 14, 1 },
|
|
|
|
{ "filename", "t", &server_universe, 15, 1 },
|
|
|
|
{ "server-name", "t", &server_universe, 16, 1 },
|
|
|
|
{ "next-server", "I", &server_universe, 17, 1 },
|
|
|
|
{ "authoritative", "f", &server_universe, 18, 1 },
|
|
|
|
{ "vendor-option-space", "U", &server_universe, 19, 1 },
|
|
|
|
{ "always-reply-rfc1048", "f", &server_universe, 20, 1 },
|
|
|
|
{ "site-option-space", "X", &server_universe, 21, 1 },
|
|
|
|
{ "always-broadcast", "f", &server_universe, 22, 1 },
|
|
|
|
{ "ddns-domainname", "t", &server_universe, 23, 1 },
|
|
|
|
{ "ddns-hostname", "t", &server_universe, 24, 1 },
|
|
|
|
{ "ddns-rev-domainname", "t", &server_universe, 25, 1 },
|
|
|
|
{ "lease-file-name", "t", &server_universe, 26, 1 },
|
|
|
|
{ "pid-file-name", "t", &server_universe, 27, 1 },
|
|
|
|
{ "duplicates", "f", &server_universe, 28, 1 },
|
|
|
|
{ "declines", "f", &server_universe, 29, 1 },
|
|
|
|
{ "ddns-updates", "f", &server_universe, 30, 1 },
|
|
|
|
{ "omapi-port", "S", &server_universe, 31, 1 },
|
|
|
|
{ "local-port", "S", &server_universe, 32, 1 },
|
|
|
|
{ "limited-broadcast-address", "I", &server_universe, 33, 1 },
|
|
|
|
{ "remote-port", "S", &server_universe, 34, 1 },
|
|
|
|
{ "local-address", "I", &server_universe, 35, 1 },
|
|
|
|
{ "omapi-key", "d", &server_universe, 36, 1 },
|
|
|
|
{ "stash-agent-options", "f", &server_universe, 37, 1 },
|
|
|
|
{ "ddns-ttl", "T", &server_universe, 38, 1 },
|
|
|
|
{ "ddns-update-style", "Nddns-styles.", &server_universe, 39, 1 },
|
|
|
|
{ "client-updates", "f", &server_universe, 40, 1 },
|
|
|
|
{ "update-optimization", "f", &server_universe, 41, 1 },
|
|
|
|
{ "ping-check", "f", &server_universe, 42, 1 },
|
|
|
|
{ "update-static-leases", "f", &server_universe, 43, 1 },
|
|
|
|
{ "log-facility", "Nsyslog-facilities.",
|
|
|
|
&server_universe, 44, 1 },
|
|
|
|
{ "do-forward-updates", "f", &server_universe, 45, 1 },
|
|
|
|
{ "ping-timeout", "T", &server_universe, 46, 1 },
|
2006-06-15 17:49:49 +00:00
|
|
|
{ "infinite-is-reserved", "f", &server_universe, 47, 1 },
|
2006-07-19 17:14:55 +00:00
|
|
|
{ "update-conflict-detection", "f", &server_universe, 48, 1 },
|
2006-07-31 23:17:24 +00:00
|
|
|
{ "adaptive-lease-time-threshold", "B", &server_universe, 50, 1 },
|
2006-06-01 20:23:18 +00:00
|
|
|
{ NULL, NULL, NULL, 0, 0 }
|
1999-11-14 00:36:51 +00:00
|
|
|
};
|
|
|
|
|
2000-12-29 06:51:21 +00:00
|
|
|
struct enumeration_value ddns_styles_values [] = {
|
|
|
|
{ "none", 0 },
|
|
|
|
{ "ad-hoc", 1 },
|
|
|
|
{ "interim", 2 },
|
|
|
|
{ (char *)0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct enumeration ddns_styles = {
|
|
|
|
(struct enumeration *)0,
|
|
|
|
"ddns-styles",
|
|
|
|
ddns_styles_values
|
|
|
|
};
|
|
|
|
|
2001-01-25 08:37:03 +00:00
|
|
|
struct enumeration_value syslog_values [] = {
|
|
|
|
#if defined (LOG_KERN)
|
|
|
|
{ "kern", LOG_KERN },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_USER)
|
|
|
|
{ "user", LOG_USER },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_MAIL)
|
|
|
|
{ "mail", LOG_MAIL },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_DAEMON)
|
|
|
|
{ "daemon", LOG_DAEMON },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_AUTH)
|
|
|
|
{ "auth", LOG_AUTH },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_SYSLOG)
|
|
|
|
{ "syslog", LOG_SYSLOG },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_LPR)
|
|
|
|
{ "lpr", LOG_LPR },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_NEWS)
|
|
|
|
{ "news", LOG_NEWS },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_UUCP)
|
|
|
|
{ "uucp", LOG_UUCP },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_CRON)
|
|
|
|
{ "cron", LOG_CRON },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_AUTHPRIV)
|
|
|
|
{ "authpriv", LOG_AUTHPRIV },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_FTP)
|
|
|
|
{ "ftp", LOG_FTP },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_LOCAL0)
|
|
|
|
{ "local0", LOG_LOCAL0 },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_LOCAL1)
|
|
|
|
{ "local1", LOG_LOCAL1 },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_LOCAL2)
|
|
|
|
{ "local2", LOG_LOCAL2 },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_LOCAL3)
|
|
|
|
{ "local3", LOG_LOCAL3 },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_LOCAL4)
|
|
|
|
{ "local4", LOG_LOCAL4 },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_LOCAL5)
|
|
|
|
{ "local5", LOG_LOCAL5 },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_LOCAL6)
|
|
|
|
{ "local6", LOG_LOCAL6 },
|
|
|
|
#endif
|
|
|
|
#if defined (LOG_LOCAL7)
|
|
|
|
{ "local7", LOG_LOCAL7 },
|
|
|
|
#endif
|
|
|
|
{ (char *)0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct enumeration syslog_enum = {
|
|
|
|
(struct enumeration *)0,
|
|
|
|
"syslog-facilities",
|
|
|
|
syslog_values
|
|
|
|
};
|
|
|
|
|
1999-11-14 00:36:51 +00:00
|
|
|
void initialize_server_option_spaces()
|
|
|
|
{
|
|
|
|
int i;
|
2006-06-01 20:23:18 +00:00
|
|
|
unsigned code;
|
1999-11-14 00:36:51 +00:00
|
|
|
|
|
|
|
/* Set up the Relay Agent Information Option suboption space... */
|
|
|
|
agent_universe.name = "agent";
|
|
|
|
agent_universe.option_state_dereference =
|
2000-10-10 23:09:17 +00:00
|
|
|
linked_option_state_dereference;
|
|
|
|
agent_universe.lookup_func = lookup_linked_option;
|
|
|
|
agent_universe.save_func = save_linked_option;
|
|
|
|
agent_universe.delete_func = delete_linked_option;
|
|
|
|
agent_universe.encapsulate = linked_option_space_encapsulate;
|
|
|
|
agent_universe.foreach = linked_option_space_foreach;
|
|
|
|
agent_universe.decode = parse_option_buffer;
|
1999-11-14 00:36:51 +00:00
|
|
|
agent_universe.index = universe_count++;
|
|
|
|
agent_universe.length_size = 1;
|
|
|
|
agent_universe.tag_size = 1;
|
2006-06-01 20:23:18 +00:00
|
|
|
agent_universe.get_tag = getUChar;
|
1999-11-14 00:36:51 +00:00
|
|
|
agent_universe.store_tag = putUChar;
|
2006-06-01 20:23:18 +00:00
|
|
|
agent_universe.get_length = getUChar;
|
1999-11-14 00:36:51 +00:00
|
|
|
agent_universe.store_length = putUChar;
|
|
|
|
universes [agent_universe.index] = &agent_universe;
|
2006-06-01 20:23:18 +00:00
|
|
|
if (!option_name_new_hash(&agent_universe.name_hash,
|
|
|
|
AGENT_HASH_SIZE, MDL) ||
|
|
|
|
!option_code_new_hash(&agent_universe.code_hash,
|
|
|
|
AGENT_HASH_SIZE, MDL))
|
1999-11-14 00:36:51 +00:00
|
|
|
log_fatal ("Can't allocate agent option hash table.");
|
2006-06-01 20:23:18 +00:00
|
|
|
for (i = 0 ; agent_options[i].name ; i++) {
|
|
|
|
option_code_hash_add(agent_universe.code_hash,
|
|
|
|
&agent_options[i].code, 0,
|
|
|
|
&agent_options[i], MDL);
|
|
|
|
option_name_hash_add(agent_universe.name_hash,
|
|
|
|
agent_options[i].name, 0,
|
|
|
|
&agent_options[i], MDL);
|
1999-11-14 00:36:51 +00:00
|
|
|
}
|
2006-10-27 22:54:13 +00:00
|
|
|
#if defined(REPORT_HASH_PERFORMANCE)
|
|
|
|
log_info("Relay Agent name hash: %s",
|
|
|
|
option_name_hash_report(agent_universe.name_hash));
|
|
|
|
log_info("Relay Agent code hash: %s",
|
|
|
|
option_code_hash_report(agent_universe.code_hash));
|
|
|
|
#endif
|
2006-06-01 20:23:18 +00:00
|
|
|
code = DHO_DHCP_AGENT_OPTIONS;
|
|
|
|
option_code_hash_lookup(&agent_universe.enc_opt,
|
|
|
|
dhcp_universe.code_hash, &code, 0, MDL);
|
1999-11-14 00:36:51 +00:00
|
|
|
|
|
|
|
/* Set up the server option universe... */
|
|
|
|
server_universe.name = "server";
|
|
|
|
server_universe.lookup_func = lookup_hashed_option;
|
|
|
|
server_universe.option_state_dereference =
|
|
|
|
hashed_option_state_dereference;
|
|
|
|
server_universe.save_func = save_hashed_option;
|
|
|
|
server_universe.delete_func = delete_hashed_option;
|
|
|
|
server_universe.encapsulate = hashed_option_space_encapsulate;
|
2000-10-10 23:09:17 +00:00
|
|
|
server_universe.foreach = hashed_option_space_foreach;
|
2006-06-01 20:23:18 +00:00
|
|
|
server_universe.length_size = 1; /* Never used ... */
|
|
|
|
server_universe.tag_size = 4;
|
1999-11-14 00:36:51 +00:00
|
|
|
server_universe.store_tag = putUChar;
|
|
|
|
server_universe.store_length = putUChar;
|
|
|
|
server_universe.index = universe_count++;
|
|
|
|
universes [server_universe.index] = &server_universe;
|
2006-06-01 20:23:18 +00:00
|
|
|
if (!option_name_new_hash(&server_universe.name_hash,
|
|
|
|
SERVER_HASH_SIZE, MDL) ||
|
|
|
|
!option_code_new_hash(&server_universe.code_hash,
|
|
|
|
SERVER_HASH_SIZE, MDL))
|
1999-11-14 00:36:51 +00:00
|
|
|
log_fatal ("Can't allocate server option hash table.");
|
2006-06-01 20:23:18 +00:00
|
|
|
for (i = 0 ; server_options[i].name ; i++) {
|
|
|
|
option_code_hash_add(server_universe.code_hash,
|
|
|
|
&server_options[i].code, 0,
|
|
|
|
&server_options[i], MDL);
|
|
|
|
option_name_hash_add(server_universe.name_hash,
|
|
|
|
server_options[i].name, 0,
|
|
|
|
&server_options[i], MDL);
|
1999-11-14 00:36:51 +00:00
|
|
|
}
|
2006-10-27 22:54:13 +00:00
|
|
|
#if defined(REPORT_HASH_PERFORMANCE)
|
|
|
|
log_info("Server-Config Option name hash: %s",
|
|
|
|
option_name_hash_report(server_universe.name_hash));
|
|
|
|
log_info("Server-Config Option code hash: %s",
|
|
|
|
option_code_hash_report(server_universe.code_hash));
|
|
|
|
#endif
|
1999-11-14 00:36:51 +00:00
|
|
|
|
|
|
|
/* Add the server and agent option spaces to the option space hash. */
|
2000-05-16 23:03:49 +00:00
|
|
|
universe_hash_add (universe_hash,
|
|
|
|
agent_universe.name, 0, &agent_universe, MDL);
|
|
|
|
universe_hash_add (universe_hash,
|
|
|
|
server_universe.name, 0, &server_universe, MDL);
|
2000-02-02 17:10:43 +00:00
|
|
|
|
|
|
|
/* Make the server universe the configuration option universe. */
|
|
|
|
config_universe = &server_universe;
|
2006-06-01 20:23:18 +00:00
|
|
|
|
|
|
|
code = SV_VENDOR_OPTION_SPACE;
|
|
|
|
option_code_hash_lookup(&vendor_cfg_option, server_universe.code_hash,
|
|
|
|
&code, 0, MDL);
|
1999-11-14 00:36:51 +00:00
|
|
|
}
|