#ifndef lint
static char ocopyright[] =
-"$Id: dhclient.c,v 1.89 1999/11/13 23:49:41 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: dhclient.c,v 1.90 1999/11/20 18:36:03 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
if (!mktemp (scriptName))
log_fatal ("can't create temporary script %s: %m",
scriptName);
- fd = creat (scriptName, 0600);
- } while (fd < 0 && errno == EEXISTS);
+ fd = open (scriptName, O_EXCL | O_CREAT | O_WRONLY, 0600);
+ } while (fd < 0 && errno == EEXIST);
#endif
if (fd < 0)
log_fatal ("can't create temporary script %s: %m", scriptName);
any server responding to the client send the client its
values for the specified options. Only the option names
should be specified in the request statement - not option
- parameters.
+ parameters. By default, the DHCP server requests the
+ subnet-mask, broadcast-address, time-offset, routers,
+ domain-name, domain-name-servers and host-name options.
+
+ In some cases, it may be desirable to send no parameter
+ request list at all. To do this, simply write the
+ request statement but specify no parameters:
+
+ request;
_\bT_\bh_\be r\bre\beq\bqu\bui\bir\bre\be _\bs_\bt_\ba_\bt_\be_\bm_\be_\bn_\bt
_\bT_\bh_\be s\bse\ben\bnd\bd _\bs_\bt_\ba_\bt_\be_\bm_\be_\bn_\bt
- s\bse\ben\bnd\bd {\b{ [\b[ _\bo_\bp_\bt_\bi_\bo_\bn _\bd_\be_\bc_\bl_\ba_\br_\ba_\bt_\bi_\bo_\bn ] [,\b, _\b._\b._\b. _\bo_\bp_\bt_\bi_\bo_\bn _\bd_\be_\bc_\bl_\ba_\br_\ba_\bt_\bi_\bo_\bn
- ]}\b}
-
- The send statement causes the client to send the specified
- options to the server with the specified values. These
- are full option declarations as described in d\bdh\bhc\bcp\bp-\b-
- o\bop\bpt\bti\bio\bon\bns\bs(\b(5\b5)\b). Options that are always sent in the DHCP
-
3
dhclient.conf(5) dhclient.conf(5)
- protocol should not be specified here, except that the
- client can specify a r\bre\beq\bqu\bue\bes\bst\bte\bed\bd-\b-l\ble\bea\bas\bse\be-\b-t\bti\bim\bme\be option other
- than the default requested lease time, which is two hours.
- The other obvious use for this statement is to send infor
- mation to the server that will allow it to differentiate
+ s\bse\ben\bnd\bd {\b{ [\b[ _\bo_\bp_\bt_\bi_\bo_\bn _\bd_\be_\bc_\bl_\ba_\br_\ba_\bt_\bi_\bo_\bn ] [,\b, _\b._\b._\b. _\bo_\bp_\bt_\bi_\bo_\bn _\bd_\be_\bc_\bl_\ba_\br_\ba_\bt_\bi_\bo_\bn
+ ]}\b}
+
+ The send statement causes the client to send the specified
+ options to the server with the specified values. These
+ are full option declarations as described in d\bdh\bhc\bcp\bp-\b-
+ o\bop\bpt\bti\bio\bon\bns\bs(\b(5\b5)\b). Options that are always sent in the DHCP pro
+ tocol should not be specified here, except that the client
+ can specify a r\bre\beq\bqu\bue\bes\bst\bte\bed\bd-\b-l\ble\bea\bas\bse\be-\b-t\bti\bim\bme\be option other than the
+ default requested lease time, which is two hours. The
+ other obvious use for this statement is to send informa
+ tion to the server that will allow it to differentiate
between this client and other clients or kinds of clients.
O\bOP\bPT\bTI\bIO\bON\bN M\bMO\bOD\bDI\bIF\bFI\bIE\bER\bRS\bS
_\bT_\bh_\be a\bap\bpp\bpe\ben\bnd\bd _\bs_\bt_\ba_\bt_\be_\bm_\be_\bn_\bt
- a\bap\bpp\bpe\ben\bnd\bd [\b[ _\bo_\bp_\bt_\bi_\bo_\bn _\bd_\be_\bc_\bl_\ba_\br_\ba_\bt_\bi_\bo_\bn ] ;\b;
-
- If for some set of options the client should first use the
- values supplied by the server, if any, and then use values
- you supply, these values can be defined in the a\bap\bpp\bpe\ben\bnd\bd
- statement. The a\bap\bpp\bpe\ben\bnd\bd statement can only be used for
-
4
dhclient.conf(5) dhclient.conf(5)
+ a\bap\bpp\bpe\ben\bnd\bd [\b[ _\bo_\bp_\bt_\bi_\bo_\bn _\bd_\be_\bc_\bl_\ba_\br_\ba_\bt_\bi_\bo_\bn ] ;\b;
+
+ If for some set of options the client should first use the
+ values supplied by the server, if any, and then use values
+ you supply, these values can be defined in the a\bap\bpp\bpe\ben\bnd\bd
+ statement. The a\bap\bpp\bpe\ben\bnd\bd statement can only be used for
options which allow more than one value to be given.
This restriction is not enforced - if you ignore it, the
behaviour will be unpredictable.
the client receives a lease from a server, it always
records the interface number on which it received that
lease. If predefined leases are specified in the
- dhclient.conf file, the interface should also be speci
- fied, although this is not required.
-
- f\bfi\bix\bxe\bed\bd-\b-a\bad\bdd\bdr\bre\bes\bss\bs _\bi_\bp_\b-_\ba_\bd_\bd_\br_\be_\bs_\bs;\b;
-
- The f\bfi\bix\bxe\bed\bd-\b-a\bad\bdd\bdr\bre\bes\bss\bs statement is used to set the ip address
dhclient.conf(5) dhclient.conf(5)
+ dhclient.conf file, the interface should also be speci
+ fied, although this is not required.
+
+ f\bfi\bix\bxe\bed\bd-\b-a\bad\bdd\bdr\bre\bes\bss\bs _\bi_\bp_\b-_\ba_\bd_\bd_\br_\be_\bs_\bs;\b;
+
+ The f\bfi\bix\bxe\bed\bd-\b-a\bad\bdd\bdr\bre\bes\bss\bs statement is used to set the ip address
of a particular lease. This is required for all lease
statements. The IP address must be specified as a dotted
quad (e.g., 12.34.56.78).
passed on the ifconfig command line when configuring te
interface.
- The dhcp client automatically declares this parameter if
- it used a media type (see the m\bme\bed\bdi\bia\ba statement) when con
- figuring the interface in order to obtain a lease. This
- statement should be used in predefined leases only if the
- network interface requires media type configuration.
-
dhclient.conf(5) dhclient.conf(5)
+ The dhcp client automatically declares this parameter if
+ it used a media type (see the m\bme\bed\bdi\bia\ba statement) when con
+ figuring the interface in order to obtain a lease. This
+ statement should be used in predefined leases only if the
+ network interface requires media type configuration.
+
r\bre\ben\bne\bew\bw _\bd_\ba_\bt_\be;\b;
r\bre\beb\bbi\bin\bnd\bd _\bd_\ba_\bt_\be;\b;
the dhcp client can be set up to configure an IP alias
using the a\bal\bli\bia\bas\bs declaration.
- The alias declaration resembles a lease declaration,
- except that options other than the subnet-mask option are
- ignored by the standard client configuration script, and
- expiry times are ignored. A typical alias declaration
- includes an interface declaration, a fixed-address
-
7
dhclient.conf(5) dhclient.conf(5)
- declaration for the IP alias address, and a subnet-mask
- option declaration. A medium statement should never be
- included in an alias declaration.
+ The alias declaration resembles a lease declaration,
+ except that options other than the subnet-mask option are
+ ignored by the standard client configuration script, and
+ expiry times are ignored. A typical alias declaration
+ includes an interface declaration, a fixed-address decla
+ ration for the IP alias address, and a subnet-mask option
+ declaration. A medium statement should never be included
+ in an alias declaration.
O\bOT\bTH\bHE\bER\bR D\bDE\bEC\bCL\bLA\bAR\bRA\bAT\bTI\bIO\bON\bNS\bS
r\bre\bej\bje\bec\bct\bt _\bi_\bp_\b-_\ba_\bd_\bd_\br_\be_\bs_\bs;\b;
script "/etc/dhclient-secondary";
}
- The client script for the pseudo-interface should not con
- figure the interface up or down - essentially, all it
- needs to handle are the states where a lease has been
- acquired or renewed, and the states where a lease has
-
8
dhclient.conf(5) dhclient.conf(5)
+ The client script for the pseudo-interface should not con
+ figure the interface up or down - essentially, all it
+ needs to handle are the states where a lease has been
+ acquired or renewed, and the states where a lease has
expired. See d\bdh\bhc\bcl\bli\bie\ben\bnt\bt-\b-s\bsc\bcr\bri\bip\bpt\bt(\b(8\b8)\b) for more information.
m\bme\bed\bdi\bia\ba "\b"_\bm_\be_\bd_\bi_\ba _\bs_\be_\bt_\bu_\bp"\b" _\b[ ,\b, "\b"_\bm_\be_\bd_\bi_\ba _\bs_\be_\bt_\bu_\bp"\b",\b, _\b._\b._\b. _\b];\b;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name;
require subnet-mask, domain-name-servers;
- script "/etc/dhclient-script";
- media "media 10baseT/UTP", "media 10base2/BNC";
- }
-
dhclient.conf(5) dhclient.conf(5)
+ script "/etc/dhclient-script";
+ media "media 10baseT/UTP", "media 10base2/BNC";
+ }
+
alias {
interface "ep0";
fixed-address 192.5.5.213;
-
-
-
-
#ifndef lint
static char copyright[] =
-"$Id: nsupdate.c,v 1.13 1999/10/25 15:14:52 mellon Exp $ Copyright (c) 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: nsupdate.c,v 1.14 1999/11/20 18:36:09 mellon Exp $ Copyright (c) 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
}
break;
}
- z = res_update(u);
+ z = res_update (u);
log_info ("%s %s: %s %ld IN PTR %s", opcode == ADD ? "add" :
"delete", z == 1 ? "succeeded" : "failed",
NAME (revname), (unsigned long)ttl, NAME (u -> r_data));
int y;
hostname[0] = '\0';
- strncat(hostname, (const char *)lhs -> data, lhs -> len);
+ strncat (hostname, (const char *)lhs -> data, lhs -> len);
hostname[lhs -> len] = '\0';
ipaddr[0] = '\0';
- strncat(ipaddr, (const char *)rhs -> data, rhs -> len);
+ strncat (ipaddr, (const char *)rhs -> data, rhs -> len);
ipaddr[rhs -> len] = '\0';
#if 0 /* Wrong! This causes zone churn on every DHCPREQUEST!
if (y < 1)
return 0;
- /* remember this in the lease structure for release */
- lease -> ddns_fwd_name = dmalloc (strlen(hostname) + 1, "nsupdate");
- strcpy (lease -> ddns_fwd_name, hostname);
-
return 1;
}
int y;
revname[0] = '\0';
- strncat(revname, (const char *)lhs -> data, lhs -> len);
+ strncat (revname, (const char *)lhs -> data, lhs -> len);
revname[lhs -> len] = '\0';
hostname[0] = '\0';
- strncat(hostname, (const char *)rhs -> data, rhs -> len);
+ strncat (hostname, (const char *)rhs -> data, rhs -> len);
hostname[rhs -> len] = '\0';
#if 0 /* Wrong! This causes zone churn on every DHCPREQUEST!
if (y < 1)
return 0;
- /* remember this in the lease structure for release */
- lease -> ddns_rev_name = dmalloc (strlen(revname) + 1, "nsupdate");
- strcpy (lease -> ddns_rev_name, revname);
-
return 1;
}
int y;
hostname[0] = '\0';
- strncat(hostname, (const char *)lhs -> data, lhs -> len);
+ strncat (hostname, (const char *)lhs -> data, lhs -> len);
hostname[lhs -> len] = '\0';
ipaddr[0] = '\0';
- strncat(ipaddr, (const char *)rhs -> data, rhs -> len);
+ strncat (ipaddr, (const char *)rhs -> data, rhs -> len);
ipaddr[rhs -> len] = '\0';
#if 0 /* Wrong! This causes zone churn on every DHCPREQUEST!
int y;
revname[0] = '\0';
- strncat(revname, (const char *)lhs -> data, lhs -> len);
+ strncat (revname, (const char *)lhs -> data, lhs -> len);
revname[lhs -> len] = '\0';
hostname[0] = '\0';
- strncat(hostname, (const char *)rhs -> data, rhs -> len);
+ strncat (hostname, (const char *)rhs -> data, rhs -> len);
hostname[rhs -> len] = '\0';
#if 0 /* Wrong! This causes zone churn on every DHCPREQUEST!
#ifndef lint
static char copyright[] =
-"$Id: parse.c,v 1.55 1999/11/13 23:53:57 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: parse.c,v 1.56 1999/11/20 18:36:09 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
goto nocomma;
if (!(parse_data_expression
- (&(*expr) -> data.dns_update.expr1, cfile, lose)))
+ (&(*expr) -> data.dns_update.rrname, cfile, lose)))
goto nodata;
token = next_token (&val, cfile);
goto nocomma;
if (!(parse_data_expression
- (&(*expr) -> data.dns_update.expr2, cfile, lose)))
+ (&(*expr) -> data.dns_update.rrdata, cfile, lose)))
goto nodata;
token = next_token (&val, cfile);
goto nocomma;
if (!(parse_data_expression
- (&(*expr) -> data.dns_update.expr1, cfile, lose)))
+ (&(*expr) -> data.dns_update.rrname, cfile, lose)))
goto nodata;
token = next_token (&val, cfile);
goto nocomma;
if (!(parse_data_expression
- (&(*expr) -> data.dns_update.expr2, cfile, lose)))
+ (&(*expr) -> data.dns_update.rrdata, cfile, lose)))
goto nodata;
token = next_token (&val, cfile);
#ifndef lint
static char copyright[] =
-"$Id: print.c,v 1.28 1999/11/14 00:01:08 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: print.c,v 1.29 1999/11/20 18:36:10 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
buf + rv, len - rv - 4);
buf [rv++] = ' ';
rv += print_subexpression
- (expr -> data.dns_update.expr1,
+ (expr -> data.dns_update.rrname,
buf + rv, len - rv - 3);
buf [rv++] = ' ';
rv += print_subexpression
- (expr -> data.dns_update.expr2,
+ (expr -> data.dns_update.rrdata,
buf + rv, len - rv - 2);
buf [rv++] = ' ';
rv += print_subexpression
#ifndef lint
static char copyright[] =
-"$Id: tree.c,v 1.64 1999/11/03 16:10:41 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
+"$Id: tree.c,v 1.65 1999/11/20 18:36:10 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
struct expression *expr;
{
struct data_string left, right;
- struct data_string rrtype, expr1, expr2;
+ struct data_string rrtype, rrname, rrdata;
unsigned long ttl;
- int s0, s1, s2, s3;
+ int srrtype, srrname, srrdata, sttl;
int bleft, bright;
int sleft, sright;
if (!packet || packet -> packet_type != DHCPREQUEST)
return 0;
memset (&rrtype, 0, sizeof rrtype);
- s0 = evaluate_data_expression (&rrtype, packet, lease,
+ srrtype = evaluate_data_expression (&rrtype, packet, lease,
in_options, cfg_options,
expr -> data.dns_update.type);
- memset (&expr1, 0, sizeof expr1);
- s1 = evaluate_data_expression (&expr1, packet, lease,
+ memset (&rrname, 0, sizeof rrname);
+ srrname = evaluate_data_expression (&rrname, packet, lease,
in_options, cfg_options,
- expr -> data.dns_update.expr1);
- memset (&expr2, 0, sizeof expr2);
- s2 = evaluate_data_expression (&expr2, packet, lease,
+ expr -> data.dns_update.rrname);
+ memset (&rrdata, 0, sizeof rrdata);
+ srrdata = evaluate_data_expression (&rrdata, packet, lease,
in_options, cfg_options,
- expr -> data.dns_update.expr2);
- s3 = evaluate_numeric_expression (&ttl, packet, lease,
+ expr -> data.dns_update.rrdata);
+ sttl = evaluate_numeric_expression (&ttl, packet, lease,
in_options, cfg_options,
expr -> data.dns_update.ttl);
*result = 0; /* assume failure */
- if (s0 && s1 && s2 && s3) {
- if (rrtype.len == 1 &&
- strncmp((const char *)rrtype.data, "a", 1) == 0) {
+ if (!sttl) {
+ log_error("dns-update: RR type subexpression %s",
+ "evaluates to NULL.");
+ goto done_dns_update;
+ }
+ if (!srrname) {
+ log_error("dns-update: RR name subexpression %s",
+ "evaluates to NULL.");
+ goto done_dns_update;
+ }
+ if (!srrdata) {
+ log_error("dns-update: RR data subexpression %s",
+ "evaluates to NULL.");
+ goto done_dns_update;
+ }
+ if (!srrtype) {
+ log_error("dns-update: RR ttl subexpression %s",
+ "evaluates to NULL.");
+ goto done_dns_update;
+ }
+ if (rrtype.len == 1 &&
+ strncmp((const char *)rrtype.data, "a", 1) == 0) {
#if defined (DEBUG_EXPRESSIONS)
- log_debug("calling updateA(%s, %s, %ld, lease)",
- expr1.data, expr2.data, ttl);
+ log_debug("calling updateA(%s, %s, %ld, lease)",
+ rrname.data, rrdata.data, ttl);
#endif
- updateA(&expr1, &expr2, ttl, lease);
- } else if (rrtype.len == 3 &&
- strncmp((const char *)rrtype.data,
- "ptr", 3) == 0) {
+ if (!updateA(&rrname, &rrdata, ttl, lease)) {
+ log_error("dns-update: DNS add of A %s",
+ "record failed");
+ goto done_dns_update;
+ }
+ /* remember this in the lease structure for release */
+ lease -> ddns_fwd_name = dmalloc (rrname.len,
+ "evaluate_boolean_expression");
+ strncpy (lease -> ddns_fwd_name, rrname.data,
+ rrname.len);
+
+ } else if (rrtype.len == 3 &&
+ strncmp((const char *)rrtype.data, "ptr", 3) == 0) {
#if defined (DEBUG_EXPRESSIONS)
log_debug ("%s updatePTR(%s, %s, %ld, lease)",
- "calling", expr1.data, expr2.data, ttl);
+ "calling", rrname.data, rrdata.data, ttl);
#endif
- updatePTR(&expr1, &expr2, ttl, lease);
- }
- *result = 1;
- } else {
- log_error("dns-update: one or more subexpressions %s",
- "evaluate to NULL.");
- return 0;
+ if (!updatePTR(&rrname, &rrdata, ttl, lease)) {
+ log_error("dns-update: DNS add of PTR %s",
+ "record failed");
+ goto done_dns_update;
+ }
+ /* remember this in the lease structure for release */
+ lease -> ddns_rev_name = dmalloc (rrname.len,
+ "evaluate_boolean_expression");
+ strncpy (lease -> ddns_rev_name, rrname.data,
+ rrname.len);
}
+ *result = 1;
#if defined (DEBUG_EXPRESSIONS)
log_debug ("dns-update (%s, %s, %s):",
print_hex_1(rrtype.len, rrtype.data, 60),
- print_hex_2(expr1.len, expr1.data, 60),
- print_hex_3(expr2.len, expr2.data, 60));
+ print_hex_2(rrname.len, rrname.data, 60),
+ print_hex_3(rrdata.len, rrdata.data, 60));
#endif
- return 1;
+ done_dns_update:
+ if (srrname)
+ data_string_forget (&rrname,
+ "evaluate_boolean_expression");
+ if (srrdata)
+ data_string_forget (&rrdata,
+ "evaluate_boolean_expression");
+ if (srrtype)
+ data_string_forget (&rrtype,
+ "evaluate_boolean_expression");
+ return *result;
#endif /* NSUPDATE */
case expr_dns_delete:
return 0;
#else
memset (&rrtype, 0, sizeof rrtype);
- s0 = evaluate_data_expression (&rrtype, packet, lease,
+ srrtype = evaluate_data_expression (&rrtype, packet, lease,
in_options, cfg_options,
expr -> data.dns_update.type);
- memset (&expr1, 0, sizeof expr1);
- s1 = evaluate_data_expression (&expr1, packet, lease,
+ memset (&rrname, 0, sizeof rrname);
+ srrname = evaluate_data_expression (&rrname, packet, lease,
in_options, cfg_options,
- expr -> data.dns_update.expr1);
- memset (&expr2, 0, sizeof expr2);
- s2 = evaluate_data_expression (&expr2, packet, lease,
+ expr -> data.dns_update.rrname);
+ memset (&rrdata, 0, sizeof rrdata);
+ srrdata = evaluate_data_expression (&rrdata, packet, lease,
in_options, cfg_options,
- expr -> data.dns_update.expr2);
+ expr -> data.dns_update.rrdata);
*result = 0; /* assume failure */
- if (s0 && s1 && s2) {
- if (rrtype.len == 1 &&
- strncmp((const char *)rrtype.data, "a", 1) == 0) {
+ if (!srrtype) {
+ log_error("dns-delete: RR type subexpression %s",
+ "evaluates to NULL.");
+ goto done_dns_delete;
+ }
+ if (!srrname) {
+ log_error("dns-delete: RR name subexpression %s",
+ "evaluates to NULL.");
+ goto done_dns_delete;
+ }
+ if (!srrdata) {
+ log_error("dns-delete: RR data subexpression %s",
+ "evaluates to NULL.");
+ goto done_dns_delete;
+ }
+ if (rrtype.len == 1 &&
+ strncmp((const char *)rrtype.data, "a", 1) == 0) {
#if defined (DEBUG_EXPRESSIONS)
- log_debug("calling deleteA(%s, %s, lease)",
- expr1.data , expr2.data);
+ log_debug("calling deleteA(%s, %s, lease)",
+ rrname.data , rrdata.data);
#endif
- deleteA(&expr1, &expr2, lease);
- } else if (rrtype.len == 3 &&
- strncmp((const char *)rrtype.data,
- "ptr", 3) == 0) {
+ if (!deleteA(&rrname, &rrdata, lease)) {
+ log_error("dns-delete: DNS delete of A %s",
+ "record failed");
+ goto done_dns_delete;
+ }
+ if (lease -> ddns_fwd_name) {
+ dfree (lease -> ddns_fwd_name,
+ "evaluate_boolean_expression");
+ lease -> ddns_fwd_name = (char *)0;
+ }
+ } else if (rrtype.len == 3 &&
+ strncmp((const char *)rrtype.data, "ptr", 3) == 0) {
#if defined (DEBUG_EXPRESSIONS)
- log_debug ("%s deletePTR(%s, %s, lease)",
- "calling", expr1.data,
- expr2.data);
+ log_debug ("calling deletePTR(%s, %s, lease)",
+ rrname.data, rrdata.data);
#endif
- deletePTR(&expr1, &expr2, lease);
+ if (!deletePTR(&rrname, &rrdata, lease)) {
+ log_error("dns-delete: DNS delete of PTR %s",
+ "record failed");
+ goto done_dns_delete;
+ }
+ if (lease -> ddns_rev_name) {
+ dfree (lease -> ddns_rev_name,
+ "evaluate_boolean_expression");
+ lease -> ddns_rev_name = (char *)0;
}
- *result = 1;
- } else {
- log_error("dns-update: one or more subexpressions %s",
- "evaluate to NULL.");
- return 0;
}
+ *result = 1;
#if defined (DEBUG_EXPRESSIONS)
log_debug ("dns-delete (%s, %s, %s):",
print_hex_1(rrtype.len, rrtype.data, 60),
- print_hex_2(expr1.len, expr1.data, 60),
- print_hex_3(expr2.len, expr2.data, 60));
+ print_hex_2(rrname.len, rrname.data, 60),
+ print_hex_3(rrdata.len, rrdata.data, 60));
#endif
- return 1;
+ done_dns_delete:
+ if (srrname)
+ data_string_forget (&rrname,
+ "evaluate_boolean_expression");
+ if (srrdata)
+ data_string_forget (&rrdata,
+ "evaluate_boolean_expression");
+ if (srrtype)
+ data_string_forget (&rrtype,
+ "evaluate_boolean_expression");
+ return *result;
#endif /* NSUPDATE */
case expr_none:
if (expr -> data.dns_update.type)
expression_dereference (&expr -> data.dns_update.type,
name);
- if (expr -> data.dns_update.expr1)
- expression_dereference (&expr -> data.dns_update.expr1,
+ if (expr -> data.dns_update.rrname)
+ expression_dereference (&expr -> data.dns_update.rrname,
name);
- if (expr -> data.dns_update.expr2)
- expression_dereference (&expr -> data.dns_update.expr2,
+ if (expr -> data.dns_update.rrdata)
+ expression_dereference (&expr -> data.dns_update.rrdata,
name);
if (expr -> data.dns_update.ttl)
expression_dereference (&expr -> data.dns_update.ttl,
col, scol);
col = token_print_indent (file, col, scol, "", " ",
",");
- col = write_expression (file, expr -> data.dns_update.expr1,
+ col = write_expression (file, expr -> data.dns_update.rrname,
col, scol);
col = token_print_indent (file, col, scol, "", " ",
",");
- col = write_expression (file, expr -> data.dns_update.expr2,
+ col = write_expression (file, expr -> data.dns_update.rrdata,
col, scol);
col = token_print_indent (file, col, scol, "", " ",
",");
col, scol);
col = token_print_indent (file, col, scol, "", " ",
",");
- col = write_expression (file, expr -> data.dns_update.expr1,
+ col = write_expression (file, expr -> data.dns_update.rrname,
col, scol);
col = token_print_indent (file, col, scol, "", " ",
",");
- col = write_expression (file, expr -> data.dns_update.expr2,
+ col = write_expression (file, expr -> data.dns_update.rrdata,
col, scol);
col = token_print_indent (file, col, indent, "", "",
")");
-rm -f $(OBJ) test.o test
realclean: clean
- -rm -f libdhcp.a *~ $(CATMANPAGES) $(SEDMANPAGES)
+ -rm -f libdhcpctl.a *~ $(CATMANPAGES) $(SEDMANPAGES)
distclean: realclean
-rm -f Makefile
#define TIME time_t
#define GET_TIME(x) time ((x))
+#define HAVE_MKSTEMP
+
/* Solaris prior to 2.5 didn't have random(). Rather than being clever and
using random() only on versions >2.5, always use rand() and srand(). */
#include "inet.h"
#include "auth.h"
#include "dhctoken.h"
-#if defined (FAILOVER_PROTOCOL)
-# include "failover.h"
-#endif
#include <isc/result.h>
#include <omapip/omapip.h>
+#if defined (FAILOVER_PROTOCOL)
+# include "failover.h"
+#endif
+
#if !defined (OPTION_HASH_SIZE)
# define OPTION_HASH_SIZE 17
#endif
unsigned bufsiz;
};
+/* Client FQDN option, failover FQDN option, etc. */
+typedef struct {
+ u_int8_t codes [2];
+ unsigned length;
+ u_int8_t *data;
+} ddns_fqdn_t;
+
/* Variable-length array of data. */
struct string_list {
void initialize_common_option_spaces PROTO ((void));
/* stables.c */
+#if defined (FAILOVER_PROTOCOL)
+struct failover_option_info ft_options [0];
+u_int32_t fto_allowed [0];
+int ft_sizes [0];
+char *dhcp_failover_link_state_names [0];
+#endif
extern struct universe agent_universe;
extern struct option agent_options [256];
extern struct universe server_universe;
extern omapi_object_type_t *dhcp_type_shared_network;
extern omapi_object_type_t *dhcp_type_subnet;
extern omapi_object_type_t *dhcp_type_class;
+#if defined (FAILOVER_PROTOCOL)
+extern omapi_object_type_t *dhcp_type_failover_state;
+extern omapi_object_type_t *dhcp_type_failover_link;
+extern omapi_object_type_t *dhcp_type_failover_listener;
+#endif
void dhcp_db_objects_setup (void);
struct lease *);
int deletePTR (const struct data_string *, const struct data_string *,
struct lease *);
+
+/* failover.c */
+#if defined (FAILOVER_PROTOCOL)
+void enter_failover_peer PROTO ((struct failover_peer *));
+struct failover_peer *find_failover_peer PROTO ((char *));
+isc_result_t dhcp_failover_link_initiate PROTO ((omapi_object_t *));
+isc_result_t dhcp_failover_link_signal PROTO ((omapi_object_t *,
+ const char *, va_list));
+isc_result_t dhcp_failover_link_set_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *));
+isc_result_t dhcp_failover_link_get_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **));
+isc_result_t dhcp_failover_link_destroy PROTO ((omapi_object_t *,
+ const char *));
+isc_result_t dhcp_failover_link_stuff_values PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *));
+isc_result_t dhcp_failover_listen PROTO ((omapi_object_t *));
+
+isc_result_t dhcp_failover_listener_signal PROTO ((omapi_object_t *,
+ const char *,
+ va_list));
+isc_result_t dhcp_failover_listener_set_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *));
+isc_result_t dhcp_failover_listener_get_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **));
+isc_result_t dhcp_failover_listener_destroy PROTO ((omapi_object_t *,
+ const char *));
+isc_result_t dhcp_failover_listener_stuff PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *));
+isc_result_t dhcp_failover_register PROTO ((omapi_object_t *));
+isc_result_t dhcp_failover_state_signal PROTO ((omapi_object_t *,
+ const char *, va_list));
+isc_result_t dhcp_failover_state_set_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *));
+isc_result_t dhcp_failover_state_get_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **));
+isc_result_t dhcp_failover_state_destroy PROTO ((omapi_object_t *,
+ const char *));
+isc_result_t dhcp_failover_state_stuff PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *));
+#endif /* FAILOVER_PROTOCOL */
* http://www.isc.org for more information.
*/
-struct failover_option {
+struct failover_option_info {
int code;
char *name;
- enum { FT_UINT8, FT_IPADDR, FT_UINT32, FT_BYTES, FT_DDNS,
- FT_UINT16, FT_TEXT, FT_UNDEF, FT_DIGEST } data_type;
+ enum { FT_UINT8, FT_IPADDR, FT_UINT32, FT_BYTES, FT_DDNS, FT_DDNS1,
+ FT_UINT16, FT_TEXT, FT_UNDEF, FT_DIGEST } type;
int num_present;
- int data_offset;
+ int offset;
+ u_int32_t bit;
};
+typedef struct {
+ int count;
+ u_int8_t *data;
+} failover_option_t;
+
#define FM_OFFSET(x) ((char *)(((struct failover_message *)0).x) - \
(char *)(((struct failover_message *)0)))
#define FTM_STATE 10
#define FTM_CONTACT 11
#define FTM_DISCONNECT 12
+
+#define DHCP_FAILOVER_MAX_MESSAGE_SIZE 2048
+
+typedef struct {
+ u_int8_t type;
+ u_int32_t time;
+ u_int32_t xid;
+ int options_present;
+} failover_message_t;
+
+typedef struct {
+ OMAPI_OBJECT_PREAMBLE;
+ char *peer_name;
+ unsigned peer_port;
+ int options_present;
+ enum dhcp_flink_state {
+ dhcp_flink_start,
+ dhcp_flink_message_length_wait,
+ dhcp_flink_message_wait,
+ dhcp_flink_disconnected,
+ dhcp_flink_state_max
+ } state;
+ failover_message_t *imsg;
+ u_int16_t imsg_len;
+ unsigned imsg_count;
+ u_int8_t imsg_payoff; /* Pay*load* offset. :') */
+} dhcp_failover_link_t;
+
+typedef struct {
+ OMAPI_OBJECT_PREAMBLE;
+ unsigned local_port;
+ char *peer_name;
+} dhcp_failover_listener_t;
+
+typedef struct _dhcp_failover_state {
+ OMAPI_OBJECT_PREAMBLE;
+ struct _dhcp_failover_state *next;
+ char *remote_peer;
+ int listen_port;
+} dhcp_failover_state_t;
+
#define OMAPI_PROTOCOL_PORT 7911
isc_result_t omapi_protocol_connect (omapi_object_t *,
- const char *, int, omapi_object_t *);
-isc_result_t omapi_protocol_listen (omapi_object_t *, int, int);
+ const char *, unsigned, omapi_object_t *);
+isc_result_t omapi_protocol_listen (omapi_object_t *, unsigned, int);
isc_result_t omapi_protocol_accept (omapi_object_t *);
isc_result_t omapi_protocol_send_intro (omapi_object_t *, unsigned, unsigned);
isc_result_t omapi_protocol_ready (omapi_object_t *);
isc_result_t omapi_protocol_send_update (omapi_object_t *, omapi_object_t *,
unsigned, omapi_object_t *);
-isc_result_t omapi_connect (omapi_object_t *, const char *, int);
+isc_result_t omapi_connect (omapi_object_t *, const char *, unsigned);
isc_result_t omapi_disconnect (omapi_object_t *, int);
int omapi_connection_readfd (omapi_object_t *);
int omapi_connection_writefd (omapi_object_t *);
omapi_object_t *h);
-isc_result_t omapi_listen (omapi_object_t *, int, int);
+isc_result_t omapi_listen (omapi_object_t *, unsigned, int);
isc_result_t omapi_listener_accept (omapi_object_t *);
int omapi_listener_readfd (omapi_object_t *);
isc_result_t omapi_accept (omapi_object_t *);
isc_result_t omapi_make_handle_value (omapi_value_t **, omapi_data_string_t *,
omapi_object_t *, const char *);
isc_result_t omapi_make_string_value (omapi_value_t **, omapi_data_string_t *,
- char *, const char *);
+ const char *, const char *);
isc_result_t omapi_get_int_value (unsigned long *, omapi_typed_data_t *);
isc_result_t omapi_object_handle (omapi_handle_t *, omapi_object_t *);
/* Define this if you want debugging output for DHCP failover protocol
messages. */
-/* #define DEBUG_FAILOVER_MESSAGES */
+#define DEBUG_FAILOVER_MESSAGES
/* Define this if you want debugging output for DHCP failover protocol
lease assignment timing. */
-/* #define DEBUG_FAILOVER_TIMING */
+#define DEBUG_FAILOVER_TIMING
/* Define this if you want DHCP failover protocol support in the DHCP
server. */
-/* #define FAILOVER_PROTOCOL */
+#define FAILOVER_PROTOCOL
/* Define this if you want the dhcpd.pid file to go somewhere other than
the default (which varies from system to system, but is usually either
} pick_first_value;
struct {
struct expression *type;
- struct expression *expr1;
- struct expression *expr2;
+ struct expression *rrname;
+ struct expression *rrdata;
struct expression *ttl;
} dns_update;
struct expression *updated_dns_rr;
-rm -f $(OBJ) test.o test
realclean: clean
- -rm -f libdhcp.a *~ $(CATMANPAGES) $(SEDMANPAGES)
+ -rm -f libomapi.a *~ $(CATMANPAGES) $(SEDMANPAGES)
distclean: realclean
-rm -f Makefile
isc_result_t omapi_connect (omapi_object_t *c,
const char *server_name,
- int port)
+ unsigned port)
{
struct hostent *he;
int hix;
#include <omapip/omapip_p.h>
isc_result_t omapi_listen (omapi_object_t *h,
- int port,
+ unsigned port,
int max)
{
struct hostent *he;
isc_result_t omapi_protocol_connect (omapi_object_t *h,
const char *server_name,
- int port,
+ unsigned port,
omapi_object_t *authinfo)
{
isc_result_t status;
case omapi_protocol_intro_wait:
/* Get protocol version and header size in network
byte order. */
- omapi_connection_get_uint32
- (c, (u_int32_t *)&p -> protocol_version);
- omapi_connection_get_uint32
- (c, (u_int32_t *)&p -> header_size);
+ omapi_connection_get_uint32 (c, &p -> protocol_version);
+ omapi_connection_get_uint32 (c, &p -> header_size);
/* We currently only support the current protocol version. */
if (p -> protocol_version != OMAPI_PROTOCOL_VERSION) {
/* Register a need for the number of bytes in a
header, and if we already have that many, process
them immediately. */
- if ((omapi_connection_require
- (c, p -> header_size)) != ISC_R_SUCCESS)
+ if ((omapi_connection_require (c, p -> header_size)) !=
+ ISC_R_SUCCESS)
break;
/* If we already have the data, fall through. */
}
/* Swap in the header... */
- omapi_connection_get_uint32
- (c, (u_int32_t *)&p -> message -> authid);
+ omapi_connection_get_uint32 (c, &p -> message -> authid);
/* XXX bind the authenticator here! */
- omapi_connection_get_uint32
- (c, (u_int32_t *)&p -> message -> authlen);
- omapi_connection_get_uint32
- (c, (u_int32_t *)&p -> message -> op);
- omapi_connection_get_uint32
- (c, (u_int32_t *)&p -> message -> handle);
- omapi_connection_get_uint32
- (c, (u_int32_t *)&p -> message -> id);
- omapi_connection_get_uint32
- (c, (u_int32_t *)&p -> message -> rid);
+ omapi_connection_get_uint32 (c, &p -> message -> authlen);
+ omapi_connection_get_uint32 (c, &p -> message -> op);
+ omapi_connection_get_uint32 (c, &p -> message -> handle);
+ omapi_connection_get_uint32 (c, &p -> message -> id);
+ omapi_connection_get_uint32 (c, &p -> message -> rid);
/* If there was any extra header data, skip over it. */
if (p -> header_size > sizeof (omapi_protocol_header_t)) {
a listener object, not a protocol object. */
isc_result_t omapi_protocol_listen (omapi_object_t *h,
- int port,
+ unsigned port,
int max)
{
isc_result_t status;
isc_result_t omapi_make_string_value (omapi_value_t **vp,
omapi_data_string_t *name,
- char *value, const char *caller)
+ const char *value, const char *caller)
{
isc_result_t status;
#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"
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;
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;
pool -> permit_list &&
!pool -> permit_list -> next &&
(pool -> permit_list -> type ==
- permit_dynamic_bootp_clients))) {
+ permit_all_clients))) {
break;
}
last = 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;
#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"
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",
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);
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
}
- 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)
int ignorep;
int i;
const char *status;
+ char *s;
/* DHCPDECLINE must specify address. */
if (!(oc = lookup_option (&dhcp_universe, packet -> options,
} 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");
}
(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,
}
}
- /* 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)) {
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);
}
}
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!");
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);
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";
}
R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bE:\b: A\bAL\bLL\bLO\bOW\bW A\bAN\bND\bD D\bDE\bEN\bNY\bY
The _\ba_\bl_\bl_\bo_\bw and _\bd_\be_\bn_\by 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 _\bi_\bg_\bn_\bo_\br_\be key
+ word can be used in place of the _\bd_\be_\bn_\by keyword to prevent
+ logging of denied requests.
-A\bAL\bLL\bLO\bOW\bW A\bAN\bND\bD D\bDE\bEN\bNY\bY I\bIN\bN S\bSC\bCO\bOP\bPE\bE
+A\bAL\bLL\bLO\bOW\bW D\bDE\bEN\bNY\bY A\bAN\bND\bD I\bIG\bGN\bNO\bOR\bRE\bE I\bIN\bN S\bSC\bCO\bOP\bPE\bE
The following usages of allow and deny will work in any
scope, although it is not recommended that they be used in
pool declarations.
a\bal\bll\blo\bow\bw u\bun\bnk\bkn\bno\bow\bwn\bn-\b-c\bcl\bli\bie\ben\bnt\bts\bs;\b;
d\bde\ben\bny\by u\bun\bnk\bkn\bno\bow\bwn\bn-\b-c\bcl\bli\bie\ben\bnt\bts\bs;\b;
+ i\big\bgn\bno\bor\bre\be u\bun\bnk\bkn\bno\bow\bwn\bn-\b-c\bcl\bli\bie\ben\bnt\bts\bs;\b;
- The u\bun\bnk\bkn\bno\bow\bwn\bn-\b-c\bcl\bli\bie\ben\bnt\bts\bs flag is used to tell dhcpd whether or
- not to dynamically assign addresses to unknown clients.
- Dynamic address assignment to unknown clients is a\bal\bll\blo\bow\bwed
dhcpd.conf(5) dhcpd.conf(5)
+ The u\bun\bnk\bkn\bno\bow\bwn\bn-\b-c\bcl\bli\bie\ben\bnt\bts\bs flag is used to tell dhcpd whether or
+ not to dynamically assign addresses to unknown clients.
+ Dynamic address assignment to unknown clients is a\bal\bll\blo\bow\bwed
by default.
T\bTh\bhe\be _\bb_\bo_\bo_\bt_\bp k\bke\bey\byw\bwo\bor\brd\bd
a\bal\bll\blo\bow\bw b\bbo\boo\bot\btp\bp;\b;
d\bde\ben\bny\by b\bbo\boo\bot\btp\bp;\b;
+ i\big\bgn\bno\bor\bre\be b\bbo\boo\bot\btp\bp;\b;
The b\bbo\boo\bot\btp\bp flag is used to tell dhcpd whether or not to
respond to bootp queries. Bootp queries are a\bal\bll\blo\bow\bwed by
a\bal\bll\blo\bow\bw b\bbo\boo\bot\bti\bin\bng\bg;\b;
d\bde\ben\bny\by b\bbo\boo\bot\bti\bin\bng\bg;\b;
+ i\big\bgn\bno\bor\bre\be b\bbo\boo\bot\bti\bin\bng\bg;\b;
The b\bbo\boo\bot\bti\bin\bng\bg 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 a\bal\bll\blo\bow\bwed, 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. T\bTh\bhe\be _\bd_\bu_\bp_\bl_\bi_\bc_\ba_\bt_\be_\bs k\bke\bey\by\b
+ w\bwo\bor\brd\bd
+
+ a\bal\bll\blo\bow\bw d\bdu\bup\bpl\bli\bic\bca\bat\bte\bes\bs;\b;
+ d\bde\ben\bny\by d\bdu\bup\bpl\bli\bic\bca\bat\bte\bes\bs;\b;
+
+ 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 d\bdu\bup\bpl\bli\bic\bca\bat\bte\bes\bs 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 a\bal\bll\blo\bow\bwed. T\bTh\bhe\be
+ _\bd_\be_\bc_\bl_\bi_\bn_\be_\bs k\bke\bey\byw\bwo\bor\brd\bd
+
+ a\bal\bll\blo\bow\bw d\bde\bec\bcl\bli\bin\bne\bes\bs;\b;
+ d\bde\ben\bny\by d\bde\bec\bcl\bli\bin\bne\bes\bs;\b;
+
+
+
+ 14
+
+
+
+
+
+dhcpd.conf(5) dhcpd.conf(5)
+
+
+ i\big\bgn\bno\bor\bre\be d\bde\bec\bcl\bli\bin\bne\bes\bs;\b;
+
+ 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 d\bde\bec\bcl\bli\bin\bne\bes\bs flag tells the DHCP server whether or not to
+ honor DHCPDECLINE messages. If it is set to d\bde\ben\bny\by or
+ i\big\bgn\bno\bor\bre\be in a particular scope, the DHCP server will not
+ respond to DHCPDECLINE messages.
A\bAL\bLL\bLO\bOW\bW A\bAN\bND\bD D\bDE\bEN\bNY\bY W\bWI\bIT\bTH\bHI\bIN\bN P\bPO\bOO\bOL\bL D\bDE\bEC\bCL\bLA\bAR\bRA\bAT\bTI\bIO\bON\bNS\bS
The uses of the allow and deny keyword shown in the previ
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:
k\bkn\bno\bow\bwn\bn c\bcl\bli\bie\ben\bnt\bts\bs;\b;
next renew.
R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bE:\b: P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS
- T\bTh\bhe\be _\bd_\be_\bf_\ba_\bu_\bl_\bt_\b-_\bl_\be_\ba_\bs_\be_\b-_\bt_\bi_\bm_\be s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
+ T\bTh\bhe\be _\bl_\be_\ba_\bs_\be_\b-_\bf_\bi_\bl_\be_\b-_\bn_\ba_\bm_\be s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
+ l\ble\bea\bas\bse\be-\b-f\bfi\bil\ble\be-\b-n\bna\bam\bme\be _\bn_\ba_\bm_\be;\b;
+
+ _\bN_\ba_\bm_\be should be the name of the DHCP server's lease file.
- 15
+
+ 16
dhcpd.conf(5) dhcpd.conf(5)
+ By default, this is /var/db/dhcpd.leases. This statement
+ m\bmu\bus\bst\bt appear in the outer scope of the configuration file -
+ if it appears in some other scope, it will have no effect.
+
+ T\bTh\bhe\be _\bp_\bi_\bd_\b-_\bf_\bi_\bl_\be_\b-_\bn_\ba_\bm_\be s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
+
+ p\bpi\bid\bd-\b-f\bfi\bil\ble\be-\b-n\bna\bam\bme\be _\bn_\ba_\bm_\be;\b;
+
+ _\bN_\ba_\bm_\be 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.
+
+ T\bTh\bhe\be _\bd_\be_\bf_\ba_\bu_\bl_\bt_\b-_\bl_\be_\ba_\bs_\be_\b-_\bt_\bi_\bm_\be s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
+
d\bde\bef\bfa\bau\bul\blt\bt-\b-l\ble\bea\bas\bse\be-\b-t\bti\bim\bme\be _\bt_\bi_\bm_\be;\b;
_\bT_\bi_\bm_\be should be the length in seconds that will be assigned
m\bma\bax\bx-\b-l\ble\bea\bas\bse\be-\b-t\bti\bim\bme\be _\bt_\bi_\bm_\be;\b;
- _\bT_\bi_\bm_\be 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
+ _\bT_\bi_\bm_\be 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.
T\bTh\bhe\be _\bm_\bi_\bn_\b-_\bl_\be_\ba_\bs_\be_\b-_\bt_\bi_\bm_\be s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
m\bmi\bin\bn-\b-l\ble\bea\bas\bse\be-\b-t\bti\bim\bme\be _\bt_\bi_\bm_\be;\b;
- _\bT_\bi_\bm_\be should be the minimum length in seconds that will be
+ _\bT_\bi_\bm_\be should be the minimum length in seconds that will be
assigned to a lease.
T\bTh\bhe\be _\bm_\bi_\bn_\b-_\bs_\be_\bc_\bs s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
m\bmi\bin\bn-\b-s\bse\bec\bcs\bs _\bs_\be_\bc_\bo_\bn_\bd_\bs;\b;
- _\bS_\be_\bc_\bo_\bn_\bd_\bs should be the minimum number of seconds since a
+ _\bS_\be_\bc_\bo_\bn_\bd_\bs 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
- T\bTh\bhe\be _\bh_\ba_\br_\bd_\bw_\ba_\br_\be s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
- h\bha\bar\brd\bdw\bwa\bar\bre\be _\bh_\ba_\br_\bd_\bw_\ba_\br_\be_\b-_\bt_\by_\bp_\be _\bh_\ba_\br_\bd_\bw_\ba_\br_\be_\b-_\ba_\bd_\bd_\br_\be_\bs_\bs;\b;
- In order for a BOOTP client to be recognized, its network
- hardware address must be declared using a _\bh_\ba_\br_\bd_\bw_\ba_\br_\be clause
- in the _\bh_\bo_\bs_\bt statement. _\bh_\ba_\br_\bd_\bw_\ba_\br_\be_\b-_\bt_\by_\bp_\be must be the name of
- a physical hardware interface type. Currently, only the
- e\bet\bth\bhe\ber\brn\bne\bet\bt and t\bto\bok\bke\ben\bn-\b-r\bri\bin\bng\bg types are recognized, although
- support for a f\bfd\bdd\bdi\bi 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)
+ T\bTh\bhe\be _\bh_\ba_\br_\bd_\bw_\ba_\br_\be s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
+ h\bha\bar\brd\bdw\bwa\bar\bre\be _\bh_\ba_\br_\bd_\bw_\ba_\br_\be_\b-_\bt_\by_\bp_\be _\bh_\ba_\br_\bd_\bw_\ba_\br_\be_\b-_\ba_\bd_\bd_\br_\be_\bs_\bs;\b;
- be desirable. The _\bh_\ba_\br_\bd_\bw_\ba_\br_\be_\b-_\ba_\bd_\bd_\br_\be_\bs_\bs should be a set of
- hexadecimal octets (numbers from 0 through ff) seperated
- by colons. The _\bh_\ba_\br_\bd_\bw_\ba_\br_\be statement may also be used for
+ In order for a BOOTP client to be recognized, its network
+ hardware address must be declared using a _\bh_\ba_\br_\bd_\bw_\ba_\br_\be clause
+ in the _\bh_\bo_\bs_\bt statement. _\bh_\ba_\br_\bd_\bw_\ba_\br_\be_\b-_\bt_\by_\bp_\be must be the name of
+ a physical hardware interface type. Currently, only the
+ e\bet\bth\bhe\ber\brn\bne\bet\bt and t\bto\bok\bke\ben\bn-\b-r\bri\bin\bng\bg types are recognized, although
+ support for a f\bfd\bdd\bdi\bi hardware type (and others) would also
+ be desirable. The _\bh_\ba_\br_\bd_\bw_\ba_\br_\be_\b-_\ba_\bd_\bd_\br_\be_\bs_\bs should be a set of
+ hexadecimal octets (numbers from 0 through ff) seperated
+ by colons. The _\bh_\ba_\br_\bd_\bw_\ba_\br_\be statement may also be used for
DHCP clients.
T\bTh\bhe\be _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
f\bfi\bil\ble\ben\bna\bam\bme\be "\b"_\bf_\bi_\bl_\be_\bn_\ba_\bm_\be"\b";\b;
- The _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be statement can be used to specify the name of
- the initial boot file which is to be loaded by a client.
+ The _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be statement can be used to specify the name of
+ the initial boot file which is to be loaded by a client.
The _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be 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.
T\bTh\bhe\be _\bs_\be_\br_\bv_\be_\br_\b-_\bn_\ba_\bm_\be s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
n\bne\bex\bxt\bt-\b-s\bse\ber\brv\bve\ber\br _\bs_\be_\br_\bv_\be_\br_\b-_\bn_\ba_\bm_\be;\b;
- The _\bn_\be_\bx_\bt_\b-_\bs_\be_\br_\bv_\be_\br statement is used to specify the host
- address of the server from which the initial boot file
- (specified in the _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be statement) is to be loaded.
- _\bS_\be_\br_\bv_\be_\br_\b-_\bn_\ba_\bm_\be should be a numeric IP address or a domain
- name. If no _\bn_\be_\bx_\bt_\b-_\bs_\be_\br_\bv_\be_\br parameter applies to a given
+ The _\bn_\be_\bx_\bt_\b-_\bs_\be_\br_\bv_\be_\br statement is used to specify the host
+ address of the server from which the initial boot file
+ (specified in the _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be statement) is to be loaded.
+ _\bS_\be_\br_\bv_\be_\br_\b-_\bn_\ba_\bm_\be should be a numeric IP address or a domain
+ name. If no _\bn_\be_\bx_\bt_\b-_\bs_\be_\br_\bv_\be_\br parameter applies to a given
client, the DHCP server's IP address is used.
T\bTh\bhe\be _\bf_\bi_\bx_\be_\bd_\b-_\ba_\bd_\bd_\br_\be_\bs_\bs s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
f\bfi\bix\bxe\bed\bd-\b-a\bad\bdd\bdr\bre\bes\bss\bs _\ba_\bd_\bd_\br_\be_\bs_\bs [,\b, _\ba_\bd_\bd_\br_\be_\bs_\bs ... ];\b;
- The _\bf_\bi_\bx_\be_\bd_\b-_\ba_\bd_\bd_\br_\be_\bs_\bs statement is used to assign one or more
- fixed IP addresses to a client. It should only appear in
- a _\bh_\bo_\bs_\bt 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 _\bf_\bi_\bx_\be_\bd_\b-_\ba_\bd_\bd_\br_\be_\bs_\bs
- statement are on the network on which the client is boot
- ing, that client will not match the _\bh_\bo_\bs_\bt declaration con
- taining that _\bf_\bi_\bx_\be_\bd_\b-_\ba_\bd_\bd_\br_\be_\bs_\bs statement. Each _\ba_\bd_\bd_\br_\be_\bs_\bs should
- be either an IP address or a domain name which resolves to
- one or more IP addresses.
-
- T\bTh\bhe\be _\bd_\by_\bn_\ba_\bm_\bi_\bc_\b-_\bb_\bo_\bo_\bt_\bp_\b-_\bl_\be_\ba_\bs_\be_\b-_\bc_\bu_\bt_\bo_\bf_\bf s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
- d\bdy\byn\bna\bam\bmi\bic\bc-\b-b\bbo\boo\bot\btp\bp-\b-l\ble\bea\bas\bse\be-\b-c\bcu\but\bto\bof\bff\bf _\bd_\ba_\bt_\be;\b;
+ 18
- 17
+dhcpd.conf(5) dhcpd.conf(5)
+ The _\bf_\bi_\bx_\be_\bd_\b-_\ba_\bd_\bd_\br_\be_\bs_\bs statement is used to assign one or more
+ fixed IP addresses to a client. It should only appear in
+ a _\bh_\bo_\bs_\bt 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 _\bf_\bi_\bx_\be_\bd_\b-_\ba_\bd_\bd_\br_\be_\bs_\bs
+ statement are on the network on which the client is boot
+ ing, that client will not match the _\bh_\bo_\bs_\bt declaration con
+ taining that _\bf_\bi_\bx_\be_\bd_\b-_\ba_\bd_\bd_\br_\be_\bs_\bs statement. Each _\ba_\bd_\bd_\br_\be_\bs_\bs should
+ be either an IP address or a domain name which resolves to
+ one or more IP addresses.
-dhcpd.conf(5) dhcpd.conf(5)
+ T\bTh\bhe\be _\bd_\by_\bn_\ba_\bm_\bi_\bc_\b-_\bb_\bo_\bo_\bt_\bp_\b-_\bl_\be_\ba_\bs_\be_\b-_\bc_\bu_\bt_\bo_\bf_\bf s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
+ d\bdy\byn\bna\bam\bmi\bic\bc-\b-b\bbo\boo\bot\btp\bp-\b-l\ble\bea\bas\bse\be-\b-c\bcu\but\bto\bof\bff\bf _\bd_\ba_\bt_\be;\b;
- The _\bd_\by_\bn_\ba_\bm_\bi_\bc_\b-_\bb_\bo_\bo_\bt_\bp_\b-_\bl_\be_\ba_\bs_\be_\b-_\bc_\bu_\bt_\bo_\bf_\bf statement sets the ending
+ The _\bd_\by_\bn_\ba_\bm_\bi_\bc_\b-_\bb_\bo_\bo_\bt_\bp_\b-_\bl_\be_\ba_\bs_\be_\b-_\bc_\bu_\bt_\bo_\bf_\bf 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.
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.
T\bTh\bhe\be _\bd_\by_\bn_\ba_\bm_\bi_\bc_\b-_\bb_\bo_\bo_\bt_\bp_\b-_\bl_\be_\ba_\bs_\be_\b-_\bl_\be_\bn_\bg_\bt_\bh s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
d\bdy\byn\bna\bam\bmi\bic\bc-\b-b\bbo\boo\bot\btp\bp-\b-l\ble\bea\bas\bse\be-\b-l\ble\ben\bng\bgt\bth\bh _\bl_\be_\bn_\bg_\bt_\bh;\b;
- The _\bd_\by_\bn_\ba_\bm_\bi_\bc_\b-_\bb_\bo_\bo_\bt_\bp_\b-_\bl_\be_\ba_\bs_\be_\b-_\bl_\be_\bn_\bg_\bt_\bh 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 _\bd_\by_\bn_\ba_\bm_\bi_\bc_\b-_\bb_\bo_\bo_\bt_\bp_\b-_\bl_\be_\ba_\bs_\be_\b-_\bl_\be_\bn_\bg_\bt_\bh 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 _\bl_\be_\bn_\bg_\bt_\bh 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 _\bl_\be_\bn_\bg_\bt_\bh,
- 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.
- T\bTh\bhe\be _\bg_\be_\bt_\b-_\bl_\be_\ba_\bs_\be_\b-_\bh_\bo_\bs_\bt_\bn_\ba_\bm_\be_\bs s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
- g\bge\bet\bt-\b-l\ble\bea\bas\bse\be-\b-h\bho\bos\bst\btn\bna\bam\bme\bes\bs _\bf_\bl_\ba_\bg;\b;
- The _\bg_\be_\bt_\b-_\bl_\be_\ba_\bs_\be_\b-_\bh_\bo_\bs_\bt_\bn_\ba_\bm_\be_\bs 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 _\bh_\bo_\bs_\bt_\bn_\ba_\bm_\be option. If _\bf_\bl_\ba_\bg is
- true, then this lookup is done for all addresses in the
- current scope. By default, or if _\bf_\bl_\ba_\bg is false, no
- lookups are done.
+ 19
- T\bTh\bhe\be _\bu_\bs_\be_\b-_\bh_\bo_\bs_\bt_\b-_\bd_\be_\bc_\bl_\b-_\bn_\ba_\bm_\be_\bs s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
- u\bus\bse\be-\b-h\bho\bos\bst\bt-\b-d\bde\bec\bcl\bl-\b-n\bna\bam\bme\bes\bs _\bf_\bl_\ba_\bg;\b;
- 18
+dhcpd.conf(5) dhcpd.conf(5)
+ T\bTh\bhe\be _\bg_\be_\bt_\b-_\bl_\be_\ba_\bs_\be_\b-_\bh_\bo_\bs_\bt_\bn_\ba_\bm_\be_\bs s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
+ g\bge\bet\bt-\b-l\ble\bea\bas\bse\be-\b-h\bho\bos\bst\btn\bna\bam\bme\bes\bs _\bf_\bl_\ba_\bg;\b;
+ The _\bg_\be_\bt_\b-_\bl_\be_\ba_\bs_\be_\b-_\bh_\bo_\bs_\bt_\bn_\ba_\bm_\be_\bs 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 _\bh_\bo_\bs_\bt_\bn_\ba_\bm_\be option. If _\bf_\bl_\ba_\bg is
+ true, then this lookup is done for all addresses in the
+ current scope. By default, or if _\bf_\bl_\ba_\bg is false, no
+ lookups are done.
-dhcpd.conf(5) dhcpd.conf(5)
+ T\bTh\bhe\be _\bu_\bs_\be_\b-_\bh_\bo_\bs_\bt_\b-_\bd_\be_\bc_\bl_\b-_\bn_\ba_\bm_\be_\bs s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
+ u\bus\bse\be-\b-h\bho\bos\bst\bt-\b-d\bde\bec\bcl\bl-\b-n\bna\bam\bme\bes\bs _\bf_\bl_\ba_\bg;\b;
- If the _\bu_\bs_\be_\b-_\bh_\bo_\bs_\bt_\b-_\bd_\be_\bc_\bl_\b-_\bn_\ba_\bm_\be_\bs 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 _\bu_\bs_\be_\b-_\bh_\bo_\bs_\bt_\b-_\bd_\be_\bc_\bl_\b-_\bn_\ba_\bm_\be_\bs 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 {
option host-name "joe";
}
- An _\bo_\bp_\bt_\bi_\bo_\bn _\bh_\bo_\bs_\bt_\b-_\bn_\ba_\bm_\be statement within a host declaration
+ An _\bo_\bp_\bt_\bi_\bo_\bn _\bh_\bo_\bs_\bt_\b-_\bn_\ba_\bm_\be statement within a host declaration
will override the use of the name in the host declaration.
T\bTh\bhe\be _\ba_\bu_\bt_\bh_\bo_\br_\bi_\bt_\ba_\bt_\bi_\bv_\be s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
n\bno\bot\bt a\bau\but\bth\bho\bor\bri\bit\bta\bat\bti\biv\bve\be;\b;
- 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 n\bno\bot\bt a\bau\but\bth\bho\bor\bri\bit\bta\bat\bti\biv\bve\be;\b; 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 n\bno\bot\bt a\bau\but\bth\bho\bor\bri\bit\bta\bat\bti\biv\bve\be;\b; 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.
T\bTh\bhe\be _\ba_\bl_\bw_\ba_\by_\bs_\b-_\br_\be_\bp_\bl_\by_\b-_\br_\bf_\bc_\b1_\b0_\b4_\b8 s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
a\bal\blw\bwa\bay\bys\bs-\b-r\bre\bep\bpl\bly\by-\b-r\brf\bfc\bc1\b10\b04\b48\b8 _\bf_\bl_\ba_\bg;\b;
- 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 a\bal\blw\bwa\bay\bys\bs-\b-r\bre\bep\bpl\bly\by-\b-r\brf\bfc\bc1\b10\b04\b48\b8 option in that client's
+ If you want to send rfc1048 options to such a client, you
+ can set the a\bal\blw\bwa\bay\bys\bs-\b-r\bre\bep\bpl\bly\by-\b-r\brf\bfc\bc1\b10\b04\b48\b8 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.
T\bTh\bhe\be _\ba_\bl_\bw_\ba_\by_\bs_\b-_\bb_\br_\bo_\ba_\bd_\bc_\ba_\bs_\bt s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
a\bal\blw\bwa\bay\bys\bs-\b-b\bbr\bro\boa\bad\bdc\bca\bas\bst\bt _\bf_\bl_\ba_\bg;\b;
- 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
- T\bTh\bhe\be _\bo_\bn_\be_\b-_\bl_\be_\ba_\bs_\be_\b-_\bp_\be_\br_\b-_\bc_\bl_\bi_\be_\bn_\bt s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
- o\bon\bne\be-\b-l\ble\bea\bas\bse\be-\b-p\bpe\ber\br-\b-c\bcl\bli\bie\ben\bnt\bt _\bf_\bl_\ba_\bg;\b;
- 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 _\ba_\bn_\bd
- 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)
+ T\bTh\bhe\be _\bo_\bn_\be_\b-_\bl_\be_\ba_\bs_\be_\b-_\bp_\be_\br_\b-_\bc_\bl_\bi_\be_\bn_\bt s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
+ o\bon\bne\be-\b-l\ble\bea\bas\bse\be-\b-p\bpe\ber\br-\b-c\bcl\bli\bie\ben\bnt\bt _\bf_\bl_\ba_\bg;\b;
- 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 _\ba_\bn_\bd
+ 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.
u\bus\bse\be-\b-l\ble\bea\bas\bse\be-\b-a\bad\bdd\bdr\br-\b-f\bfo\bor\br-\b-d\bde\bef\bfa\bau\bul\blt\bt-\b-r\bro\bou\but\bte\be _\bf_\bl_\ba_\bg;\b;
- If the _\bu_\bs_\be_\b-_\bl_\be_\ba_\bs_\be_\b-_\ba_\bd_\bd_\br_\b-_\bf_\bo_\br_\b-_\bd_\be_\bf_\ba_\bu_\bl_\bt_\b-_\br_\bo_\bu_\bt_\be parameter is true
+ If the _\bu_\bs_\be_\b-_\bl_\be_\ba_\bs_\be_\b-_\ba_\bd_\bd_\br_\b-_\bf_\bo_\br_\b-_\bd_\be_\bf_\ba_\bu_\bl_\bt_\b-_\br_\bo_\bu_\bt_\be 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.
T\bTh\bhe\be _\bs_\be_\br_\bv_\be_\br_\b-_\bi_\bd_\be_\bn_\bt_\bi_\bf_\bi_\be_\br s\bst\bta\bat\bte\bem\bme\ben\bnt\bt
s\bse\ber\brv\bve\ber\br-\b-i\bid\bde\ben\bnt\bti\bif\bfi\bie\ber\br _\bh_\bo_\bs_\bt_\bn_\ba_\bm_\be;\b;
- 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 m\bmu\bus\bst\bt 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 m\bmu\bus\bst\bt 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 _\bs_\be_\br_\bv_\be_\br_\b-_\bi_\bd_\be_\bn_\bt_\bi_\bf_\bi_\be_\br 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.
-R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bE:\b: O\bOP\bPT\bTI\bIO\bON\bN S\bST\bTA\bAT\bTE\bEM\bME\bEN\bNT\bTS\bS
- DHCP option statements are documented in the d\bdh\bhc\bcp\bp-\b-
- o\bop\bpt\bti\bio\bon\bns\bs(\b(5\b5)\b) manual page.
-V\bVE\bEN\bND\bDO\bOR\bR E\bEN\bNC\bCA\bAP\bPS\bSU\bUL\bLA\bAT\bTE\bED\bD O\bOP\bPT\bTI\bIO\bON\bNS\bS
- The DHCP protocol defines the v\bve\ben\bnd\bdo\bor\br-\b-e\ben\bnc\bca\bap\bps\bsu\bul\bla\bat\bte\bed\bd-\b-o\bop\bpt\bti\bio\bon\bns\bs
- option, which allows vendors to define their own options
- that will be sent encapsulated in a standard DHCP option.
- The format of the v\bve\ben\bnd\bdo\bor\br-\b-e\ben\bnc\bca\bap\bps\bsu\bul\bla\bat\bte\bed\bd-\b-o\bop\bpt\bti\bio\bon\bns\bs 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.
+R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bE:\b: O\bOP\bPT\bTI\bIO\bON\bN S\bST\bTA\bAT\bTE\bEM\bME\bEN\bNT\bTS\bS
+ DHCP option statements are documented in the d\bdh\bhc\bcp\bp-\b-
+ o\bop\bpt\bti\bio\bon\bns\bs(\b(5\b5)\b) manual page.
- either a hunk of opaque data, or an actual option buffer
+V\bVE\bEN\bND\bDO\bOR\bR E\bEN\bNC\bCA\bAP\bPS\bSU\bUL\bLA\bAT\bTE\bED\bD O\bOP\bPT\bTI\bIO\bON\bNS\bS
+ The DHCP protocol defines the v\bve\ben\bnd\bdo\bor\br-\b-e\ben\bnc\bca\bap\bps\bsu\bul\bla\bat\bte\bed\bd-\b-o\bop\bpt\bti\bio\bon\bns\bs
+ option, which allows vendors to define their own options
+ that will be sent encapsulated in a standard DHCP option.
+ The format of the v\bve\ben\bnd\bdo\bor\br-\b-e\ben\bnc\bca\bap\bps\bsu\bul\bla\bat\bte\bed\bd-\b-o\bop\bpt\bti\bio\bon\bns\bs 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 v\bve\ben\bnd\bdo\bor\br-\b-e\ben\bnc\bca\bap\bps\bsu\bul\bla\bat\bte\bed\bd-\b-
+ 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 v\bve\ben\bnd\bdo\bor\br-\b-e\ben\bnc\bca\bap\bps\bsu\bul\bla\bat\bte\bed\bd-\b-
o\bop\bpt\bti\bio\bon\bns\bs option in some scope.
To send a simple clump of data, simply provide a value for
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:
o\bop\bpt\bti\bio\bon\bn s\bsp\bpa\bac\bce\be _\bn_\ba_\bm_\be ;\b;
- The name can then be used in option definitions, as
- described in the d\bdh\bhc\bcp\bp-\b-o\bop\bpt\bti\bio\bon\bns\bs(\b(5\b5)\b) manual page. For exam
+ The name can then be used in option definitions, as
+ described in the d\bdh\bhc\bcp\bp-\b-o\bop\bpt\bti\bio\bon\bns\bs(\b(5\b5)\b) manual page. For exam
ple:
option space SUNW;
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 C\bCL\bLI\bIE\bEN\bNT\bT C\bCL\bLA\bAS\bSS\bSI\bIN\bNG\bG 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 V\bVE\bEN\bND\bDO\bOR\bR E\bEN\bNC\bCA\bAP\bPS\bSU\bUL\bLA\bAT\bTE\bED\bD
+ O\bOP\bPT\bTI\bIO\bON\bNS\bS 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 v\bve\ben\bnd\bdo\bor\br-\b-
+ to a particular class in the local scope. The v\bve\ben\bnd\bdo\bor\br-\b-
o\bop\bpt\bti\bio\bon\bn-\b-s\bsp\bpa\bac\bce\be declaration indicates that in that scope, the
- v\bve\ben\bnd\bdo\bor\br-\b-e\ben\bnc\bca\bap\bps\bsu\bul\bla\bat\bte\bed\bd-\b-o\bop\bpt\bti\bio\bon\bns\bs option should be constructed
- using the values of all the options in the SUNW option
+ v\bve\ben\bnd\bdo\bor\br-\b-e\ben\bnc\bca\bap\bps\bsu\bul\bla\bat\bte\bed\bd-\b-o\bop\bpt\bti\bio\bon\bns\bs option should be constructed
+ using the values of all the options in the SUNW option
space.
S\bSE\bEE\bE A\bAL\bLS\bSO\bO
A\bAU\bUT\bTH\bHO\bOR\bR
d\bdh\bhc\bcp\bpd\bd(\b(8\b8)\b) 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
h\bht\btt\btp\bp:\b:/\b//\b/w\bww\bww\bw.\b.i\bis\bsc\bc.\b.o\bor\brg\bg/\b/i\bis\bsc\bc.\b.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 23
+ 24
#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)
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;
"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)
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");
/* 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)
/* 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. */
}
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.");
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;
}
}
/* 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;
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;
}
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));
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);
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
/* 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);
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;
}
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;
}
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;
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
"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");
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;
}
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;
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
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;
"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,
{
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")) {
/* 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);
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;
}
/* 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;
/* 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;
"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,
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,
#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"
/* 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];
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)
#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
#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"
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 ()
{
#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
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;