Handle hardware link state loss and restoration on networks that lack a
default gw properly.
This commit is contained in:
parent
ad5c5d6803
commit
080fefaea0
@ -1,5 +1,5 @@
|
||||
/* packet.h - send and react to DHCP message packets
|
||||
* Time-stamp: <2011-06-11 11:12:26 njk>
|
||||
* Time-stamp: <2011-07-06 11:17:15 njk>
|
||||
*
|
||||
* (c) 2004-2011 Nicholas J. Kain <njkain at gmail dot com>
|
||||
* (c) 2001 Russ Dill <Russ.Dill@asu.edu>
|
||||
@ -51,7 +51,7 @@ struct dhcpmsg {
|
||||
uint16_t secs; // Filled by client: seconds since client began address
|
||||
// aquisition or renewal process.
|
||||
uint16_t flags; // DHCP flags
|
||||
uint32_t ciaddr; // Client IP: only filled in if client is inBOUND, RENEW,
|
||||
uint32_t ciaddr; // Client IP: only filled in if client is in BOUND, RENEW,
|
||||
// or REBINDING and can reply to ARP requests
|
||||
uint32_t yiaddr; // 'your' (client) IP address
|
||||
uint32_t siaddr; // IP address of next server to use in bootstrap; returned
|
||||
|
20
ndhc/state.c
20
ndhc/state.c
@ -292,17 +292,19 @@ void ifup_action(struct client_state_t *cs)
|
||||
{
|
||||
// If we have a lease, check to see if our gateway is still valid via ARP.
|
||||
// If it fails, state -> SELECTING.
|
||||
if (cs->dhcpState == DS_BOUND || cs->dhcpState == DS_RENEWING ||
|
||||
cs->dhcpState == DS_REBINDING) {
|
||||
if (arp_gw_check(cs) == -1)
|
||||
log_warning("nl: arp_gw_check could not make arp socket, assuming lease is still OK");
|
||||
else
|
||||
if (cs->routerAddr && (cs->dhcpState == DS_BOUND ||
|
||||
cs->dhcpState == DS_RENEWING ||
|
||||
cs->dhcpState == DS_REBINDING)) {
|
||||
if (arp_gw_check(cs) != -1) {
|
||||
log_line("nl: interface back, revalidating lease");
|
||||
// If we don't have a lease, state -> SELECTING.
|
||||
} else if (cs->dhcpState != DS_SELECTING) {
|
||||
log_line("nl: %s back, querying for new lease", client_config.interface);
|
||||
reinit_selecting(cs, 0);
|
||||
return;
|
||||
} else
|
||||
log_warning("nl: arp_gw_check could not make arp socket");
|
||||
}
|
||||
if (cs->dhcpState == DS_SELECTING)
|
||||
return;
|
||||
log_line("nl: %s back, querying for new lease", client_config.interface);
|
||||
reinit_selecting(cs, 0);
|
||||
}
|
||||
|
||||
void ifdown_action(struct client_state_t *cs)
|
||||
|
Loading…
Reference in New Issue
Block a user