Use reinit_selecting() in arp.c.
This commit is contained in:
parent
c79c65454c
commit
b3acad9166
19
ndhc/arp.c
19
ndhc/arp.c
@ -1,5 +1,5 @@
|
|||||||
/* arp.c - arp ping checking
|
/* arp.c - arp ping checking
|
||||||
* Time-stamp: <2011-07-04 22:32:29 njk>
|
* Time-stamp: <2011-07-04 22:51:19 njk>
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011 Nicholas J. Kain <njkain@gmail.com>
|
* Copyright 2010-2011 Nicholas J. Kain <njkain@gmail.com>
|
||||||
*
|
*
|
||||||
@ -356,28 +356,15 @@ static void arp_failed(struct client_state_t *cs)
|
|||||||
log_line("arp: Offered address is in use -- declining");
|
log_line("arp: Offered address is in use -- declining");
|
||||||
arp_close_fd(cs);
|
arp_close_fd(cs);
|
||||||
send_decline(cs, arp_dhcp_packet.yiaddr);
|
send_decline(cs, arp_dhcp_packet.yiaddr);
|
||||||
|
reinit_selecting(cs, 0);
|
||||||
if (cs->arpPrevState != DS_REQUESTING)
|
|
||||||
ifchange_deconfig();
|
|
||||||
cs->dhcpState = DS_SELECTING;
|
|
||||||
cs->clientAddr = 0;
|
|
||||||
cs->timeout = 0;
|
|
||||||
cs->packetNum = 0;
|
|
||||||
set_listen_raw(cs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void arp_gw_failed(struct client_state_t *cs)
|
void arp_gw_failed(struct client_state_t *cs)
|
||||||
{
|
{
|
||||||
log_line("arp: Gateway appears to have changed, getting new lease");
|
log_line("arp: Gateway appears to have changed, getting new lease");
|
||||||
arp_close_fd(cs);
|
arp_close_fd(cs);
|
||||||
|
|
||||||
ifchange_deconfig();
|
|
||||||
cs->dhcpState = DS_SELECTING;
|
|
||||||
cs->oldTimeout = 0;
|
cs->oldTimeout = 0;
|
||||||
cs->timeout = 0;
|
reinit_selecting(cs, 0);
|
||||||
cs->clientAddr = 0;
|
|
||||||
cs->packetNum = 0;
|
|
||||||
set_listen_raw(cs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void arp_success(struct client_state_t *cs)
|
void arp_success(struct client_state_t *cs)
|
||||||
|
@ -56,7 +56,7 @@ static int delay_timeout(int numpackets)
|
|||||||
return to * 1000;
|
return to * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reinit_selecting(struct client_state_t *cs, int timeout)
|
void reinit_selecting(struct client_state_t *cs, int timeout)
|
||||||
{
|
{
|
||||||
ifchange_deconfig();
|
ifchange_deconfig();
|
||||||
cs->dhcpState = DS_SELECTING;
|
cs->dhcpState = DS_SELECTING;
|
||||||
|
@ -16,6 +16,8 @@ typedef enum {
|
|||||||
DS_NUM_STATES,
|
DS_NUM_STATES,
|
||||||
} dhcp_states_t;
|
} dhcp_states_t;
|
||||||
|
|
||||||
|
void reinit_selecting(struct client_state_t *cs, int timeout);
|
||||||
|
|
||||||
void packet_action(struct client_state_t *cs, struct dhcpmsg *packet,
|
void packet_action(struct client_state_t *cs, struct dhcpmsg *packet,
|
||||||
uint8_t *message);
|
uint8_t *message);
|
||||||
void timeout_action(struct client_state_t *cs);
|
void timeout_action(struct client_state_t *cs);
|
||||||
|
Loading…
Reference in New Issue
Block a user