-/* $OpenBSD: dhclient.c,v 1.421 2017/06/14 15:57:25 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.422 2017/06/14 16:09:42 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
rtm->rtm_priority != RTP_PROPOSAL_DHCLIENT)
goto done;
if ((rtm->rtm_flags & RTF_PROTO3) != 0) {
- if (rtm->rtm_seq == (int32_t)client->xid) {
+ if (rtm->rtm_seq == (int32_t)ifi->xid) {
ifi->flags |= IFI_IN_CHARGE;
} else if ((ifi->flags & IFI_IN_CHARGE) != 0) {
rslt = asprintf(&errmsg, "yielding "
}
setproctitle("%s", ifi->name);
- time(&ifi->client->startup_time);
+ time(&ifi->startup_time);
if (ifi->linkstat) {
ifi->client->state = S_REBOOTING;
time(&cur_time);
- interval = (int)(cur_time - client->startup_time);
+ interval = (int)(cur_time - ifi->startup_time);
ifi->linkstat = interface_status(ifi);
return;
}
- client->xid = arc4random();
+ ifi->xid = arc4random();
make_request(ifi, client->active);
client->destination.s_addr = INADDR_BROADCAST;
- client->first_sending = time(NULL);
+ ifi->first_sending = time(NULL);
client->interval = 0;
send_request(ifi);
struct interface_info *ifi = xifi;
struct client_state *client = ifi->client;
- client->xid = arc4random();
+ ifi->xid = arc4random();
make_discover(ifi, client->active);
client->destination.s_addr = INADDR_BROADCAST;
client->state = S_SELECTING;
- client->first_sending = time(NULL);
+ ifi->first_sending = time(NULL);
client->interval = 0;
send_discover(ifi);
client->destination.s_addr = INADDR_BROADCAST;
client->state = S_REQUESTING;
- client->first_sending = time(NULL);
+ ifi->first_sending = time(NULL);
client->interval = 0;
struct option_data *opt;
struct in_addr *dest;
- client->xid = arc4random();
+ ifi->xid = arc4random();
make_request(ifi, client->active);
dest = &client->destination;
else
dest->s_addr = INADDR_BROADCAST;
- client->first_sending = time(NULL);
+ ifi->first_sending = time(NULL);
client->interval = 0;
client->state = S_RENEWING;
lease->is_bootp = 1;
/* Figure out when we're supposed to stop selecting. */
- stop_selecting = client->first_sending + config->select_interval;
+ stop_selecting = ifi->first_sending + config->select_interval;
if (TAILQ_EMPTY(&client->offered_leases)) {
TAILQ_INSERT_HEAD(&client->offered_leases, lease, next);
time(&cur_time);
/* Figure out how long it's been since we started transmitting. */
- interval = cur_time - client->first_sending;
+ interval = cur_time - ifi->first_sending;
if (interval > config->timeout) {
state_panic(ifi);
/* If the backoff would take us to the panic timeout, just use that
as the interval. */
if (cur_time + client->interval >
- client->first_sending + config->timeout)
- client->interval = (client->first_sending +
- config->timeout) - cur_time + 1;
+ ifi->first_sending + config->timeout)
+ client->interval = (ifi->first_sending +
+ config->timeout) - cur_time + 1;
/* Record the number of seconds since we started sending. */
if (interval < UINT16_MAX)
packet->secs = htons(interval);
else
packet->secs = htons(UINT16_MAX);
- client->secs = packet->secs;
+ ifi->secs = packet->secs;
log_info("DHCPDISCOVER on %s - interval %lld", ifi->name,
(long long)client->interval);
time(&cur_time);
/* Figure out how long it's been since we started transmitting. */
- interval = (int)(cur_time - client->first_sending);
+ interval = (int)(cur_time - ifi->first_sending);
/*
* If we're in the INIT-REBOOT state and we've been trying longer
/* Record the number of seconds since we started sending. */
if (client->state == S_REQUESTING)
- packet->secs = client->secs;
+ packet->secs = ifi->secs;
else {
if (interval < UINT16_MAX)
packet->secs = htons(interval);
packet->htype = HTYPE_ETHER ;
packet->hlen = ETHER_ADDR_LEN;
packet->hops = 0;
- packet->xid = client->xid;
+ packet->xid = ifi->xid;
packet->secs = 0; /* filled in by send_discover. */
packet->flags = 0;
packet->htype = HTYPE_ETHER ;
packet->hlen = ETHER_ADDR_LEN;
packet->hops = 0;
- packet->xid = client->xid;
+ packet->xid = ifi->xid;
packet->secs = 0; /* Filled in by send_request. */
packet->flags = 0;
void
make_decline(struct interface_info *ifi, struct client_lease *lease)
{
- struct client_state *client = ifi->client;
struct option_data options[256];
struct dhcp_packet *packet = &ifi->sent_packet;
unsigned char decline = DHCPDECLINE;
packet->htype = HTYPE_ETHER ;
packet->hlen = ETHER_ADDR_LEN;
packet->hops = 0;
- packet->xid = client->xid;
+ packet->xid = ifi->xid;
packet->secs = 0; /* Filled in by send_request. */
packet->flags = 0;
rtm.rtm_msglen = sizeof(rtm);
rtm.rtm_tableid = ifi->rdomain;
rtm.rtm_index = ifi->index;
- rtm.rtm_seq = ifi->client->xid = arc4random();
+ rtm.rtm_seq = ifi->xid = arc4random();
rtm.rtm_priority = RTP_PROPOSAL_DHCLIENT;
rtm.rtm_addrs = 0;
rtm.rtm_flags = RTF_UP | RTF_PROTO3;