Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/dist/dhcp merge dhcp-3.0.1rc9
details: https://anonhg.NetBSD.org/src/rev/b1162f178dca
branches: trunk
changeset: 532630:b1162f178dca
user: drochner <drochner%NetBSD.org@localhost>
date: Tue Jun 11 13:59:59 2002 +0000
description:
merge dhcp-3.0.1rc9
diffstat:
dist/dhcp/client/clparse.c | 22 +++-
dist/dhcp/client/dhclient-script.8 | 7 +-
dist/dhcp/client/dhclient.8 | 4 +-
dist/dhcp/client/dhclient.c | 68 +++++++++--
dist/dhcp/client/dhclient.conf.5 | 32 ++++-
dist/dhcp/client/dhclient.leases.5 | 6 +-
dist/dhcp/common/alloc.c | 47 +++---
dist/dhcp/common/auth.c | 72 -----------
dist/dhcp/common/bpf.c | 4 +-
dist/dhcp/common/comapi.c | 12 +-
dist/dhcp/common/conflex.c | 2 +-
dist/dhcp/common/dhcp-contrib.5 | 214 -----------------------------------
dist/dhcp/common/dhcp-eval.5 | 38 +----
dist/dhcp/common/dhcp-options.5 | 226 ++++++++++++++++++++++++++++++++----
dist/dhcp/common/discover.c | 11 +-
dist/dhcp/common/dns.c | 74 ++++++++---
dist/dhcp/common/execute.c | 16 +-
dist/dhcp/common/icmp.c | 5 +-
dist/dhcp/common/memory.c | 11 +-
dist/dhcp/common/options.c | 41 +++++-
dist/dhcp/common/parse.c | 45 +++++--
dist/dhcp/common/print.c | 23 ++-
dist/dhcp/common/socket.c | 5 +-
dist/dhcp/common/tables.c | 22 +-
dist/dhcp/common/tree.c | 11 +-
dist/dhcp/dhcpctl/dhcpctl.c | 5 +-
dist/dhcp/dhcpctl/omshell.c | 9 +
dist/dhcp/includes/dhcp.h | 7 +-
dist/dhcp/includes/dhcpd.h | 71 +++++++---
dist/dhcp/includes/dhctoken.h | 5 +-
dist/dhcp/includes/site.h | 5 +
dist/dhcp/omapip/alloc.c | 36 +++--
dist/dhcp/omapip/auth.c | 2 +-
dist/dhcp/omapip/hash.c | 72 +++++++----
dist/dhcp/omapip/protocol.c | 6 +-
dist/dhcp/omapip/support.c | 25 ++-
dist/dhcp/relay/dhcrelay.8 | 6 +-
dist/dhcp/relay/dhcrelay.c | 6 +-
dist/dhcp/server/class.c | 2 +-
dist/dhcp/server/confpars.c | 166 ++++++++++++++++++++++-----
dist/dhcp/server/db.c | 42 +++++-
dist/dhcp/server/ddns.c | 67 ++++++++++-
dist/dhcp/server/dhcp.c | 113 +++++++++++++----
dist/dhcp/server/dhcpd.8 | 2 +-
dist/dhcp/server/dhcpd.c | 14 +-
dist/dhcp/server/dhcpd.conf.5 | 218 ++++++++++++++++++++++++----------
dist/dhcp/server/dhcpd.leases.5 | 2 +-
dist/dhcp/server/failover.c | 213 ++++++++++++++++++++--------------
dist/dhcp/server/mdb.c | 189 +++++++++++++++++-------------
dist/dhcp/server/omapi.c | 72 +++++++----
dist/dhcp/server/stables.c | 2 +-
51 files changed, 1437 insertions(+), 938 deletions(-)
diffs (truncated from 5411 to 300 lines):
diff -r 1e19c05be744 -r b1162f178dca dist/dhcp/client/clparse.c
--- a/dist/dhcp/client/clparse.c Tue Jun 11 13:58:09 2002 +0000
+++ b/dist/dhcp/client/clparse.c Tue Jun 11 13:59:59 2002 +0000
@@ -3,7 +3,7 @@
Parser for dhclient config and lease files... */
/*
- * Copyright (c) 1996-2001 Internet Software Consortium.
+ * Copyright (c) 1996-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: clparse.c,v 1.3 2002/06/10 00:30:33 itojun Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n";
+"$Id: clparse.c,v 1.4 2002/06/11 14:00:00 drochner Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -89,6 +89,7 @@
top_level_config.script_name = path_dhclient_script;
top_level_config.requested_options = default_requested_options;
top_level_config.omapi_port = -1;
+ top_level_config.do_forward_update = 1;
group_allocate (&top_level_config.on_receipt, MDL);
if (!top_level_config.on_receipt)
@@ -462,6 +463,23 @@
parse_semi (cfile);
return;
+ case DO_FORWARD_UPDATE:
+ token = next_token (&val, (unsigned *)0, cfile);
+ token = next_token (&val, (unsigned *)0, cfile);
+ if (!strcasecmp (val, "on") ||
+ !strcasecmp (val, "true"))
+ config -> do_forward_update = 1;
+ else if (!strcasecmp (val, "off") ||
+ !strcasecmp (val, "false"))
+ config -> do_forward_update = 0;
+ else {
+ parse_warn (cfile, "expecting boolean value.");
+ skip_to_semi (cfile);
+ return;
+ }
+ parse_semi (cfile);
+ return;
+
case REBOOT:
token = next_token (&val, (unsigned *)0, cfile);
parse_lease_time (cfile, &config -> reboot_timeout);
diff -r 1e19c05be744 -r b1162f178dca dist/dhcp/client/dhclient-script.8
--- a/dist/dhcp/client/dhclient-script.8 Tue Jun 11 13:58:09 2002 +0000
+++ b/dist/dhcp/client/dhclient-script.8 Tue Jun 11 13:59:59 2002 +0000
@@ -97,7 +97,8 @@
of dhclient-script.
.SH OPERATION
When dhclient needs to invoke the client configuration script, it
-writes a shell script into /tmp which defines a variety of variables.
+defines a set of variables in the environment, and then invokes
+.B CLIENTBINDIR/dhclient-script.
In all cases, $reason is set to the name of the reason why the script
has been invoked. The following reasons are currently defined:
MEDIUM, PREINIT, BOUND, RENEW, REBIND, REBOOT, EXPIRE, FAIL and TIMEOUT.
@@ -215,10 +216,10 @@
.SH AUTHOR
.B dhclient-script(8)
has been written for the Internet Software Consortium
-by Ted Lemon <mellon%fugue.com@localhost> in cooperation with Vixie
+by Ted Lemon in cooperation with Vixie
Enterprises. To learn more about the Internet Software Consortium,
see
-.B http://www.vix.com/isc.
+.B http://www.isc.org.
To learn more about Vixie
Enterprises, see
.B http://www.vix.com.
diff -r 1e19c05be744 -r b1162f178dca dist/dhcp/client/dhclient.8
--- a/dist/dhcp/client/dhclient.8 Tue Jun 11 13:58:09 2002 +0000
+++ b/dist/dhcp/client/dhclient.8 Tue Jun 11 13:59:59 2002 +0000
@@ -292,10 +292,10 @@
.SH AUTHOR
.B dhclient(8)
has been written for the Internet Software Consortium
-by Ted Lemon <mellon%fugue.com@localhost> in cooperation with Vixie
+by Ted Lemon in cooperation with Vixie
Enterprises. To learn more about the Internet Software Consortium,
see
-.B http://www.vix.com/isc.
+.B http://www.isc.org
To learn more about Vixie
Enterprises, see
.B http://www.vix.com.
diff -r 1e19c05be744 -r b1162f178dca dist/dhcp/client/dhclient.c
--- a/dist/dhcp/client/dhclient.c Tue Jun 11 13:58:09 2002 +0000
+++ b/dist/dhcp/client/dhclient.c Tue Jun 11 13:59:59 2002 +0000
@@ -3,7 +3,7 @@
DHCP Client. */
/*
- * 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
@@ -41,7 +41,7 @@
#ifndef lint
static char ocopyright[] =
-"$Id: dhclient.c,v 1.5 2002/06/10 00:30:33 itojun Exp $ Copyright (c) 1995-2001 Internet Software Consortium. All rights reserved.\n";
+"$Id: dhclient.c,v 1.6 2002/06/11 14:00:00 drochner Exp $ Copyright (c) 1995-2001 Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -882,7 +882,11 @@
client -> state = S_BOUND;
reinitialize_interfaces ();
go_daemon ();
- client_dns_update (client, 1);
+ if (client -> config -> do_forward_update) {
+ client -> dns_update_timeout = 1;
+ add_timeout (cur_time + 1, client_dns_update_timeout,
+ client, 0, 0);
+ }
}
/* state_bound is called when we've successfully bound to a particular
@@ -1179,12 +1183,13 @@
memcpy (lease -> address.iabuf, &packet -> raw -> yiaddr,
lease -> address.len);
+ memset (&data, 0, sizeof data);
+
if (client -> config -> vendor_space_name) {
i = DHO_VENDOR_ENCAPSULATED_OPTIONS;
/* See if there was a vendor encapsulation option. */
oc = lookup_option (&dhcp_universe, lease -> options, i);
- memset (&data, 0, sizeof data);
if (oc &&
client -> config -> vendor_space_name &&
evaluate_option_cache (&data, packet,
@@ -1864,6 +1869,7 @@
(struct option_state *)0, options,
&global_scope, 0, 0, 0, (struct data_string *)0,
client -> config -> vendor_space_name);
+ option_state_dereference (&options, MDL);
if (client -> packet_length < BOOTP_MIN_LEN)
client -> packet_length = BOOTP_MIN_LEN;
@@ -1927,6 +1933,7 @@
(struct option_state *)0, client -> sent_options,
&global_scope, 0, 0, 0, (struct data_string *)0,
client -> config -> vendor_space_name);
+ option_state_dereference (&client -> sent_options, MDL);
if (client -> packet_length < BOOTP_MIN_LEN)
client -> packet_length = BOOTP_MIN_LEN;
@@ -1996,6 +2003,7 @@
(struct option_state *)0, options,
&global_scope, 0, 0, 0, (struct data_string *)0,
client -> config -> vendor_space_name);
+ option_state_dereference (&options, MDL);
if (client -> packet_length < BOOTP_MIN_LEN)
client -> packet_length = BOOTP_MIN_LEN;
option_state_dereference (&options, MDL);
@@ -2637,6 +2645,7 @@
{
static int state = 0;
int pid;
+ int i;
/* Don't become a daemon if the user requested otherwise. */
if (no_daemon) {
@@ -2665,6 +2674,16 @@
close(1);
close(2);
+ /* Reopen them on /dev/null. */
+ i = open ("/dev/null", O_RDWR);
+ if (i == 0)
+ i = open ("/dev/null", O_RDWR);
+ if (i == 1) {
+ i = open ("/dev/null", O_RDWR);
+ log_perror = 0; /* No sense logging to /dev/null. */
+ } else if (i != -1)
+ close (i);
+
write_client_pid_file ();
}
@@ -2932,7 +2951,8 @@
case server_shutdown:
if (client -> active &&
client -> active -> expiry > cur_time) {
- client_dns_update (client, 0);
+ if (client -> config -> do_forward_update)
+ client_dns_update (client, 0, 0);
do_release (client);
}
break;
@@ -2952,9 +2972,30 @@
return ISC_R_SUCCESS;
}
+/* Called after a timeout if the DNS update failed on the previous try.
+ Retries the update, and if it times out, schedules a retry after
+ ten times as long of a wait. */
+
+void client_dns_update_timeout (void *cp)
+{
+ struct client_state *client = cp;
+ isc_result_t status;
+
+ if (client -> active) {
+ status = client_dns_update (client, 1,
+ (client -> active -> renewal -
+ cur_time));
+ if (status == ISC_R_TIMEDOUT) {
+ client -> dns_update_timeout *= 10;
+ add_timeout (cur_time + client -> dns_update_timeout,
+ client_dns_update_timeout, client, 0, 0);
+ }
+ }
+}
+
/* See if we should do a DNS update, and if so, do it. */
-void client_dns_update (struct client_state *client, int addp)
+isc_result_t client_dns_update (struct client_state *client, int addp, int ttl)
{
struct data_string ddns_fwd_name,
ddns_dhcid, client_identifier;
@@ -2966,11 +3007,11 @@
/* If we didn't send an FQDN option, we certainly aren't going to
be doing an update. */
if (!client -> sent_options)
- return;
+ return ISC_R_SUCCESS;
/* If we don't have a lease, we can't do an update. */
if (!client -> active)
- return;
+ return ISC_R_SUCCESS;
/* If we set the no client update flag, don't do the update. */
if ((oc = lookup_option (&fqdn_universe, client -> sent_options,
@@ -2980,7 +3021,7 @@
client -> sent_options,
(struct option_state *)0,
&global_scope, oc, MDL))
- return;
+ return ISC_R_SUCCESS;
/* If we set the "server, please update" flag, or didn't set it
to false, don't do the update. */
@@ -2991,7 +3032,7 @@
client -> sent_options,
(struct option_state *)0,
&global_scope, oc, MDL))
- return;
+ return ISC_R_SUCCESS;
/* If no FQDN option was supplied, don't do the update. */
memset (&ddns_fwd_name, 0, sizeof ddns_fwd_name);
@@ -3002,7 +3043,7 @@
client -> sent_options,
(struct option_state *)0,
&global_scope, oc, MDL))
- return;
+ return ISC_R_SUCCESS;
#ifndef SMALL
/* Make a dhcid string out of either the client identifier,
@@ -3029,7 +3070,7 @@
client -> interface -> hw_address.hlen);
if (!result) {
data_string_forget (&ddns_fwd_name, MDL);
- return;
+ return ISC_R_SUCCESS;
}
/* Start the resolver, if necessary. */
@@ -3047,7 +3088,7 @@
if (addp)
rcode = ddns_update_a (&ddns_fwd_name,
client -> active -> address,
- &ddns_dhcid, DEFAULT_DDNS_TTL,
+ &ddns_dhcid, ttl,
1);
else
rcode = ddns_remove_a (&ddns_fwd_name,
@@ -3058,4 +3099,5 @@
data_string_forget (&ddns_fwd_name, MDL);
data_string_forget (&ddns_dhcid, MDL);
#endif
+ return rcode;
}
Home |
Main Index |
Thread Index |
Old Index