summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorTed Lemon <source@isc.org>1999-11-20 18:36:32 +0000
committerTed Lemon <source@isc.org>1999-11-20 18:36:32 +0000
commitd9eefc5dec0bd2986d1465276363f7b97d92b69a (patch)
tree5c8396c6474892bf2cb030ac6d4c88d9a63429fd /server
parentb3677620b6bebff760d40ab7d73f918bfe66260a (diff)
downloadisc-dhcp-d9eefc5dec0bd2986d1465276363f7b97d92b69a.tar.gz
Mass commit for Brian Murrell.
Diffstat (limited to 'server')
-rw-r--r--server/confpars.c10
-rw-r--r--server/dhcp.c199
-rw-r--r--server/dhcpd.conf.cat5554
-rw-r--r--server/failover.c249
-rw-r--r--server/mdb.c21
-rw-r--r--server/omapi.c4
-rw-r--r--server/stables.c129
7 files changed, 666 insertions, 500 deletions
diff --git a/server/confpars.c b/server/confpars.c
index 5f10fb4c..85799858 100644
--- a/server/confpars.c
+++ b/server/confpars.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: confpars.c,v 1.91 1999/11/14 00:17:47 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: confpars.c,v 1.92 1999/11/20 18:36:27 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -589,7 +589,7 @@ void parse_failover_peer (cfile, group, type)
if (type != SHARED_NET_DECL && type != ROOT_GROUP) {
parse_warn (cfile,
- "failover peer statements not in shared-network%s"
+ "failover peer statements not in shared-network%s",
" declaration or at top level.");
skip_to_semi (cfile);
return;
@@ -1610,7 +1610,7 @@ void parse_group_declaration (cfile, group)
int declaration = 0;
struct group_object *t;
isc_result_t status;
- char *name;
+ char *name = NULL;
int deletedp = 0;
int dynamicp = 0;
int staticp = 0;
@@ -2117,7 +2117,7 @@ void parse_address_range (cfile, group, type, pool)
pool -> permit_list &&
!pool -> permit_list -> next &&
(pool -> permit_list -> type ==
- permit_dynamic_bootp_clients))) {
+ permit_all_clients))) {
break;
}
last = pool;
@@ -2135,7 +2135,7 @@ void parse_address_range (cfile, group, type, pool)
log_fatal ("no memory for ad-hoc %s.",
"permit");
pool -> permit_list -> type =
- permit_dynamic_bootp_clients;
+ permit_all_clients;
}
if (share -> pools)
last -> next = pool;
diff --git a/server/dhcp.c b/server/dhcp.c
index 7cf151be..58ba31d8 100644
--- a/server/dhcp.c
+++ b/server/dhcp.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: dhcp.c,v 1.128 1999/11/14 00:22:29 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: dhcp.c,v 1.129 1999/11/20 18:36:28 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -70,19 +70,33 @@ void dhcpdiscover (packet)
struct packet *packet;
{
struct lease *lease;
- char msgbuf [1024];
+ char msgbuf [1024]; /* XXX */
TIME when;
-
- sprintf (msgbuf, "DHCPDISCOVER from %s via %s",
- print_hw_addr (packet -> raw -> htype,
- packet -> raw -> hlen,
- packet -> raw -> chaddr),
- (packet -> raw -> giaddr.s_addr
- ? inet_ntoa (packet -> raw -> giaddr)
- : packet -> interface -> name));
+ char *s;
lease = find_lease (packet, packet -> shared_network, 0);
+ if (lease && lease -> client_hostname &&
+ db_printable (lease -> client_hostname))
+ s = lease -> client_hostname;
+ else
+ s = (char *)0;
+
+ /* Say what we're doing... */
+ sprintf (msgbuf, "DHCPDISCOVER from %s %s%s%svia %s",
+ (packet -> raw -> htype
+ ? print_hw_addr (packet -> raw -> htype,
+ packet -> raw -> hlen,
+ packet -> raw -> chaddr),
+ : (lease
+ ? print_hex_1 (lease -> uid_len, lease -> uid,
+ lease -> uid_len)
+ : "<no identifier>")),
+ s ? "(" : "", s ? s : "", s ? ") " : "",
+ packet -> raw -> giaddr.s_addr
+ ? inet_ntoa (packet -> raw -> giaddr)
+ : packet -> interface -> name);
+
/* Sourceless packets don't make sense here. */
if (!packet -> shared_network) {
log_info ("Packet from unknown subnet: %s",
@@ -123,7 +137,8 @@ void dhcprequest (packet)
struct option_cache *oc;
struct data_string data;
int status;
- char msgbuf [1024];
+ char msgbuf [1024]; /* XXX */
+ char *s;
oc = lookup_option (&dhcp_universe, packet -> options,
DHO_DHCP_REQUESTED_ADDRESS);
@@ -150,14 +165,27 @@ void dhcprequest (packet)
else
lease = (struct lease *)0;
- sprintf (msgbuf, "DHCPREQUEST for %s from %s via %s",
+ if (lease && lease -> client_hostname &&
+ db_printable (lease -> client_hostname))
+ s = lease -> client_hostname;
+ else
+ s = (char *)0;
+
+ /* Say what we're doing... */
+ sprintf (msgbuf, "DHCPREQUEST for from %s %s%s%svia %s",
piaddr (cip),
- print_hw_addr (packet -> raw -> htype,
- packet -> raw -> hlen,
- packet -> raw -> chaddr),
- (packet -> raw -> giaddr.s_addr
+ (packet -> raw -> htype
+ ? print_hw_addr (packet -> raw -> htype,
+ packet -> raw -> hlen,
+ packet -> raw -> chaddr),
+ : (lease
+ ? print_hex_1 (lease -> uid_len, lease -> uid,
+ lease -> uid_len)
+ : "<no identifier>")),
+ s ? "(" : "", s ? s : "", s ? ") " : "",
+ packet -> raw -> giaddr.s_addr
? inet_ntoa (packet -> raw -> giaddr)
- : packet -> interface -> name));
+ : packet -> interface -> name);
/* If a client on a given network REQUESTs a lease on an
address on a different network, NAK it. If the Requested
@@ -297,15 +325,28 @@ void dhcprelease (packet)
}
- log_info ("DHCPRELEASE of %s from %s via %s (%sfound)",
- inet_ntoa (packet -> raw -> ciaddr),
- print_hw_addr (packet -> raw -> htype,
+ if (lease && lease -> client_hostname &&
+ db_printable (lease -> client_hostname))
+ s = lease -> client_hostname;
+ else
+ s = (char *)0;
+
+ /* Say what we're doing... */
+ log_info ("DHCPRELEASE of %s from %s %s%s%svia %s (%sfound)",
+ inet_ntoa (packet -> raw -> ciaddr),
+ (packet -> raw -> htype
+ ? print_hw_addr (packet -> raw -> htype,
packet -> raw -> hlen,
packet -> raw -> chaddr),
- packet -> raw -> giaddr.s_addr
- ? inet_ntoa (packet -> raw -> giaddr)
- : packet -> interface -> name,
- lease ? "" : "not ");
+ : (lease
+ ? print_hex_1 (lease -> uid_len, lease -> uid,
+ lease -> uid_len)
+ : "<no identifier>")),
+ s ? "(" : "", s ? s : "", s ? ") " : "",
+ packet -> raw -> giaddr.s_addr
+ ? inet_ntoa (packet -> raw -> giaddr)
+ : packet -> interface -> name,
+ lease ? "" : "not ");
/* If we found a lease, release it. */
if (lease && lease -> ends > cur_time)
@@ -323,6 +364,7 @@ void dhcpdecline (packet)
int ignorep;
int i;
const char *status;
+ char *s;
/* DHCPDECLINE must specify address. */
if (!(oc = lookup_option (&dhcp_universe, packet -> options,
@@ -372,15 +414,29 @@ void dhcpdecline (packet)
} else
status = " (ignored)";
- if (!ignorep)
- log_info ("DHCPDECLINE on %s from %s via %s%s",
+ if (!ignorep) {
+ char *s;
+ if (lease && lease -> client_hostname &&
+ db_printable (lease -> client_hostname))
+ s = lease -> client_hostname;
+ else
+ s = (char *)0;
+
+ log_info ("DHCPDECLINE of %s from %s %s%s%svia %s %s",
piaddr (cip),
- print_hw_addr (packet -> raw -> htype,
- packet -> raw -> hlen,
- packet -> raw -> chaddr),
+ (packet -> raw -> htype
+ ? print_hw_addr (packet -> raw -> htype,
+ packet -> raw -> hlen,
+ packet -> raw -> chaddr),
+ : (lease
+ ? print_hex_1 (lease -> uid_len, lease -> uid,
+ lease -> uid_len)
+ : "<no identifier>")),
+ s ? "(" : "", s ? s : "", s ? ") " : "",
packet -> raw -> giaddr.s_addr
? inet_ntoa (packet -> raw -> giaddr)
- : packet -> interface -> name, status);
+ : packet -> interface -> name,
+ status);
option_state_dereference (&options, "dhcpdecline");
}
@@ -922,18 +978,25 @@ void ack_lease (packet, lease, offer, when, msg)
(struct agent_options *)0;
}
- /* Get rid of any old expiry or release statements - by executing
- the statements below, we will be inserting new ones if there are
- any to insert. */
- if (lease -> on_expiry)
- executable_statement_dereference (&lease -> on_expiry,
- "ack_lease");
- if (lease -> on_commit)
- executable_statement_dereference (&lease -> on_commit,
- "ack_lease");
- if (lease -> on_release)
- executable_statement_dereference (&lease -> on_release,
- "ack_lease");
+ /* If we are offering a lease that is still currently valid, preserve
+ the events. We need to do this because if the client does not
+ REQUEST our offer, it will expire in 2 minutes, overriding the
+ expire time in the currently in force lease. We want the expire
+ events to be executed at that point. */
+ if (lease -> ends <= cur_time && offer != DHCPOFFER) {
+ /* Get rid of any old expiry or release statements - by
+ executing the statements below, we will be inserting new
+ ones if there are any to insert. */
+ if (lease -> on_expiry)
+ executable_statement_dereference (&lease -> on_expiry,
+ "ack_lease");
+ if (lease -> on_commit)
+ executable_statement_dereference (&lease -> on_commit,
+ "ack_lease");
+ if (lease -> on_release)
+ executable_statement_dereference (&lease -> on_release,
+ "ack_lease");
+ }
/* Execute statements in scope starting with the subnet scope. */
execute_statements_in_scope (packet, lease,
@@ -1352,20 +1415,6 @@ void ack_lease (packet, lease, offer, when, msg)
}
}
- /* Do the DDNS update. It needs to be done here so that the lease
- structure values for the forward and reverse names are in place for
- supersede() -> write_lease() to be able to write into the
- dhcpd.leases file. We have to pass the "state" structure here as it
- is not yet hanging off the lease. */
- /* why not update for static leases too? */
- /* Because static leases aren't currently recorded? */
-/* XXX
-#if defined (NSUPDATE)
- if (!(lease -> flags & STATIC_LEASE) && offer == DHCPACK)
- nsupdate (lease, state, packet, ADD);
-#endif
-*/
-
/* If there are statements to execute when the lease is
committed, execute them. */
if (lease -> on_commit && (!offer || offer == DHCPACK)) {
@@ -1401,6 +1450,19 @@ void ack_lease (packet, lease, offer, when, msg)
free_lease_state (state, "ack_lease");
static_lease_dereference (lease, "ack_lease");
return;
+ } else {
+ /* If this is a DHCPOFFER transaction, supersede_lease
+ will not add the timer for the expire event to the
+ queue. This is because DHCPOFFERS are not commited,
+ and supersede_lease only adds commited leases to the
+ timer queue. So if supersede_lease set this lease
+ as the next one to expire for the pool we need to
+ put it on the timer queue ourself. */
+ /* XXX need to think about this. */
+ if (offer == DHCPOFFER && lease -> pool &&
+ lease -> pool -> next_expiry == lease)
+ add_timeout (lease -> ends, pool_timer,
+ lease -> pool);
}
}
@@ -1787,6 +1849,7 @@ void dhcp_reply (lease)
struct option_tag *ot, *not;
struct data_string d1;
struct option_cache *oc;
+ char *s;
if (!state)
log_fatal ("dhcp_reply was supplied lease with no state!");
@@ -1857,21 +1920,25 @@ void dhcp_reply (lease)
raw.hops = state -> hops;
raw.op = BOOTREPLY;
+ if (lease -> client_hostname &&
+ db_printable (lease -> client_hostname))
+ s = lease -> client_hostname;
+ else
+ s = (char *)0;
+
/* Say what we're doing... */
- log_info ("%s on %s to %s via %s",
+ log_info ("%s on %s to %s %s%s%svia %s",
(state -> offer
? (state -> offer == DHCPACK ? "DHCPACK" : "DHCPOFFER")
: "BOOTREPLY"),
piaddr (lease -> ip_addr),
- (lease -> client_hostname &&
- db_printable (lease -> client_hostname))
- ? lease -> client_hostname
- : (lease -> hardware_addr.htype
- ? print_hw_addr (lease -> hardware_addr.htype,
- lease -> hardware_addr.hlen,
- lease -> hardware_addr.haddr)
- : print_hex_1 (lease -> uid_len, lease -> uid,
- lease -> uid_len)),
+ s ? "(" : "", s ? s : "", s ? ") " : "",
+ (lease -> hardware_addr.htype
+ ? print_hw_addr (lease -> hardware_addr.htype,
+ lease -> hardware_addr.hlen,
+ lease -> hardware_addr.haddr)
+ : print_hex_1 (lease -> uid_len, lease -> uid,
+ lease -> uid_len)),
state -> giaddr.s_addr
? inet_ntoa (state -> giaddr)
: state -> ip -> name);
diff --git a/server/dhcpd.conf.cat5 b/server/dhcpd.conf.cat5
index a5e639d7..f97bec6b 100644
--- a/server/dhcpd.conf.cat5
+++ b/server/dhcpd.conf.cat5
@@ -539,7 +539,7 @@ dhcpd.conf(5) dhcpd.conf(5)
you might write the following subclass declaration for
that client:
- subclass "allocation-class-2" 08:00:2b:a1:11:31 {
+ subclass "allocation-class-2" 1:08:00:2b:a1:11:31 {
option root-path "samsara:/var/diskless/alphapc";
filename "/tftpboot/netbsd.alphapc-diskless";
}
@@ -828,16 +828,18 @@ dhcpd.conf(5) dhcpd.conf(5)
RREEFFEERREENNCCEE:: AALLLLOOWW AANNDD DDEENNYY
The _a_l_l_o_w and _d_e_n_y statements can be used to control the
- behaviour of dhcpd to various sorts of requests. The
- allow and deny keywords actually have different meanings
- depending on the context. In a pool context, these key­
- words can be used to set up access lists for address allo­
- cation pools. In other contexts, the keywords simply
+ response of the DHCP server to various sorts of requests.
+ The allow and deny keywords actually have different mean­
+ ings depending on the context. In a pool context, these
+ keywords can be used to set up access lists for address
+ allocation pools. In other contexts, the keywords simply
control general server behaviour with respect to clients
- based on scope.
+ based on scope. In a non-pool context, the _i_g_n_o_r_e key­
+ word can be used in place of the _d_e_n_y keyword to prevent
+ logging of denied requests.
-AALLLLOOWW AANNDD DDEENNYY IINN SSCCOOPPEE
+AALLLLOOWW DDEENNYY AANNDD IIGGNNOORREE IINN SSCCOOPPEE
The following usages of allow and deny will work in any
scope, although it is not recommended that they be used in
pool declarations.
@@ -846,10 +848,8 @@ AALLLLOOWW AANNDD DDEENNYY IINN SSCCOOPPEE
aallllooww uunnkknnoowwnn--cclliieennttss;;
ddeennyy uunnkknnoowwnn--cclliieennttss;;
+ iiggnnoorree uunnkknnoowwnn--cclliieennttss;;
- The uunnkknnoowwnn--cclliieennttss flag is used to tell dhcpd whether or
- not to dynamically assign addresses to unknown clients.
- Dynamic address assignment to unknown clients is aalllloowwed
@@ -862,12 +862,16 @@ AALLLLOOWW AANNDD DDEENNYY IINN SSCCOOPPEE
dhcpd.conf(5) dhcpd.conf(5)
+ The uunnkknnoowwnn--cclliieennttss flag is used to tell dhcpd whether or
+ not to dynamically assign addresses to unknown clients.
+ Dynamic address assignment to unknown clients is aalllloowwed
by default.
TThhee _b_o_o_t_p kkeeyywwoorrdd
aallllooww bboooottpp;;
ddeennyy bboooottpp;;
+ iiggnnoorree bboooottpp;;
The bboooottpp flag is used to tell dhcpd whether or not to
respond to bootp queries. Bootp queries are aalllloowwed by
@@ -877,13 +881,71 @@ dhcpd.conf(5) dhcpd.conf(5)
aallllooww bboooottiinngg;;
ddeennyy bboooottiinngg;;
+ iiggnnoorree bboooottiinngg;;
The bboooottiinngg flag is used to tell dhcpd whether or not to
respond to queries from a particular client. This keyword
only has meaning when it appears in a host declaration.
By default, booting is aalllloowwed, but if it is disabled for
a particular client, then that client will not be able to
- get and address from the DHCP server.
+ get and address from the DHCP server. TThhee _d_u_p_l_i_c_a_t_e_s kkeeyy­­
+ wwoorrdd
+
+ aallllooww dduupplliiccaatteess;;
+ ddeennyy dduupplliiccaatteess;;
+
+ Host declarations can match client messages based on the
+ DHCP Client Identifer option or based on the client's net­
+ work hardware type and MAC address. If the MAC address
+ is used, the host declaration will match any client with
+ that MAC address - even clients with different client
+ identifiers. This doesn't normally happen, but is possi­
+ ble when one computer has more than one operating system
+ installed on it - for example, Microsoft Windows and
+ NetBSD or Linux.
+
+ The dduupplliiccaatteess flag tells the DHCP server that if a
+ request is received from a client that matches the MAC
+ address of a host declaration, any other leases matching
+ that MAC address should be discarded by the server, even
+ if the UID is not the same. This is a violation of the
+ DHCP protocol, but can prevent clients whose client iden­
+ tifiers change regularly from holding many leases at the
+ same time. By default, duplicates are aalllloowwed. TThhee
+ _d_e_c_l_i_n_e_s kkeeyywwoorrdd
+
+ aallllooww ddeecclliinneess;;
+ ddeennyy ddeecclliinneess;;
+
+
+
+ 14
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
+ iiggnnoorree ddeecclliinneess;;
+
+ The DHCPDECLINE message is used by DHCP clients to indi­
+ cate that the lease the server has offered is not valid.
+ When the server receives a DHCPDECLINE for a particular
+ address, it normally abandons that address, assuming that
+ some unauthorized system is using it. Unfortunately, a
+ malicious or buggy client can, using DHCPDECLINE messages,
+ completely exhaust the DHCP server's allocation pool.
+ The server will reclaim these leases, but while the client
+ is running through the pool, it may cause serious thrash­
+ ing in the DNS, and it will also cause the DHCP server to
+ forget old DHCP client address allocations.
+
+ The ddeecclliinneess flag tells the DHCP server whether or not to
+ honor DHCPDECLINE messages. If it is set to ddeennyy or
+ iiggnnoorree in a particular scope, the DHCP server will not
+ respond to DHCPDECLINE messages.
AALLLLOOWW AANNDD DDEENNYY WWIITTHHIINN PPOOOOLL DDEECCLLAARRAATTIIOONNSS
The uses of the allow and deny keyword shown in the previ­
@@ -916,21 +978,21 @@ AALLLLOOWW AANNDD DDEENNYY WWIITTHHIINN PPOOOOLL DDEECC
allocation process is done as described previously in the
ADDRESS ALLOCATION section.
+ When declaring permit lists for address allocation pools,
+ the following syntaxes are recognized following the allow
+ or deny keyword:
- 14
+ 15
-dhcpd.conf(5) dhcpd.conf(5)
+dhcpd.conf(5) dhcpd.conf(5)
- When declaring permit lists for address allocation pools,
- the following syntaxes are recognized following the allow
- or deny keyword:
kknnoowwnn cclliieennttss;;
@@ -981,11 +1043,15 @@ dhcpd.conf(5) dhcpd.conf(5)
next renew.
RREEFFEERREENNCCEE:: PPAARRAAMMEETTEERRSS
- TThhee _d_e_f_a_u_l_t_-_l_e_a_s_e_-_t_i_m_e ssttaatteemmeenntt
+ TThhee _l_e_a_s_e_-_f_i_l_e_-_n_a_m_e ssttaatteemmeenntt
+ lleeaassee--ffiillee--nnaammee _n_a_m_e;;
+
+ _N_a_m_e should be the name of the DHCP server's lease file.
- 15
+
+ 16
@@ -994,6 +1060,23 @@ RREEFFEERREENNCCEE:: PPAARRAAMMEETTEERRSS
dhcpd.conf(5) dhcpd.conf(5)
+ By default, this is /var/db/dhcpd.leases. This statement
+ mmuusstt appear in the outer scope of the configuration file -
+ if it appears in some other scope, it will have no effect.
+
+ TThhee _p_i_d_-_f_i_l_e_-_n_a_m_e ssttaatteemmeenntt
+
+ ppiidd--ffiillee--nnaammee _n_a_m_e;;
+
+ _N_a_m_e should be the name of the DHCP server's process ID
+ file. This is the file in which the DHCP server's pro­
+ cess ID is stored when the server starts. By default,
+ this is /var/run/dhcpd.pid. Like the lease-file-name
+ statement, this statement must appear in the outer scope
+ of the configuration file.
+
+ TThhee _d_e_f_a_u_l_t_-_l_e_a_s_e_-_t_i_m_e ssttaatteemmeenntt
+
ddeeffaauulltt--lleeaassee--ttiimmee _t_i_m_e;;
_T_i_m_e should be the length in seconds that will be assigned
@@ -1004,75 +1087,75 @@ dhcpd.conf(5) dhcpd.conf(5)
mmaaxx--lleeaassee--ttiimmee _t_i_m_e;;
- _T_i_m_e should be the maximum length in seconds that will be
- assigned to a lease. The only exception to this is that
- Dynamic BOOTP lease lengths, which are not specified by
+ _T_i_m_e should be the maximum length in seconds that will be
+ assigned to a lease. The only exception to this is that
+ Dynamic BOOTP lease lengths, which are not specified by
the client, are not limited by this maximum.
TThhee _m_i_n_-_l_e_a_s_e_-_t_i_m_e ssttaatteemmeenntt
mmiinn--lleeaassee--ttiimmee _t_i_m_e;;
- _T_i_m_e should be the minimum length in seconds that will be
+ _T_i_m_e should be the minimum length in seconds that will be
assigned to a lease.
TThhee _m_i_n_-_s_e_c_s ssttaatteemmeenntt
mmiinn--sseeccss _s_e_c_o_n_d_s;;
- _S_e_c_o_n_d_s should be the minimum number of seconds since a
+ _S_e_c_o_n_d_s should be the minimum number of seconds since a
client began trying to acquire a new lease before the DHCP
server will respond to its request. The number of seconds
is based on what the client reports, and the maximum value
- that the client can report is 255 seconds. Generally,
- setting this to one will result in the DHCP server not
- responding to the client's first request, but always
+ that the client can report is 255 seconds. Generally,
+ setting this to one will result in the DHCP server not
+ responding to the client's first request, but always
responding to its second request.
- This can be used to set up a secondary DHCP server which
- never offers an address to a client until the primary
- server has been given a chance to do so. If the primary
- server is down, the client will bind to the secondary
- server, but otherwise clients should always bind to the
- primary. Note that this does not, by itself, permit a
- primary server and a secondary server to share a pool of
- dynamically-allocatable addresses.
+ This can be used to set up a secondary DHCP server which
+ never offers an address to a client until the primary
- TThhee _h_a_r_d_w_a_r_e ssttaatteemmeenntt
- hhaarrddwwaarree _h_a_r_d_w_a_r_e_-_t_y_p_e _h_a_r_d_w_a_r_e_-_a_d_d_r_e_s_s;;
- In order for a BOOTP client to be recognized, its network
- hardware address must be declared using a _h_a_r_d_w_a_r_e clause
- in the _h_o_s_t statement. _h_a_r_d_w_a_r_e_-_t_y_p_e must be the name of
- a physical hardware interface type. Currently, only the
- eetthheerrnneett and ttookkeenn--rriinngg types are recognized, although
- support for a ffddddii hardware type (and others) would also
+ 17
- 16
+dhcpd.conf(5) dhcpd.conf(5)
+ server has been given a chance to do so. If the primary
+ server is down, the client will bind to the secondary
+ server, but otherwise clients should always bind to the
+ primary. Note that this does not, by itself, permit a
+ primary server and a secondary server to share a pool of
+ dynamically-allocatable addresses.
-dhcpd.conf(5) dhcpd.conf(5)
+ TThhee _h_a_r_d_w_a_r_e ssttaatteemmeenntt
+ hhaarrddwwaarree _h_a_r_d_w_a_r_e_-_t_y_p_e _h_a_r_d_w_a_r_e_-_a_d_d_r_e_s_s;;
- be desirable. The _h_a_r_d_w_a_r_e_-_a_d_d_r_e_s_s should be a set of
- hexadecimal octets (numbers from 0 through ff) seperated
- by colons. The _h_a_r_d_w_a_r_e statement may also be used for
+ In order for a BOOTP client to be recognized, its network
+ hardware address must be declared using a _h_a_r_d_w_a_r_e clause
+ in the _h_o_s_t statement. _h_a_r_d_w_a_r_e_-_t_y_p_e must be the name of
+ a physical hardware interface type. Currently, only the
+ eetthheerrnneett and ttookkeenn--rriinngg types are recognized, although
+ support for a ffddddii hardware type (and others) would also
+ be desirable. The _h_a_r_d_w_a_r_e_-_a_d_d_r_e_s_s should be a set of
+ hexadecimal octets (numbers from 0 through ff) seperated
+ by colons. The _h_a_r_d_w_a_r_e statement may also be used for
DHCP clients.
TThhee _f_i_l_e_n_a_m_e ssttaatteemmeenntt
ffiilleennaammee ""_f_i_l_e_n_a_m_e"";;
- The _f_i_l_e_n_a_m_e statement can be used to specify the name of
- the initial boot file which is to be loaded by a client.
+ The _f_i_l_e_n_a_m_e statement can be used to specify the name of
+ the initial boot file which is to be loaded by a client.
The _f_i_l_e_n_a_m_e should be a filename recognizable to whatever
- file transfer protocol the client can be expected to use
+ file transfer protocol the client can be expected to use
to load the file.
TThhee _s_e_r_v_e_r_-_n_a_m_e ssttaatteemmeenntt
@@ -1087,52 +1170,51 @@ dhcpd.conf(5) dhcpd.conf(5)
nneexxtt--sseerrvveerr _s_e_r_v_e_r_-_n_a_m_e;;
- The _n_e_x_t_-_s_e_r_v_e_r statement is used to specify the host
- address of the server from which the initial boot file
- (specified in the _f_i_l_e_n_a_m_e statement) is to be loaded.
- _S_e_r_v_e_r_-_n_a_m_e should be a numeric IP address or a domain
- name. If no _n_e_x_t_-_s_e_r_v_e_r parameter applies to a given
+ The _n_e_x_t_-_s_e_r_v_e_r statement is used to specify the host
+ address of the server from which the initial boot file
+ (specified in the _f_i_l_e_n_a_m_e statement) is to be loaded.
+ _S_e_r_v_e_r_-_n_a_m_e should be a numeric IP address or a domain
+ name. If no _n_e_x_t_-_s_e_r_v_e_r parameter applies to a given
client, the DHCP server's IP address is used.
TThhee _f_i_x_e_d_-_a_d_d_r_e_s_s ssttaatteemmeenntt
ffiixxeedd--aaddddrreessss _a_d_d_r_e_s_s [,, _a_d_d_r_e_s_s ... ];;
- The _f_i_x_e_d_-_a_d_d_r_e_s_s statement is used to assign one or more
- fixed IP addresses to a client. It should only appear in
- a _h_o_s_t declaration. If more than one address is supplied,
- then when the client boots, it will be assigned the
- address which corresponds to the network on which it is
- booting. If none of the addresses in the _f_i_x_e_d_-_a_d_d_r_e_s_s
- statement are on the network on which the client is boot­
- ing, that client will not match the _h_o_s_t declaration con­
- taining that _f_i_x_e_d_-_a_d_d_r_e_s_s statement. Each _a_d_d_r_e_s_s should
- be either an IP address or a domain name which resolves to
- one or more IP addresses.
-
- TThhee _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_c_u_t_o_f_f ssttaatteemmeenntt
- ddyynnaammiicc--bboooottpp--lleeaassee--ccuuttooffff _d_a_t_e;;
+ 18
- 17
+dhcpd.conf(5) dhcpd.conf(5)
+ The _f_i_x_e_d_-_a_d_d_r_e_s_s statement is used to assign one or more
+ fixed IP addresses to a client. It should only appear in
+ a _h_o_s_t declaration. If more than one address is supplied,
+ then when the client boots, it will be assigned the
+ address which corresponds to the network on which it is
+ booting. If none of the addresses in the _f_i_x_e_d_-_a_d_d_r_e_s_s
+ statement are on the network on which the client is boot­
+ ing, that client will not match the _h_o_s_t declaration con­
+ taining that _f_i_x_e_d_-_a_d_d_r_e_s_s statement. Each _a_d_d_r_e_s_s should
+ be either an IP address or a domain name which resolves to
+ one or more IP addresses.
-dhcpd.conf(5) dhcpd.conf(5)
+ TThhee _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_c_u_t_o_f_f ssttaatteemmeenntt
+ ddyynnaammiicc--bboooottpp--lleeaassee--ccuuttooffff _d_a_t_e;;
- The _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_c_u_t_o_f_f statement sets the ending
+ The _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_c_u_t_o_f_f statement sets the ending
time for all leases assigned dynamically to BOOTP clients.
- Because BOOTP clients do not have any way of renewing
- leases, and don't know that their leases could expire, by
+ Because BOOTP clients do not have any way of renewing
+ leases, and don't know that their leases could expire, by
default dhcpd assignes infinite leases to all BOOTP
clients. However, it may make sense in some situations to
- set a cutoff date for all BOOTP leases - for example, the
+ set a cutoff date for all BOOTP leases - for example, the
end of a school term, or the time at night when a facility
is closed and all machines are required to be powered off.
@@ -1141,60 +1223,60 @@ dhcpd.conf(5) dhcpd.conf(5)
W YYYY/MM/DD HH:MM:SS
- W is the day of the week expressed as a number from zero
- (Sunday) to six (Saturday). YYYY is the year, including
+ W is the day of the week expressed as a number from zero
+ (Sunday) to six (Saturday). YYYY is the year, including
the century. MM is the month expressed as a number from 1
- to 12. DD is the day of the month, counting from 1. HH
- is the hour, from zero to 23. MM is the minute and SS is
- the second. The time is always in Greenwich Mean Time
+ to 12. DD is the day of the month, counting from 1. HH
+ is the hour, from zero to 23. MM is the minute and SS is
+ the second. The time is always in Greenwich Mean Time
(GMT), not local time.
TThhee _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_l_e_n_g_t_h ssttaatteemmeenntt
ddyynnaammiicc--bboooottpp--lleeaassee--lleennggtthh _l_e_n_g_t_h;;
- The _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_l_e_n_g_t_h statement is used to set
- the length of leases dynamically assigned to BOOTP
- clients. At some sites, it may be possible to assume
- that a lease is no longer in use if its holder has not
- used BOOTP or DHCP to get its address within a certain
+ The _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_l_e_n_g_t_h statement is used to set
+ the length of leases dynamically assigned to BOOTP
+ clients. At some sites, it may be possible to assume
+ that a lease is no longer in use if its holder has not
+ used BOOTP or DHCP to get its address within a certain
time period. The period is specified in _l_e_n_g_t_h as a num­
- ber of seconds. If a client reboots using BOOTP during
+ ber of seconds. If a client reboots using BOOTP during
the timeout period, the lease duration is reset to _l_e_n_g_t_h,
- so a BOOTP client that boots frequently enough will never
+ so a BOOTP client that boots frequently enough will never
lose its lease. Needless to say, this parameter should be
adjusted with extreme caution.
- TThhee _g_e_t_-_l_e_a_s_e_-_h_o_s_t_n_a_m_e_s ssttaatteemmeenntt
- ggeett--lleeaassee--hhoossttnnaammeess _f_l_a_g;;
- The _g_e_t_-_l_e_a_s_e_-_h_o_s_t_n_a_m_e_s statement is used to tell dhcpd
- whether or not to look up the domain name corresponding to
- the IP address of each address in the lease pool and use
- that address for the DHCP _h_o_s_t_n_a_m_e option. If _f_l_a_g is
- true, then this lookup is done for all addresses in the
- current scope. By default, or if _f_l_a_g is false, no
- lookups are done.
+ 19
- TThhee _u_s_e_-_h_o_s_t_-_d_e_c_l_-_n_a_m_e_s ssttaatteemmeenntt
- uussee--hhoosstt--ddeeccll--nnaammeess _f_l_a_g;;
- 18
+dhcpd.conf(5) dhcpd.conf(5)
+ TThhee _g_e_t_-_l_e_a_s_e_-_h_o_s_t_n_a_m_e_s ssttaatteemmeenntt
+ ggeett--lleeaassee--hhoossttnnaammeess _f_l_a_g;;
+ The _g_e_t_-_l_e_a_s_e_-_h_o_s_t_n_a_m_e_s statement is used to tell dhcpd
+ whether or not to look up the domain name corresponding to
+ the IP address of each address in the lease pool and use
+ that address for the DHCP _h_o_s_t_n_a_m_e option. If _f_l_a_g is
+ true, then this lookup is done for all addresses in the
+ current scope. By default, or if _f_l_a_g is false, no
+ lookups are done.
-dhcpd.conf(5) dhcpd.conf(5)
+ TThhee _u_s_e_-_h_o_s_t_-_d_e_c_l_-_n_a_m_e_s ssttaatteemmeenntt
+ uussee--hhoosstt--ddeeccll--nnaammeess _f_l_a_g;;
- If the _u_s_e_-_h_o_s_t_-_d_e_c_l_-_n_a_m_e_s parameter is true in a given
- scope, then for every host declaration within that scope,
- the name provided for the host declaration will be sup­
+ If the _u_s_e_-_h_o_s_t_-_d_e_c_l_-_n_a_m_e_s parameter is true in a given
+ scope, then for every host declaration within that scope,
+ the name provided for the host declaration will be sup­
plied to the client as its hostname. So, for example,
group {
@@ -1214,7 +1296,7 @@ dhcpd.conf(5) dhcpd.conf(5)
option host-name "joe";
}
- An _o_p_t_i_o_n _h_o_s_t_-_n_a_m_e statement within a host declaration
+ An _o_p_t_i_o_n _h_o_s_t_-_n_a_m_e statement within a host declaration
will override the use of the name in the host declaration.
TThhee _a_u_t_h_o_r_i_t_a_t_i_v_e ssttaatteemmeenntt
@@ -1223,108 +1305,107 @@ dhcpd.conf(5) dhcpd.conf(5)
nnoott aauutthhoorriittaattiivvee;;
- The DHCP server will normally assume that the configura­
+ The DHCP server will normally assume that the configura­
tion information about a given network segment is known to
be correct and is authoritative. So if a client requests
- an IP address on a given network segment that the server
- knows is not valid for that segment, the server will
+ an IP address on a given network segment that the server
+ knows is not valid for that segment, the server will
respond with a DHCPNAK message, causing the client to for­
get its IP address and try to get a new one.
- If a DHCP server is being configured by somebody who is
- not the network administrator and who therefore does not
- wish to assert this level of authority, then the statement
- "not authoritative" should be written in the appropriate
- scope in the configuration file.
-
- Usually, writing nnoott aauutthhoorriittaattiivvee;; at the top level of
- the file should be sufficient. However, if a DHCP server
- is to be set up so that it is aware of some networks for
- which it is authoritative and some networks for which it
- is not, it may be more appropriate to declare authority on
- a per-network-segment basis.
- Note that the most specific scope for which the concept of
- authority makes any sense is the physical network segment
+ 20
- 19
+dhcpd.conf(5) dhcpd.conf(5)
-dhcpd.conf(5) dhcpd.conf(5)
+ If a DHCP server is being configured by somebody who is
+ not the network administrator and who therefore does not
+ wish to assert this level of authority, then the statement
+ "not authoritative" should be written in the appropriate
+ scope in the configuration file.
+ Usually, writing nnoott aauutthhoorriittaattiivvee;; at the top level of
+ the file should be sufficient. However, if a DHCP server
+ is to be set up so that it is aware of some networks for
+ which it is authoritative and some networks for which it
+ is not, it may be more appropriate to declare authority on
+ a per-network-segment basis.
- - either a shared-network statement or a subnet statement
- that is not contained within a shared-network statement.
+ Note that the most specific scope for which the concept of
+ authority makes any sense is the physical network segment
+ - either a shared-network statement or a subnet statement
+ that is not contained within a shared-network statement.
It is not meaningful to specify that the server is author­
- itative for some subnets within a shared network, but not
- authoritative for others, nor is it meaningful to specify
- that the server is authoritative for some host declara­
+ itative for some subnets within a shared network, but not
+ authoritative for others, nor is it meaningful to specify
+ that the server is authoritative for some host declara­
tions and not others.
TThhee _a_l_w_a_y_s_-_r_e_p_l_y_-_r_f_c_1_0_4_8 ssttaatteemmeenntt
aallwwaayyss--rreeppllyy--rrffcc11004488 _f_l_a_g;;
- Some BOOTP clients expect RFC1048-style responses, but do
- not follow RFC1048 when sending their requests. You can
- tell that a client is having this problem if it is not
- getting the options you have configured for it and if you
- see in the server log the message "(non-rfc1048)" printed
+ Some BOOTP clients expect RFC1048-style responses, but do
+ not follow RFC1048 when sending their requests. You can
+ tell that a client is having this problem if it is not
+ getting the options you have configured for it and if you
+ see in the server log the message "(non-rfc1048)" printed
with each BOOTREQUEST that is logged.
- If you want to send rfc1048 options to such a client, you
- can set the aallwwaayyss--rreeppllyy--rrffcc11004488 option in that client's
+ If you want to send rfc1048 options to such a client, you
+ can set the aallwwaayyss--rreeppllyy--rrffcc11004488 option in that client's
host declaration, and the DHCP server will respond with an
- RFC-1048-style vendor options field. This flag can be
- set in any scope, and will affect all clients covered by
+ RFC-1048-style vendor options field. This flag can be
+ set in any scope, and will affect all clients covered by
that scope.
TThhee _a_l_w_a_y_s_-_b_r_o_a_d_c_a_s_t ssttaatteemmeenntt
aallwwaayyss--bbrrooaaddccaasstt _f_l_a_g;;
- The DHCP and BOOTP protocols both require DHCP and BOOTP
+ The DHCP and BOOTP protocols both require DHCP and BOOTP
clients to set the broadcast bit in the flags field of the
- BOOTP message header. Unfortunately, some DHCP and BOOTP
- clients do not do this, and therefore may not receive
- responses from the DHCP server. The DHCP server can be
- made to always broadcast its responses to clients by set­
- ting this flag to 'on' for the relevant scope. To avoid
+ BOOTP message header. Unfortunately, some DHCP and BOOTP
+ clients do not do this, and therefore may not receive
+ responses from the DHCP server. The DHCP server can be
+ made to always broadcast its responses to clients by set­
+ ting this flag to 'on' for the relevant scope. To avoid
creating excess broadcast traffic on your network, we rec­
- ommend that you restrict the use of this option to as few
- clients as possible. For example, the Microsoft DHCP
- client is known not to have this problem, as are the Open­
- Transport and ISC DHCP clients.
+ ommend that you restrict the use of this option to as few
- TThhee _o_n_e_-_l_e_a_s_e_-_p_e_r_-_c_l_i_e_n_t ssttaatteemmeenntt
- oonnee--lleeaassee--ppeerr--cclliieenntt _f_l_a_g;;
- If this flag is enabled, whenever a client sends a DHCPRE­
- QUEST for a particular lease, the server will automati­
- cally free any other leases the client holds. This pre­
- sumes that when the client sends a DHCPREQUEST, it has
- forgotten any lease not mentioned in the DHCPREQUEST -
- i.e., the client has only a single network interface _a_n_d
- it does not remember leases it's holding on networks to
+ 21
- 20
+dhcpd.conf(5) dhcpd.conf(5)
+ clients as possible. For example, the Microsoft DHCP
+ client is known not to have this problem, as are the Open­
+ Transport and ISC DHCP clients.
-dhcpd.conf(5) dhcpd.conf(5)
+ TThhee _o_n_e_-_l_e_a_s_e_-_p_e_r_-_c_l_i_e_n_t ssttaatteemmeenntt
+ oonnee--lleeaassee--ppeerr--cclliieenntt _f_l_a_g;;
- which it is not currently attached. Neither of these
+ If this flag is enabled, whenever a client sends a DHCPRE­
+ QUEST for a particular lease, the server will automati­
+ cally free any other leases the client holds. This pre­
+ sumes that when the client sends a DHCPREQUEST, it has
+ forgotten any lease not mentioned in the DHCPREQUEST -
+ i.e., the client has only a single network interface _a_n_d
+ it does not remember leases it's holding on networks to
+ which it is not currently attached. Neither of these
assumptions are guaranteed or provable, so we urge caution
in the use of this statement.
@@ -1332,73 +1413,73 @@ dhcpd.conf(5) dhcpd.conf(5)
uussee--lleeaassee--aaddddrr--ffoorr--ddeeffaauulltt--rroouuttee _f_l_a_g;;
- If the _u_s_e_-_l_e_a_s_e_-_a_d_d_r_-_f_o_r_-_d_e_f_a_u_l_t_-_r_o_u_t_e parameter is true
+ If the _u_s_e_-_l_e_a_s_e_-_a_d_d_r_-_f_o_r_-_d_e_f_a_u_l_t_-_r_o_u_t_e parameter is true
in a given scope, then instead of sending the value speci­
- fied in the routers option (or sending no value at all),
- the IP address of the lease being assigned is sent to the
+ fied in the routers option (or sending no value at all),
+ the IP address of the lease being assigned is sent to the
client. This supposedly causes Win95 machines to ARP for
- all IP addresses, which can be helpful if your router is
+ all IP addresses, which can be helpful if your router is
configured for proxy ARP.
TThhee _s_e_r_v_e_r_-_i_d_e_n_t_i_f_i_e_r ssttaatteemmeenntt
sseerrvveerr--iiddeennttiiffiieerr _h_o_s_t_n_a_m_e;;
- The server-identifier statement can be used to define the
- value that is sent in the DHCP Server Identifier option
- for a given scope. The value specified mmuusstt be an IP
- address for the DHCP server, and must be reachable by all
+ The server-identifier statement can be used to define the
+ value that is sent in the DHCP Server Identifier option
+ for a given scope. The value specified mmuusstt be an IP
+ address for the DHCP server, and must be reachable by all
clients served by a particular scope.
- The use of the server-identifier statement is not recom­
- mended - the only reason to use it is to force a value
+ The use of the server-identifier statement is not recom­
+ mended - the only reason to use it is to force a value
other than the default value to be sent on occasions where
- the default value would be incorrect. The default value
- is the first IP address associated with the physical net­
+ the default value would be incorrect. The default value
+ is the first IP address associated with the physical net­
work interface on which the request arrived.
The usual case where the _s_e_r_v_e_r_-_i_d_e_n_t_i_f_i_e_r statement needs
- to be sent is when a physical interface has more than one
+ to be sent is when a physical interface has more than one
IP address, and the one being sent by default isn't appro­
- priate for some or all clients served by that interface.
- Another common case is when an alias is defined for the
- purpose of having a consistent IP address for the DHCP
- server, and it is desired that the clients use this IP
- address when contacting the server.
+ priate for some or all clients served by that interface.
+ Another common case is when an alias is defined for the
+ purpose of having a consistent IP address for the DHCP
- Supplying a value for the dhcp-server-identifier option is
- equivalent to using the server-identifier statement.
-RREEFFEERREENNCCEE:: OOPPTTIIOONN SSTTAATTEEMMEENNTTSS
- DHCP option statements are documented in the ddhhccpp--
- ooppttiioonnss((55)) manual page.
-VVEENNDDOORR EENNCCAAPPSSUULLAATTEEDD OOPPTTIIOONNSS
- The DHCP protocol defines the vveennddoorr--eennccaappssuullaatteedd--ooppttiioonnss
- option, which allows vendors to define their own options
- that will be sent encapsulated in a standard DHCP option.
- The format of the vveennddoorr--eennccaappssuullaatteedd--ooppttiioonnss option is
+ 22
- 21
+dhcpd.conf(5) dhcpd.conf(5)
+ server, and it is desired that the clients use this IP
+ address when contacting the server.
-dhcpd.conf(5) dhcpd.conf(5)
+ Supplying a value for the dhcp-server-identifier option is
+ equivalent to using the server-identifier statement.
+RREEFFEERREENNCCEE:: OOPPTTIIOONN SSTTAATTEEMMEENNTTSS
+ DHCP option statements are documented in the ddhhccpp--
+ ooppttiioonnss((55)) manual page.
- either a hunk of opaque data, or an actual option buffer
+VVEENNDDOORR EENNCCAAPPSSUULLAATTEEDD OOPPTTIIOONNSS
+ The DHCP protocol defines the vveennddoorr--eennccaappssuullaatteedd--ooppttiioonnss
+ option, which allows vendors to define their own options
+ that will be sent encapsulated in a standard DHCP option.
+ The format of the vveennddoorr--eennccaappssuullaatteedd--ooppttiioonnss option is
+ either a hunk of opaque data, or an actual option buffer
just like a standard DHCP option buffer.
- You can send this option to clients in one of two ways -
- either define the data directly, using a text string or a
- colon-seperated list of hexadecimal values, or define an
- option space, define some options in that option space,
- provide values for them, and specify that that option
- space should be used to generate the vveennddoorr--eennccaappssuullaatteedd--
+ You can send this option to clients in one of two ways -
+ either define the data directly, using a text string or a
+ colon-seperated list of hexadecimal values, or define an
+ option space, define some options in that option space,
+ provide values for them, and specify that that option
+ space should be used to generate the vveennddoorr--eennccaappssuullaatteedd--
ooppttiioonnss option in some scope.
To send a simple clump of data, simply provide a value for
@@ -1409,13 +1490,13 @@ dhcpd.conf(5) dhcpd.conf(5)
3:12:73:75:6e:64:68:63:70:2d:73:65:72:76:65:72:31:37:2d:31:
4:12:2f:65:78:70:6f:72:74:2f:72:6f:6f:74:2f:69:38:36:70:63;
- To define a new option space in which vendor options can
+ To define a new option space in which vendor options can
be stored, use the option space statement:
ooppttiioonn ssppaaccee _n_a_m_e ;;
- The name can then be used in option definitions, as
- described in the ddhhccpp--ooppttiioonnss((55)) manual page. For exam­
+ The name can then be used in option definitions, as
+ described in the ddhhccpp--ooppttiioonnss((55)) manual page. For exam­
ple:
option space SUNW;
@@ -1423,51 +1504,52 @@ dhcpd.conf(5) dhcpd.conf(5)
option SUNW.server-name code 3 = text;
option SUNW.root-path code 4 = text;
- Once you have defined an option space and some options,
- you can set up scopes that define values for those
- options, and you can say when to use them. For example,
- suppose you want to handle two different classes of
- clients, as in the example in the CCLLIIEENNTT CCLLAASSSSIINNGG section.
- Using the option space definition shown in the previous
- example, something very similar to the vendor-encapsu­
- lated-options definition shown earlier can be done as fol­
- lows:
+ Once you have defined an option space and some options,
+ you can set up scopes that define values for those
+ options, and you can say when to use them. For example,
+ suppose you want to handle two different classes of
+ clients, as in the example in the VVEENNDDOORR EENNCCAAPPSSUULLAATTEEDD
+ OOPPTTIIOONNSS section. Using the option space definition shown
- class "vendor-classes" {
- match option vendor-class-identifier;
- }
- option SUNW.server-address 172.17.65.1;
- option SUNW.server-name "sundhcp-server17-1";
- subclass "vendor-classes" "SUNW.Ultra-5_10" {
- vendor-option-space SUNW;
- option SUNW.root-path "/export/root/sparc";
- }
+ 23
- 22
+dhcpd.conf(5) dhcpd.conf(5)
+ in the previous example, something very similar to the
+ vendor-encapsulated-options definition shown earlier can
+ be done as follows:
-dhcpd.conf(5) dhcpd.conf(5)
+ class "vendor-classes" {
+ match option vendor-class-identifier;
+ }
+
+ option SUNW.server-address 172.17.65.1;
+ option SUNW.server-name "sundhcp-server17-1";
+ subclass "vendor-classes" "SUNW.Ultra-5_10" {
+ vendor-option-space SUNW;
+ option SUNW.root-path "/export/root/sparc";
+ }
subclass "vendor-classes" "SUNW.i86pc" {
vendor-option-space SUNW;
option SUNW.root-path "/export/root/i86pc";
}
- As you can see in the preceding example, regular scoping
- rules apply, so you can define values that are global in
+ As you can see in the preceding example, regular scoping
+ rules apply, so you can define values that are global in
the global scope, and only define values that are specific
- to a particular class in the local scope. The vveennddoorr--
+ to a particular class in the local scope. The vveennddoorr--
ooppttiioonn--ssppaaccee declaration indicates that in that scope, the
- vveennddoorr--eennccaappssuullaatteedd--ooppttiioonnss option should be constructed
- using the values of all the options in the SUNW option
+ vveennddoorr--eennccaappssuullaatteedd--ooppttiioonnss option should be constructed
+ using the values of all the options in the SUNW option
space.
SSEEEE AALLSSOO
@@ -1475,9 +1557,9 @@ SSEEEE AALLSSOO
AAUUTTHHOORR
ddhhccppdd((88)) was written by Ted Lemon <mellon@vix.com> under a
- contract with Vixie Labs. Funding for this project was
+ contract with Vixie Labs. Funding for this project was
provided by the Internet Software Consortium. Information
- about the Internet Software Consortium can be found at
+ about the Internet Software Consortium can be found at
hhttttpp::////wwwwww..iisscc..oorrgg//iisscc..
@@ -1497,22 +1579,6 @@ AAUUTTHHOORR
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 23
+ 24
diff --git a/server/failover.c b/server/failover.c
index 4c221979..1da507b2 100644
--- a/server/failover.c
+++ b/server/failover.c
@@ -22,14 +22,16 @@
#ifndef lint
static char copyright[] =
-"$Id: failover.c,v 1.3 1999/11/14 00:42:57 mellon Exp $ Copyright (c) 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: failover.c,v 1.4 1999/11/20 18:36:31 mellon Exp $ Copyright (c) 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
+#include <omapip/omapip_p.h>
#if defined (FAILOVER_PROTOCOL)
static struct hash_table *failover_hash;
-static isc_result_t do_a_failover_option (omapi_connection_object_t *,
+static dhcp_failover_state_t *failover_states;
+static isc_result_t do_a_failover_option (omapi_object_t *,
dhcp_failover_link_t *);
void enter_failover_peer (peer)
@@ -70,15 +72,20 @@ isc_result_t dhcp_failover_link_initiate (omapi_object_t *h)
dhcp_failover_link_t *obj;
char *peer_name;
unsigned long port;
- omapi_typed_data_t *value = (omapi_typed_data_t *)0;
+ omapi_value_t *value = (omapi_value_t *)0;
status = omapi_get_value_str (h, (omapi_object_t *)0,
"remote-port", &value);
if (status != ISC_R_SUCCESS)
return status;
-
- status = omapi_get_int_value (&port, value);
- omapi_typed_data_dereference (&value, "dhcp_failover_link_initiate");
+ if (!value -> value) {
+ omapi_value_dereference (&value,
+ "dhcp_failover_link_initiate");
+ return ISC_R_INVALIDARG;
+ }
+
+ status = omapi_get_int_value (&port, value -> value);
+ omapi_value_dereference (&value, "dhcp_failover_link_initiate");
if (status != ISC_R_SUCCESS)
return status;
@@ -86,24 +93,26 @@ isc_result_t dhcp_failover_link_initiate (omapi_object_t *h)
"remote-peer", &value);
if (status != ISC_R_SUCCESS)
return status;
- if (value -> type != omapi_datatype_string &&
- value -> type != omapu_datatype_data) {
- omapi_typed_data_dereference (&value,
- "dhcp_failover_link_initiate");
+ if (!value -> value ||
+ (value -> value -> type != omapi_datatype_string &&
+ value -> value -> type != omapi_datatype_data)) {
+ omapi_value_dereference (&value,
+ "dhcp_failover_link_initiate");
return ISC_R_INVALIDARG;
}
/* Save the name. */
- peer_name = malloc (value -> u.buffer.len + 1);
+ peer_name = malloc (value -> value -> u.buffer.len + 1);
if (!peer_name) {
- omapi_typed_data_dereference (&value,
- "dhcp_failover_link_initiate");
+ omapi_value_dereference (&value,
+ "dhcp_failover_link_initiate");
return ISC_R_NOMEMORY;
}
- memcpy (peer_name, value -> u.buffer.data, value -> u.buffer.len);
- peer_name [value -> u.buffer.len] = 0;
- omapi_typed_data_dereference (&value, "dhcp_failover_link_initiate");
+ memcpy (peer_name, value -> value -> u.buffer.value,
+ value -> value -> u.buffer.len);
+ peer_name [value -> value -> u.buffer.len] = 0;
+ omapi_value_dereference (&value, "dhcp_failover_link_initiate");
obj = (dhcp_failover_link_t *)malloc (sizeof *obj);
if (!obj)
@@ -112,9 +121,9 @@ isc_result_t dhcp_failover_link_initiate (omapi_object_t *h)
obj -> refcnt = 1;
obj -> type = dhcp_type_failover_link;
obj -> peer_name = peer_name;
- obj -> port = port;
+ obj -> peer_port = port;
- status = omapi_connect ((omapi_object_t *)obj, server_name, port);
+ status = omapi_connect ((omapi_object_t *)obj, peer_name, port);
if (status != ISC_R_SUCCESS) {
omapi_object_dereference ((omapi_object_t **)&obj,
"dhcp_failover_link_initiate");
@@ -165,41 +174,50 @@ isc_result_t dhcp_failover_link_signal (omapi_object_t *h,
/* Not a signal we recognize? */
if (strcmp (name, "ready")) {
- if (p -> inner && p -> inner -> type -> signal_handler)
- return (*(p -> inner -> type -> signal_handler)) (h,
+ if (h -> inner && h -> inner -> type -> signal_handler)
+ return (*(h -> inner -> type -> signal_handler)) (h,
name,
ap);
return ISC_R_NOTFOUND;
}
- if (!p -> outer || p -> outer -> type != omapi_type_connection)
+ if (!h -> outer || h -> outer -> type != omapi_type_connection)
return ISC_R_INVALIDARG;
- c = p -> outer;
+ c = h -> outer;
/* We get here because we requested that we be woken up after
some number of bytes were read, and that number of bytes
has in fact been read. */
- switch (p -> state) {
+ switch (link -> state) {
case dhcp_flink_start:
- p -> state = dhcp_flink_message_length_wait;
+ link -> state = dhcp_flink_message_length_wait;
if ((omapi_connection_require (c, 2)) != ISC_R_SUCCESS)
break;
case dhcp_flink_message_length_wait:
- p -> state = dhcp_flink_message_wait;
- memset (link -> incoming_message, 0, sizeof (link -> imsg));
- /* Get the length: */
- omapi_connection_get_uint16 (c, &link -> imsg_len);
- link -> imsg_count = 0; /* Bytes read. */
-
- /* Maximum of 2048 bytes in any failover message. */
- if (link -> imsg_len > DHCP_FAILOVER_MAX_MESSAGE_SIZE) {
+ link -> state = dhcp_flink_message_wait;
+ link -> imsg = dmalloc (sizeof (failover_message_t),
+ "dhcp_failover_link_signal");
+ if (!link -> imsg) {
dhcp_flink_fail:
+ if (link -> imsg) {
+ dfree (link -> imsg,
+ "dhcp_failover_link_signal");
+ link -> imsg = (failover_message_t *)0;
+ }
link -> state = dhcp_flink_disconnected;
omapi_disconnect (c, 1);
/* XXX just blow away the protocol state now?
XXX or will disconnect blow it away? */
return ISC_R_UNEXPECTED;
}
+ memset (link -> imsg, 0, sizeof (link -> imsg));
+ /* Get the length: */
+ omapi_connection_get_uint16 (c, &link -> imsg_len);
+ link -> imsg_count = 0; /* Bytes read. */
+
+ /* Maximum of 2048 bytes in any failover message. */
+ if (link -> imsg_len > DHCP_FAILOVER_MAX_MESSAGE_SIZE)
+ goto dhcp_flink_fail;
if ((omapi_connection_require (c, link -> imsg_len)) !=
ISC_R_SUCCESS)
@@ -234,11 +252,11 @@ isc_result_t dhcp_failover_link_signal (omapi_object_t *h,
/* Skip over any portions of the message header that we
don't understand. */
- if (link -> payoff - link -> imsg_count) {
+ if (link -> imsg_payoff - link -> imsg_count) {
omapi_connection_copyout ((unsigned char *)0, c,
- (link -> payoff -
+ (link -> imsg_payoff -
link -> imsg_count));
- link -> imsg_count = link -> payoff;
+ link -> imsg_count = link -> imsg_payoff;
}
/* Get transaction ID. */
@@ -264,14 +282,15 @@ isc_result_t dhcp_failover_link_signal (omapi_object_t *h,
}
static isc_result_t do_a_failover_option (c, link)
- omapi_connection_object_t *c;
+ omapi_object_t *c;
dhcp_failover_link_t *link;
{
u_int16_t option_code;
u_int16_t option_len;
- char *op;
- int op_size;
- int op_count;
+ unsigned char *op;
+ unsigned op_size;
+ unsigned op_count;
+ int i;
if (link -> imsg_count + 2 > link -> imsg_len) {
log_error ("FAILOVER: message overflow at option code.");
@@ -299,7 +318,7 @@ static isc_result_t do_a_failover_option (c, link)
option_code, option_len);
#endif
omapi_connection_copyout ((unsigned char *)0, c, option_len);
- link -> imsg_count = += option_len;
+ link -> imsg_count += option_len;
return ISC_R_SUCCESS;
}
@@ -320,7 +339,7 @@ static isc_result_t do_a_failover_option (c, link)
}
/* Only accept an option once. */
- if (imsg -> options_present & ft_options [option_code].bit) {
+ if (link -> imsg -> options_present & ft_options [option_code].bit) {
log_error ("FAILOVER: duplicate option %s",
ft_options [option_code].name);
return ISC_R_PROTOCOLERROR;
@@ -335,7 +354,7 @@ static isc_result_t do_a_failover_option (c, link)
if (ft_options [option_code].bit &&
!(fto_allowed [option_code] & ft_options [option_code].bit)) {
omapi_connection_copyout ((unsigned char *)0, c, option_len);
- link -> imsg_count = += option_len;
+ link -> imsg_count += option_len;
return ISC_R_SUCCESS;
}
@@ -346,27 +365,28 @@ static isc_result_t do_a_failover_option (c, link)
we expect the space for them to be preallocated,
and we can just read the data in. */
- op = ((char *)&link -> imsg) + ft_options [option_code].offset;
+ op = ((unsigned char *)&link -> imsg) +
+ ft_options [option_code].offset;
op_size = ft_sizes [ft_options [option_code].type];
op_count = ft_options [option_code].num_present;
- if (option_length != op_size * op_count) {
+ if (option_len != op_size * op_count) {
log_error ("FAILOVER: option size (%d:%d), option %s",
- option_length,
+ option_len,
(ft_sizes [ft_options [option_code].type] *
ft_options [option_code].num_present),
ft_options [option_code].name);
return ISC_R_PROTOCOLERROR;
}
} else {
- struct failover_option *fo;
+ failover_option_t *fo;
/* FT_DDNS* are special - one or two bytes of status
followed by the client FQDN. */
if (ft_options [option_code].type == FT_DDNS1 ||
ft_options [option_code].type == FT_DDNS1) {
- struct failover_ddns *ddns =
- ((struct failover_ddns *)
+ ddns_fqdn_t *ddns =
+ ((ddns_fqdn_t *)
(((char *)&link -> imsg) +
ft_options [option_code].offset));
@@ -378,7 +398,7 @@ static isc_result_t do_a_failover_option (c, link)
if (op_count == 1)
ddns -> codes [1] = 0;
op_size = 1;
- op_count = option_length - op_count;
+ op_count = option_len - op_count;
ddns -> length = op_count;
ddns -> data = malloc (op_count);
@@ -393,7 +413,7 @@ static isc_result_t do_a_failover_option (c, link)
omapi_connection_copyout (ddns -> data, c, op_count);
goto out;
}
- } else {
+
/* A zero for num_present means that any number of
elements can appear, so we have to figure out how
many we got from the length of the option, and then
@@ -403,20 +423,20 @@ static isc_result_t do_a_failover_option (c, link)
/* Make sure that option data length is a multiple of the
size of the data type being sent. */
- if (op_size > 1 && option_length % op_size) {
- log_error ("FAILOVER: option_length %d not %s%d",
- option_length, "multiple of ", option_size);
+ if (op_size > 1 && option_len % op_size) {
+ log_error ("FAILOVER: option_len %d not %s%d",
+ option_len, "multiple of ", op_size);
return ISC_R_PROTOCOLERROR;
}
- op_count = option_length / op_size;
+ op_count = option_len / op_size;
- fo = ((struct failover_option *)
+ fo = ((failover_option_t *)
(((char *)&link -> imsg) +
ft_options [option_code].offset));
fo -> count = op_count;
- fo -> data = malloc (option_length);
+ fo -> data = malloc (option_len);
if (!fo -> data) {
log_error ("FAILOVER: no memory getting %s (%d)",
"option data", op_count);
@@ -438,12 +458,12 @@ static isc_result_t do_a_failover_option (c, link)
for (i = 0; i < op_count; i++) {
switch (ft_options [option_code].type) {
case FT_UINT32:
- omapi_connection_get_uint32 (c, op);
+ omapi_connection_get_uint32 (c, (u_int32_t *)op);
op += 4;
break;
case FT_UINT16:
- omapi_connection_get_uint16 (c, op);
+ omapi_connection_get_uint16 (c, (u_int16_t *)op);
op += 2;
break;
@@ -458,7 +478,7 @@ static isc_result_t do_a_failover_option (c, link)
}
out:
/* Remember that we got this option. */
- link -> options_present |= ft_options [option_code].bit;
+ link -> imsg -> options_present |= ft_options [option_code].bit;
return ISC_R_SUCCESS;
}
@@ -471,7 +491,7 @@ isc_result_t dhcp_failover_link_set_value (omapi_object_t *h,
return ISC_R_INVALIDARG;
/* Never valid to set these. */
- if (!omapi_ds_strcmp (name, "port") ||
+ if (!omapi_ds_strcmp (name, "link-port") ||
!omapi_ds_strcmp (name, "link-name") ||
!omapi_ds_strcmp (name, "link-state"))
return ISC_R_NOPERM;
@@ -493,8 +513,9 @@ isc_result_t dhcp_failover_link_get_value (omapi_object_t *h,
return ISC_R_INVALIDARG;
link = (dhcp_failover_link_t *)h;
- if (!omapi_ds_strcmp (name, "port")) {
- return omapi_make_int_value (value, name, link -> port,
+ if (!omapi_ds_strcmp (name, "link-port")) {
+ return omapi_make_int_value (value, name,
+ (int)link -> peer_port,
"dhcp_failover_link_get_value");
} else if (!omapi_ds_strcmp (name, "link-name")) {
return omapi_make_string_value
@@ -502,7 +523,7 @@ isc_result_t dhcp_failover_link_get_value (omapi_object_t *h,
"dhcp_failover_link_get_value");
} else if (!omapi_ds_strcmp (name, "link-state")) {
if (link -> state < 0 ||
- link -> state >= dhcp_failover_link_state_max)
+ link -> state >= dhcp_flink_state_max)
return omapi_make_string_value
(value, name, "invalid link state",
"dhcp_failover_link_get_value");
@@ -520,13 +541,14 @@ isc_result_t dhcp_failover_link_get_value (omapi_object_t *h,
isc_result_t dhcp_failover_link_destroy (omapi_object_t *h, const char *name)
{
- dhcp_failover_link_t *p;
+ dhcp_failover_link_t *link;
if (h -> type != dhcp_type_failover_link)
return ISC_R_INVALIDARG;
- p = (dhcp_failover_link_object_t *)h;
- if (p -> message)
- omapi_object_dereference ((omapi_object_t **)&p -> message,
- name);
+ link = (dhcp_failover_link_t *)h;
+ if (link -> imsg) {
+ dfree (link -> imsg, "dhcp_failover_link_destroy");
+ link -> imsg = (failover_message_t *)0;
+ }
return ISC_R_SUCCESS;
}
@@ -535,21 +557,22 @@ isc_result_t dhcp_failover_link_destroy (omapi_object_t *h, const char *name)
isc_result_t dhcp_failover_link_stuff_values (omapi_object_t *c,
omapi_object_t *id,
- omapi_object_t *p)
+ omapi_object_t *l)
{
dhcp_failover_link_t *link;
+ isc_result_t status;
- if (h -> type != omapi_type_protocol)
+ if (l -> type != dhcp_type_failover_link)
return ISC_R_INVALIDARG;
- link = (dhcp_failover_link_t *)h;
+ link = (dhcp_failover_link_t *)l;
- status = omapi_connection_put_name (c, "port");
+ status = omapi_connection_put_name (c, "link-port");
if (status != ISC_R_SUCCESS)
return status;
- status = omapi_put_uint32 (c, sizeof (int));
+ status = omapi_connection_put_uint32 (c, sizeof (int));
if (status != ISC_R_SUCCESS)
return status;
- status = omapi_put_uint32 (c, link -> port);
+ status = omapi_connection_put_uint32 (c, link -> peer_port);
if (status != ISC_R_SUCCESS)
return status;
@@ -564,7 +587,7 @@ isc_result_t dhcp_failover_link_stuff_values (omapi_object_t *c,
if (status != ISC_R_SUCCESS)
return status;
if (link -> state < 0 ||
- link -> state >= dhcp_failover_link_state_max)
+ link -> state >= dhcp_flink_state_max)
status = omapi_connection_put_string (c, "invalid link state");
else
status = (omapi_connection_put_string
@@ -572,19 +595,19 @@ isc_result_t dhcp_failover_link_stuff_values (omapi_object_t *c,
if (status != ISC_R_SUCCESS)
return status;
- if (p -> inner && p -> inner -> type -> stuff_values)
- return (*(p -> inner -> type -> stuff_values)) (c, id,
- p -> inner);
+ if (link -> inner && link -> inner -> type -> stuff_values)
+ return (*(link -> inner -> type -> stuff_values)) (c, id,
+ link -> inner);
return ISC_R_SUCCESS;
}
/* Set up a listener for the omapi protocol. The handle stored points to
a listener object, not a protocol object. */
-isc_result_t dhcp_failover_listen (omapi_object_t *h);
+isc_result_t dhcp_failover_listen (omapi_object_t *h)
{
isc_result_t status;
- dhcp_failover_listener_object_t *obj;
+ dhcp_failover_listener_t *obj;
unsigned long port;
omapi_value_t *value = (omapi_value_t *)0;
@@ -592,19 +615,23 @@ isc_result_t dhcp_failover_listen (omapi_object_t *h);
"local-port", &value);
if (status != ISC_R_SUCCESS)
return status;
+ if (!value -> value) {
+ omapi_value_dereference (&value, "dhcp_failover_listen");
+ return ISC_R_INVALIDARG;
+ }
- status = omapi_get_int_value (&port, value);
- omapi_typed_data_dereference (&value, "dhcp_failover_listen");
+ status = omapi_get_int_value (&port, value -> value);
+ omapi_value_dereference (&value, "dhcp_failover_listen");
if (status != ISC_R_SUCCESS)
return status;
- obj = (dhcp_failover_listener_object_t *)malloc (sizeof *obj);
+ obj = (dhcp_failover_listener_t *)malloc (sizeof *obj);
if (!obj)
return ISC_R_NOMEMORY;
memset (obj, 0, sizeof *obj);
obj -> refcnt = 1;
obj -> type = dhcp_type_failover_listener;
- obj -> port = port;
+ obj -> local_port = port;
status = omapi_listen ((omapi_object_t *)obj, port, 1);
omapi_object_dereference ((omapi_object_t **)&obj,
@@ -638,14 +665,14 @@ isc_result_t dhcp_failover_listener_signal (omapi_object_t *o,
{
isc_result_t status;
omapi_connection_object_t *c;
- omapi_protocol_object_t *obj;
- dhcp_failover_listener_object_t *p;
- dhcp_failover_state_object_t *state;
+ dhcp_failover_link_t *obj;
+ dhcp_failover_listener_t *p;
+ dhcp_failover_state_t *state;
char *peer_name;
if (!o || o -> type != dhcp_type_failover_listener)
return ISC_R_INVALIDARG;
- p = (dhcp_failover_listener_object_t *)o;
+ p = (dhcp_failover_listener_t *)o;
/* Not a signal we recognize? */
if (strcmp (name, "connect")) {
@@ -661,13 +688,13 @@ isc_result_t dhcp_failover_listener_signal (omapi_object_t *o,
/* See if we can find a secondary failover_state object that
matches this connection. */
- for (state = states; state; state = state -> next) {
+ for (state = failover_states; state; state = state -> next) {
struct hostent *he;
int hix;
struct in_addr ia;
if (inet_aton (state -> remote_peer, &ia)) {
- if (ia == c -> remote_addr.sin_addr)
+ if (ia.s_addr == c -> remote_addr.sin_addr.s_addr)
break;
} else {
he = gethostbyname (state -> remote_peer);
@@ -695,26 +722,26 @@ isc_result_t dhcp_failover_listener_signal (omapi_object_t *o,
return ISC_R_INVALIDARG;
}
- obj = (omapi_protocol_object_t *)malloc (sizeof *obj);
+ obj = (dhcp_failover_link_t *)malloc (sizeof *obj);
if (!obj)
return ISC_R_NOMEMORY;
memset (obj, 0, sizeof *obj);
obj -> refcnt = 1;
- obj -> type = omapi_type_protocol;
+ obj -> type = dhcp_type_failover_link;
peer_name = malloc (strlen (state -> remote_peer) + 1);
if (!peer_name)
return ISC_R_NOMEMORY;
strcpy (peer_name, state -> remote_peer);
obj -> peer_name = peer_name;
- obj -> port = ntohs (c -> remote_addr.sin_port);
+ obj -> peer_port = ntohs (c -> remote_addr.sin_port);
- status = omapi_object_reference (&obj -> outer, c,
+ status = omapi_object_reference (&obj -> outer, (omapi_object_t *)c,
"dhcp_failover_listener_signal");
if (status != ISC_R_SUCCESS) {
lose:
omapi_object_dereference ((omapi_object_t **)&obj,
"dhcp_failover_listener_signal");
- omapi_disconnect (c, 1);
+ omapi_disconnect ((omapi_object_t *)c, 1);
return status;
}
@@ -725,7 +752,7 @@ isc_result_t dhcp_failover_listener_signal (omapi_object_t *o,
/* Notify the master state machine of the arrival of a new
connection. */
- status = omapi_signal (state, "connect", obj);
+ status = omapi_signal_in ((omapi_object_t *)state, "connect", obj);
if (status != ISC_R_SUCCESS)
goto lose;
@@ -790,10 +817,10 @@ isc_result_t dhcp_failover_listener_stuff (omapi_object_t *c,
/* Set up master state machine for the failover protocol. */
-isc_result_t dhcp_failover_register (omapi_object_t *h);
+isc_result_t dhcp_failover_register (omapi_object_t *h)
{
isc_result_t status;
- dhcp_failover_state_object_t *obj;
+ dhcp_failover_state_t *obj;
unsigned long port;
omapi_value_t *value = (omapi_value_t *)0;
@@ -801,19 +828,23 @@ isc_result_t dhcp_failover_register (omapi_object_t *h);
"local-port", &value);
if (status != ISC_R_SUCCESS)
return status;
+ if (!value -> value) {
+ omapi_value_dereference (&value, "dhcp_failover_register");
+ return ISC_R_INVALIDARG;
+ }
- status = omapi_get_int_value (&port, value);
- omapi_typed_data_dereference (&value, "dhcp_failover_listen");
+ status = omapi_get_int_value (&port, value -> value);
+ omapi_value_dereference (&value, "dhcp_failover_listen");
if (status != ISC_R_SUCCESS)
return status;
- obj = (dhcp_failover_state_object_t *)malloc (sizeof *obj);
+ obj = (dhcp_failover_state_t *)malloc (sizeof *obj);
if (!obj)
return ISC_R_NOMEMORY;
memset (obj, 0, sizeof *obj);
obj -> refcnt = 1;
obj -> type = dhcp_type_failover_state;
- obj -> port = port;
+ obj -> listen_port = port;
status = omapi_listen ((omapi_object_t *)obj, port, 1);
omapi_object_dereference ((omapi_object_t **)&obj,
@@ -847,25 +878,25 @@ isc_result_t dhcp_failover_state_signal (omapi_object_t *o,
isc_result_t status;
omapi_connection_object_t *c;
omapi_protocol_object_t *obj;
- dhcp_failover_state_object_t *p;
- dhcp_failover_state_object_t *state;
+ dhcp_failover_state_t *state;
char *peer_name;
if (!o || o -> type != dhcp_type_failover_state)
return ISC_R_INVALIDARG;
- p = (dhcp_failover_state_object_t *)o;
+ state = (dhcp_failover_state_t *)o;
/* Not a signal we recognize? */
if (strcmp (name, "connect") &&
strcmp (name, "disconnect") &&
strcmp (name, "message")) {
- if (p -> inner && p -> inner -> type -> signal_handler)
- return (*(p -> inner -> type -> signal_handler))
- (p -> inner, name, ap);
+ if (state -> inner && state -> inner -> type -> signal_handler)
+ return (*(state -> inner -> type -> signal_handler))
+ (state -> inner, name, ap);
return ISC_R_NOTFOUND;
}
-
+ /* Handle all the events we care about... */
+ return ISC_R_SUCCESS;
}
isc_result_t dhcp_failover_state_set_value (omapi_object_t *h,
diff --git a/server/mdb.c b/server/mdb.c
index d3712684..2f992ce0 100644
--- a/server/mdb.c
+++ b/server/mdb.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: mdb.c,v 1.20 1999/11/14 00:32:28 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: mdb.c,v 1.21 1999/11/20 18:36:32 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -867,7 +867,7 @@ int supersede_lease (comp, lease, commit)
/* Copy the data files, but not the linkages. */
comp -> starts = lease -> starts;
if (lease -> uid) {
- if (lease -> uid_len < sizeof (lease -> uid_buf)) {
+ if (lease -> uid_len <= sizeof (lease -> uid_buf)) {
memcpy (comp -> uid_buf,
lease -> uid, lease -> uid_len);
comp -> uid = &comp -> uid_buf [0];
@@ -948,9 +948,9 @@ int supersede_lease (comp, lease, commit)
break;
if (lp && lp -> on_expiry) {
comp -> pool -> next_expiry = lp;
- if (commit)
- add_timeout (lp -> ends,
- pool_timer, lp -> pool);
+ if (commit)
+ add_timeout (lp -> ends,
+ pool_timer, lp -> pool);
} else {
comp -> pool -> next_expiry = (struct lease *)0;
if (commit)
@@ -1096,22 +1096,13 @@ void release_lease (lease, packet)
#endif
/* If there are statements to execute when the lease is
- committed, execute them. */
+ released, execute them. */
if (lease -> on_release) {
execute_statements (packet, lease, packet -> options,
(struct option_state *)0, /* XXX */
lease -> on_release);
executable_statement_dereference (&lease -> on_release,
"dhcprelease");
-
- if (lease -> ddns_fwd_name) {
- dfree (lease -> ddns_fwd_name, "pool_timer");
- lease -> ddns_fwd_name = (char *)0;
- }
- if (lease -> ddns_rev_name) {
- dfree (lease -> ddns_rev_name, "pool_timer");
- lease -> ddns_rev_name = (char *)0;
- }
}
/* We do either the on_release or the on_expiry events, but
diff --git a/server/omapi.c b/server/omapi.c
index b17e77ec..2c710f9a 100644
--- a/server/omapi.c
+++ b/server/omapi.c
@@ -29,7 +29,7 @@
#ifndef lint
static char copyright[] =
-"$Id: omapi.c,v 1.20 1999/11/14 00:39:33 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: omapi.c,v 1.21 1999/11/20 18:36:32 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -41,9 +41,11 @@ omapi_object_type_t *dhcp_type_pool;
omapi_object_type_t *dhcp_type_shared_network;
omapi_object_type_t *dhcp_type_subnet;
omapi_object_type_t *dhcp_type_class;
+#if defined (FAILOVER_PROTOCOL)
omapi_object_type_t *dhcp_type_failover_state;
omapi_object_type_t *dhcp_type_failover_link;
omapi_object_type_t *dhcp_type_failover_listener;
+#endif
void dhcp_db_objects_setup ()
{
diff --git a/server/stables.c b/server/stables.c
index 0d48c52d..37dd69ec 100644
--- a/server/stables.c
+++ b/server/stables.c
@@ -22,73 +22,74 @@
#ifndef lint
static char copyright[] =
-"$Id: stables.c,v 1.1 1999/11/14 00:36:51 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: stables.c,v 1.2 1999/11/20 18:36:32 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
#if defined (FAILOVER_PROTOCOL)
-struct failover_option ft_options [] =
+struct failover_option_info ft_options [] =
{
- { 0, "unused", FT_UNDEF, 0, 0 },
- { 1, "binding-status",
- FT_UINT8, 1, FM_OFFSET (binding_status) },
- { 2, "assigned-IP-address",
- FT_IPADDR, 1, FM_OFFSET (assigned_addr) },
- { 3, "sending-server-IP-address",
- FT_IPADDR, 1, FM_OFFSET (sending_server) },
- { 4, "addresses-transferred",
- FT_UINT32, 1, FM_OFFSET (addresses_transferred) },
- { 5, "client-identifier",
- FT_BYTES, 0, FM_OFFSET (client_identifier) },
- { 6, "client-hardware-address",
- FT_BYTES, 0, FM_OFFSET (chaddr) },
- { 7, "DDNS",
- FT_DDNS, 1, FM_OFFSET (ddns) },
- { 8, "reject-reason",
- FT_UINT8, 1, FM_OFFSET (reject_reason) },
- { 9, "message",
- FT_TEXT, 0, FM_OFFSET (message) },
- { 10, "MCLT",
- FT_UINT32, 1, FM_OFFSET (mclt) },
- { 11, "vendor-class-identifier",
- FT_BYTES, 0, FM_OFFSET (vendor_class) },
- { 12, "undefined", FT_UNDEF, 0, 0 },
- { 13, "lease-expiration-time",
- FT_UINT32, 1, FM_OFFSET (expiry) },
- { 14, "potential-expiration-time",
- FT_UINT32, 1, FM_OFFSET (potential_expiry) },
- { 15, "grace-expiration-time",
- FT_UINT32, 1, FM_OFFSET (grace_expiry) },
- { 16, "client-last-transaction-time",
- FT_UINT32, 1, FM_OFFSET (client_ltt) },
- { 17, "start-time-of-state",
- FT_UINT32, 1, FM_OFFSET (stos) },
- { 18, "server-state",
- FT_UINT8, 1, FM_OFFSET (server_state) },
- { 19, "server-flags",
- FT_UINT8, 1, FM_OFFSET (server_flags) },
- { 20, "vendor-specific-options",
- FT_BYTES, 0, FM_OFFSET (vendor_options) },
- { 21, "max-unacked-bndupd",
- FT_UINT32, 1, FM_OFFSET (max_unacked) },
+ { 0, "unused", FT_UNDEF, 0, 0, 0 },
+ { FTO_BINDING_STATUS, "binding-status",
+ FT_UINT8, 1, FM_OFFSET (binding_status), FTB_BINDING_STATUS },
+ { FTO_ASSIGNED_IP_ADDRESS, "assigned-IP-address",
+ FT_IPADDR, 1, FM_OFFSET (assigned_addr), FTB_ASSIGNED_IP_ADDRESS },
+ { FTO_SERVER_ADDR, "sending-server-IP-address",
+ FT_IPADDR, 1, FM_OFFSET (sending_server), FTB_SERVER_ADDR },
+ { FTO_ADDRESSES_TRANSFERRED, "addresses-transferred",
+ FT_UINT32, 1, FM_OFFSET (addresses_transferred),
+ FTB_ADDRESSES_TRANSFERRED },
+ { FTO_CLIENT_IDENTIFIER, "client-identifier",
+ FT_BYTES, 0, FM_OFFSET (client_identifier), FTB_CLIENT_IDENTIFIER },
+ { FTO_CLIENT_HARDWARE_ADDRESS, "client-hardware-address",
+ FT_BYTES, 0, FM_OFFSET (chaddr), FTB_CLIENT_HARDWARE_ADDRESS },
+ { FTO_DDNS, "DDNS",
+ FT_DDNS, 1, FM_OFFSET (ddns), FTB_DDNS },
+ { FTO_REJECT_REASON, "reject-reason",
+ FT_UINT8, 1, FM_OFFSET (reject_reason), FTB_REJECT_REASON },
+ { FTO_MESSAGE, "message",
+ FT_TEXT, 0, FM_OFFSET (message), FTB_MESSAGE },
+ { FTO_MCLT, "MCLT",
+ FT_UINT32, 1, FM_OFFSET (mclt), FTB_MCLT },
+ { FTO_VENDOR_CLASS, "vendor-class-identifier",
+ FT_BYTES, 0, FM_OFFSET (vendor_class), FTB_VENDOR_CLASS },
+ { FTO_UNDEFINED, "undefined", FT_UNDEF, 0, 0, FTB_UNDEFINED },
+ { FTO_LEASE_EXPIRY, "lease-expiration-time",
+ FT_UINT32, 1, FM_OFFSET (expiry), FTB_LEASE_EXPIRY },
+ { FTO_POTENTIAL_EXPIRY, "potential-expiration-time",
+ FT_UINT32, 1, FM_OFFSET (potential_expiry), FTB_POTENTIAL_EXPIRY },
+ { FTO_GRACE_EXPIRY, "grace-expiration-time",
+ FT_UINT32, 1, FM_OFFSET (grace_expiry), FTB_GRACE_EXPIRY },
+ { FTO_CLTT, "client-last-transaction-time",
+ FT_UINT32, 1, FM_OFFSET (client_ltt), FTB_CLTT },
+ { FTO_STOS, "start-time-of-state",
+ FT_UINT32, 1, FM_OFFSET (stos), FTB_STOS },
+ { FTO_SERVER_STATE, "server-state",
+ FT_UINT8, 1, FM_OFFSET (server_state), FTB_SERVER_STATE },
+ { FTO_SERVER_FLAGS, "server-flags",
+ FT_UINT8, 1, FM_OFFSET (server_flags), FTB_SERVER_FLAGS },
+ { FTO_VENDOR_OPTIONS, "vendor-specific-options",
+ FT_BYTES, 0, FM_OFFSET (vendor_options), FTB_VENDOR_OPTIONS },
+ { FTO_MAX_UNACKED, "max-unacked-bndupd",
+ FT_UINT32, 1, FM_OFFSET (max_unacked), FTB_MAX_UNACKED },
{ 22, "undefined", FT_UNDEF, 0, 0 },
- { 23, "receive-timer",
- FT_UINT32, 1, FM_OFFSET (receive_timer) },
- { 24, "hash-bucket-assignment",
- FT_BYTES, 0, FM_OFFSET (hba) },
- { 25, "message-digest",
- FT_DIGEST, 0, 0 },
- { 26, "protocol-version",
- FT_UINT8, 1, FM_OFFSET (protocol_version) },
- { 27, "TLS-request",
- FT_UINT8, 2, FM_OFFSET (tls_request) },
- { 28, "TLS-reply",
- FT_BYTES, 1, FM_OFFSET (tls_reply ) },
- { 29, "client-request-options",
- FT_BYTES, 0, FM_OFFSET (request_options) },
- { 30, "client-reply-options",
- FT_BYTES, 0, FM_OFFSET (reply_options) }
+ { FTO_RECEIVE_TIMER, "receive-timer",
+ FT_UINT32, 1, FM_OFFSET (receive_timer), FTB_RECEIVE_TIMER },
+ { FTO_HBA, "hash-bucket-assignment",
+ FT_BYTES, 0, FM_OFFSET (hba), FTB_HBA },
+ { FTO_MESSAGE_DIGEST, "message-digest",
+ FT_DIGEST, 0, 0, FTB_MESSAGE_DIGEST },
+ { FTO_PROTOCOL_VERSION, "protocol-version",
+ FT_UINT8, 1, FM_OFFSET (protocol_version), FTB_PROTOCOL_VERSION },
+ { FTO_TLS_REQUEST, "TLS-request",
+ FT_UINT8, 2, FM_OFFSET (tls_request), FTB_TLS_REQUEST },
+ { FTO_TLS_REPLY, "TLS-reply",
+ FT_BYTES, 1, FM_OFFSET (tls_reply ), FTB_TLS_REPLY },
+ { FTO_REQUEST_OPTIONS, "client-request-options",
+ FT_BYTES, 0, FM_OFFSET (request_options), FTB_REQUEST_OPTIONS },
+ { FTO_REPLY_OPTIONS, "client-reply-options",
+ FT_BYTES, 0, FM_OFFSET (reply_options), FTB_REPLY_OPTIONS }
};
/* These are really options that make sense for a particular request - if
@@ -132,6 +133,14 @@ int ft_sizes [] = {
0, /* FT_UNDEF */
0, /* FT_DIGEST */
};
+
+char *dhcp_flink_state_names [] = {
+ "invalid state 0",
+ "startup",
+ "message length wait",
+ "message wait",
+ "disconnected"
+};
#endif /* FAILOVER_PROTOCOL */
struct universe agent_universe;