summaryrefslogtreecommitdiffstats
path: root/contrib/isc-dhcp/common
diff options
context:
space:
mode:
authormurray <murray@FreeBSD.org>2002-04-01 07:54:44 +0000
committermurray <murray@FreeBSD.org>2002-04-01 07:54:44 +0000
commita916d35e05e0f886097009e26d33c65a1ea5c370 (patch)
treedc453635e10392b086bc6d179ba3e703cf584ce2 /contrib/isc-dhcp/common
parent57b30d23e7c11fa1a8c8c23f27de40971872952f (diff)
downloadFreeBSD-src-a916d35e05e0f886097009e26d33c65a1ea5c370.zip
FreeBSD-src-a916d35e05e0f886097009e26d33c65a1ea5c370.tar.gz
Import ISC DHCP 3.0.1 RC8 client.
Diffstat (limited to 'contrib/isc-dhcp/common')
-rw-r--r--contrib/isc-dhcp/common/conflex.c6
-rw-r--r--contrib/isc-dhcp/common/dhcp-options.54
-rw-r--r--contrib/isc-dhcp/common/dns.c53
-rw-r--r--contrib/isc-dhcp/common/options.c28
-rw-r--r--contrib/isc-dhcp/common/print.c18
-rw-r--r--contrib/isc-dhcp/common/tables.c4
6 files changed, 79 insertions, 34 deletions
diff --git a/contrib/isc-dhcp/common/conflex.c b/contrib/isc-dhcp/common/conflex.c
index ac73de5..34b6ab7 100644
--- a/contrib/isc-dhcp/common/conflex.c
+++ b/contrib/isc-dhcp/common/conflex.c
@@ -3,7 +3,7 @@
Lexical scanner for dhcpd config file... */
/*
- * Copyright (c) 1995-2001 Internet Software Consortium.
+ * Copyright (c) 1995-2002 Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
-"$Id: conflex.c,v 1.92.2.4 2002/01/10 19:35:59 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
+"$Id: conflex.c,v 1.92.2.5 2002/02/09 03:15:17 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -612,6 +612,8 @@ static enum dhcp_token intern (atom, dfv)
return DOMAIN;
if (!strcasecmp (atom + 1, "omain-name"))
return DOMAIN_NAME;
+ if (!strcasecmp (atom + 1, "o-forward-update"))
+ return DO_FORWARD_UPDATE;
if (!strcasecmp (atom + 1, "ebug"))
return TOKEN_DEBUG;
if (!strcasecmp (atom + 1, "eny"))
diff --git a/contrib/isc-dhcp/common/dhcp-options.5 b/contrib/isc-dhcp/common/dhcp-options.5
index 6f5d6f7..dd00e86 100644
--- a/contrib/isc-dhcp/common/dhcp-options.5
+++ b/contrib/isc-dhcp/common/dhcp-options.5
@@ -426,7 +426,9 @@ to the client. Servers should be listed in order of preference.
This option specifies the name of the client. The name may or may
not be qualified with the local domain name (it is preferable to use
the domain-name option to specify the domain name). See RFC 1035 for
-character set restrictions.
+character set restrictions. This option is only honored by
+.B dhclient-script(8)
+if the hostname for the client machine is not set.
.RE
.PP
.B option \fBieee802-3-encapsulation\fR \fIflag\fR\fB;\fR
diff --git a/contrib/isc-dhcp/common/dns.c b/contrib/isc-dhcp/common/dns.c
index d529652..897d78d 100644
--- a/contrib/isc-dhcp/common/dns.c
+++ b/contrib/isc-dhcp/common/dns.c
@@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
-"$Id: dns.c,v 1.35.2.10 2001/10/26 21:26:39 mellon Exp $ Copyright (c) 2001 The Internet Software Consortium. All rights reserved.\n";
+"$Id: dns.c,v 1.35.2.12 2002/02/20 22:28:17 mellon Exp $ Copyright (c) 2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -619,14 +619,9 @@ isc_result_t ddns_update_a (struct data_string *ddns_fwd_name,
*/
result = minires_nupdate (&resolver_state, ISC_LIST_HEAD (updqueue));
+#ifdef DEBUG_DNS_UPDATES
print_dns_status ((int)result, &updqueue);
-
- while (!ISC_LIST_EMPTY (updqueue)) {
- updrec = ISC_LIST_HEAD (updqueue);
- ISC_LIST_UNLINK (updqueue, updrec, r_link);
- minires_freeupdrec (updrec);
- }
-
+#endif
/*
* If this update operation succeeds, the updater can conclude that it
@@ -636,8 +631,12 @@ isc_result_t ddns_update_a (struct data_string *ddns_fwd_name,
* -- "Interaction between DHCP and DNS"
*/
- if (result == ISC_R_SUCCESS)
- return result;
+ if (result == ISC_R_SUCCESS) {
+ log_info ("Added new forward map from %.*s to %s",
+ (int)ddns_fwd_name -> len,
+ (const char *)ddns_fwd_name -> data, ddns_address);
+ goto error;
+ }
/*
@@ -653,9 +652,19 @@ isc_result_t ddns_update_a (struct data_string *ddns_fwd_name,
* -- "Interaction between DHCP and DNS"
*/
- if (result != (rrsetp ? ISC_R_YXRRSET : ISC_R_YXDOMAIN))
- return result;
+ if (result != (rrsetp ? ISC_R_YXRRSET : ISC_R_YXDOMAIN)) {
+ log_error ("Unable to add forward map from %.*s to %s: %s",
+ (int)ddns_fwd_name -> len,
+ (const char *)ddns_fwd_name -> data, ddns_address,
+ isc_result_totext (result));
+ goto error;
+ }
+ while (!ISC_LIST_EMPTY (updqueue)) {
+ updrec = ISC_LIST_HEAD (updqueue);
+ ISC_LIST_UNLINK (updqueue, updrec, r_link);
+ minires_freeupdrec (updrec);
+ }
/*
* DHCID RR exists, and matches client identity.
@@ -716,7 +725,27 @@ isc_result_t ddns_update_a (struct data_string *ddns_fwd_name,
*/
result = minires_nupdate (&resolver_state, ISC_LIST_HEAD (updqueue));
+ if (result != ISC_R_SUCCESS) {
+ if (result == YXRRSET || result == YXDOMAIN ||
+ result == NXRRSET || result == NXDOMAIN)
+ log_error ("Forward map from %.*s to %s already in use",
+ (int)ddns_fwd_name -> len,
+ (const char *)ddns_fwd_name -> data,
+ ddns_address);
+ else
+ log_error ("Can't update forward map %.*s to %s: %s",
+ (int)ddns_fwd_name -> len,
+ (const char *)ddns_fwd_name -> data,
+ ddns_address, isc_result_totext (result));
+
+ } else {
+ log_info ("Added new forward map from %.*s to %s",
+ (int)ddns_fwd_name -> len,
+ (const char *)ddns_fwd_name -> data, ddns_address);
+ }
+#if defined (DEBUG_DNS_UPDATES)
print_dns_status ((int)result, &updqueue);
+#endif
/*
* If this query succeeds, the updater can conclude that the current
diff --git a/contrib/isc-dhcp/common/options.c b/contrib/isc-dhcp/common/options.c
index b7a5a04..37e98eb 100644
--- a/contrib/isc-dhcp/common/options.c
+++ b/contrib/isc-dhcp/common/options.c
@@ -3,7 +3,7 @@
DHCP options parsing and reassembly. */
/*
- * Copyright (c) 1995-2001 Internet Software Consortium.
+ * Copyright (c) 1995-2002 Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
-"$Id: options.c,v 1.85.2.6 2001/10/18 20:11:38 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
+"$Id: options.c,v 1.85.2.8 2002/02/19 20:36:52 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#define DHCP_OPTION_DATA
@@ -373,9 +373,16 @@ int fqdn_universe_decode (struct option_state *options,
*s = '.';
s += len + 1;
- total_len += len;
+ total_len += len + 1;
}
+ /* We wind up with a length that's one too many because
+ we shouldn't increment for the last label, but there's
+ no way to tell we're at the last label until we exit
+ the loop. :'*/
+ if (total_len > 0)
+ total_len--;
+
if (!terminated) {
first_len = total_len;
}
@@ -508,6 +515,7 @@ int cons_options (inpacket, outpacket, lease, client_state,
priority_list [priority_len++] = DHO_DHCP_LEASE_TIME;
priority_list [priority_len++] = DHO_DHCP_MESSAGE;
priority_list [priority_len++] = DHO_DHCP_REQUESTED_ADDRESS;
+ priority_list [priority_len++] = DHO_FQDN;
if (prl && prl -> len > 0) {
if ((op = lookup_option (&dhcp_universe, cfg_options,
@@ -544,7 +552,8 @@ int cons_options (inpacket, outpacket, lease, client_state,
if (cfg_options -> site_code_min) {
for (i = 0; i < OPTION_HASH_SIZE; i++) {
hash = cfg_options -> universes [dhcp_universe.index];
- for (pp = hash [i]; pp; pp = pp -> cdr) {
+ if (hash) {
+ for (pp = hash [i]; pp; pp = pp -> cdr) {
op = (struct option_cache *)(pp -> car);
if (op -> option -> code <
cfg_options -> site_code_min &&
@@ -553,6 +562,7 @@ int cons_options (inpacket, outpacket, lease, client_state,
DHO_DHCP_AGENT_OPTIONS))
priority_list [priority_len++] =
op -> option -> code;
+ }
}
}
}
@@ -561,8 +571,9 @@ int cons_options (inpacket, outpacket, lease, client_state,
is no site option space, we'll be cycling through the
dhcp option space. */
for (i = 0; i < OPTION_HASH_SIZE; i++) {
- hash = (cfg_options -> universes
- [cfg_options -> site_universe]);
+ hash = (cfg_options -> universes
+ [cfg_options -> site_universe]);
+ if (hash)
for (pp = hash [i]; pp; pp = pp -> cdr) {
op = (struct option_cache *)(pp -> car);
if (op -> option -> code >=
@@ -770,8 +781,9 @@ int store_options (buffer, buflen, packet, lease, client_state,
to be encapsulated first, except that if it's a straight
encapsulation and the user has provided a value for the
encapsulation option, use the user-provided value. */
- if ((u -> options [code] -> format [0] == 'E' && !oc) ||
- u -> options [code] -> format [0] == 'e') {
+ if (u -> options [code] &&
+ ((u -> options [code] -> format [0] == 'E' && !oc) ||
+ u -> options [code] -> format [0] == 'e')) {
int uix;
static char *s, *t;
struct option_cache *tmp;
diff --git a/contrib/isc-dhcp/common/print.c b/contrib/isc-dhcp/common/print.c
index 67e8ddd..bd244c4 100644
--- a/contrib/isc-dhcp/common/print.c
+++ b/contrib/isc-dhcp/common/print.c
@@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
-"$Id: print.c,v 1.53.2.4 2001/08/08 14:49:20 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
+"$Id: print.c,v 1.53.2.5 2002/02/09 03:23:19 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -1197,6 +1197,14 @@ void print_dns_status (int status, ns_updque *uq)
}
predicate = "and";
}
+ if (u -> r_dname) {
+ if (s + 1 < end)
+ *s++ = ' ';
+ if (s + strlen (u -> r_dname) < end) {
+ strcpy (s, u -> r_dname);
+ s += strlen (s);
+ }
+ }
if (ttlp) {
if (s + 1 < end)
*s++ = ' ';
@@ -1253,14 +1261,6 @@ void print_dns_status (int status, ns_updque *uq)
strcpy (s, en);
s += strlen (en);
}
- if (u -> r_dname) {
- if (s + 1 < end)
- *s++ = ' ';
- if (s + strlen (u -> r_dname) < end) {
- strcpy (s, u -> r_dname);
- s += strlen (s);
- }
- }
if (u -> r_data) {
if (s + 1 < end)
*s++ = ' ';
diff --git a/contrib/isc-dhcp/common/tables.c b/contrib/isc-dhcp/common/tables.c
index d3e2379..bfdf0c1 100644
--- a/contrib/isc-dhcp/common/tables.c
+++ b/contrib/isc-dhcp/common/tables.c
@@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
-"$Id: tables.c,v 1.51.2.4 2001/10/17 03:26:26 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
+"$Id: tables.c,v 1.51.2.5 2002/02/09 03:23:54 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -1195,7 +1195,7 @@ void initialize_common_option_spaces()
nwip_universe.tag_size = 1;
nwip_universe.store_tag = putUChar;
nwip_universe.store_length = putUChar;
- fqdn_universe.enc_opt = &dhcp_options [DHO_NWIP_SUBOPTIONS];
+ nwip_universe.enc_opt = &dhcp_options [DHO_NWIP_SUBOPTIONS];
nwip_universe.index = universe_count++;
universes [nwip_universe.index] = &nwip_universe;
option_new_hash (&nwip_universe.hash, 1, MDL);
OpenPOWER on IntegriCloud