Resolve conflicts:
* $FreeBSD$ * connect std{in,out,err} (r1.19). * prefer strlcpy to strpy (r1.13). * quiet by default (r1.6). * document -D option.
This commit is contained in:
parent
dd19e39d2e
commit
dbb6941311
@ -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.129.2.7 2001/08/08 14:46:14 mellon Exp $ Copyright (c) 1995-2001 Internet Software Consortium. All rights reserved.\n"
|
||||
"$Id: dhclient.c,v 1.129.2.9 2002/02/20 07:16:31 mellon Exp $ Copyright (c) 1995-2001 Internet Software Consortium. All rights reserved.\n"
|
||||
"$FreeBSD$\n";
|
||||
#endif /* not lint */
|
||||
|
||||
@ -884,7 +884,11 @@ void bind_lease (client)
|
||||
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
|
||||
@ -1185,12 +1189,13 @@ struct client_lease *packet_to_lease (packet, client)
|
||||
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,
|
||||
@ -2969,7 +2974,8 @@ isc_result_t dhcp_set_control_state (control_object_state_t oldstate,
|
||||
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;
|
||||
@ -2989,9 +2995,30 @@ isc_result_t dhcp_set_control_state (control_object_state_t oldstate,
|
||||
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_fqdn, ddns_fwd_name,
|
||||
ddns_dhcid, client_identifier;
|
||||
@ -3003,11 +3030,11 @@ void client_dns_update (struct client_state *client, int addp)
|
||||
/* 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,
|
||||
@ -3017,7 +3044,7 @@ void client_dns_update (struct client_state *client, int addp)
|
||||
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. */
|
||||
@ -3028,7 +3055,7 @@ void client_dns_update (struct client_state *client, int addp)
|
||||
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);
|
||||
@ -3039,7 +3066,7 @@ void client_dns_update (struct client_state *client, int addp)
|
||||
client -> sent_options,
|
||||
(struct option_state *)0,
|
||||
&global_scope, oc, MDL))
|
||||
return;
|
||||
return ISC_R_SUCCESS;
|
||||
|
||||
/* Make a dhcid string out of either the client identifier,
|
||||
if we are sending one, or the interface's MAC address,
|
||||
@ -3065,7 +3092,7 @@ void client_dns_update (struct client_state *client, int addp)
|
||||
client -> interface -> hw_address.hlen);
|
||||
if (!result) {
|
||||
data_string_forget (&ddns_fwd_name, MDL);
|
||||
return;
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
/* Start the resolver, if necessary. */
|
||||
@ -3083,7 +3110,7 @@ void client_dns_update (struct client_state *client, int addp)
|
||||
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,
|
||||
@ -3093,4 +3120,5 @@ void client_dns_update (struct client_state *client, int addp)
|
||||
|
||||
data_string_forget (&ddns_fwd_name, MDL);
|
||||
data_string_forget (&ddns_dhcid, MDL);
|
||||
return rcode;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user