Make sure xids in packets sent conform to RFC2131 pg36 table5.
This commit is contained in:
parent
5dc35eca6d
commit
4df035ced3
@ -544,6 +544,7 @@ int main(int argc, char *argv[])
|
|||||||
parse_cmdline(argc, argv);
|
parse_cmdline(argc, argv);
|
||||||
|
|
||||||
nk_random_init(&cs.rnd_state);
|
nk_random_init(&cs.rnd_state);
|
||||||
|
cs.xid = nk_random_u32(&cs.rnd_state);
|
||||||
|
|
||||||
if (getuid())
|
if (getuid())
|
||||||
suicide("I need to be started as root.");
|
suicide("I need to be started as root.");
|
||||||
|
@ -75,6 +75,7 @@ static int delay_timeout(struct client_state_t cs[static 1], size_t numpackets)
|
|||||||
|
|
||||||
static void reinit_shared_deconfig(struct client_state_t cs[static 1])
|
static void reinit_shared_deconfig(struct client_state_t cs[static 1])
|
||||||
{
|
{
|
||||||
|
cs->xid = nk_random_u32(&cs->rnd_state);
|
||||||
cs->clientAddr = 0;
|
cs->clientAddr = 0;
|
||||||
cs->num_dhcp_requests = 0;
|
cs->num_dhcp_requests = 0;
|
||||||
cs->server_arp_sent = 0;
|
cs->server_arp_sent = 0;
|
||||||
@ -289,6 +290,7 @@ static int selecting_packet(struct client_state_t cs[static 1],
|
|||||||
client_config.interface);
|
client_config.interface);
|
||||||
return ANP_IGNORE;
|
return ANP_IGNORE;
|
||||||
}
|
}
|
||||||
|
cs->xid = packet->xid; // Use for subsequent DHCPREQUESTs
|
||||||
cs->clientAddr = packet->yiaddr;
|
cs->clientAddr = packet->yiaddr;
|
||||||
cs->serverAddr = sid;
|
cs->serverAddr = sid;
|
||||||
cs->srcAddr = srcaddr;
|
cs->srcAddr = srcaddr;
|
||||||
@ -351,8 +353,6 @@ static int selecting_timeout(struct client_state_t cs[static 1],
|
|||||||
} else if (client_config.abort_if_no_lease)
|
} else if (client_config.abort_if_no_lease)
|
||||||
suicide("%s: No lease; failing.", client_config.interface);
|
suicide("%s: No lease; failing.", client_config.interface);
|
||||||
}
|
}
|
||||||
if (cs->num_dhcp_requests == 0)
|
|
||||||
cs->xid = nk_random_u32(&cs->rnd_state);
|
|
||||||
if (send_discover(cs) < 0) {
|
if (send_discover(cs) < 0) {
|
||||||
log_warning("%s: Failed to send a discover request packet.",
|
log_warning("%s: Failed to send a discover request packet.",
|
||||||
client_config.interface);
|
client_config.interface);
|
||||||
@ -450,7 +450,6 @@ int dhcp_handle(struct client_state_t cs[static 1], long long nowts,
|
|||||||
{
|
{
|
||||||
scrBegin;
|
scrBegin;
|
||||||
reinit:
|
reinit:
|
||||||
cs->xid = nk_random_u32(&cs->rnd_state);
|
|
||||||
// We're in the SELECTING state here.
|
// We're in the SELECTING state here.
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int ret = COR_SUCCESS;
|
int ret = COR_SUCCESS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user