-/* $OpenBSD: dhclient.c,v 1.440 2017/06/21 12:37:24 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.441 2017/06/21 15:24:34 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
if (ifi->linkstat) {
ifi->state = S_REBOOTING;
- set_timeout(1, state_reboot, ifi);
+ set_timeout(ifi, 1, state_reboot);
} else {
if (interval > config->link_timeout)
go_daemon();
ifi->state = S_PREBOOT;
- set_timeout(1, state_preboot, ifi);
+ set_timeout(ifi, 1, state_preboot);
}
}
make_request(ifi, ifi->active);
ifi->destination.s_addr = INADDR_BROADCAST;
- ifi->first_sending = time(NULL);
+ time(&ifi->first_sending);
ifi->interval = 0;
send_request(ifi);
ifi->destination.s_addr = INADDR_BROADCAST;
ifi->state = S_SELECTING;
- ifi->first_sending = time(NULL);
+ time(&ifi->first_sending);
ifi->interval = 0;
send_discover(ifi);
ifi->destination.s_addr = INADDR_BROADCAST;
ifi->state = S_REQUESTING;
- ifi->first_sending = time(NULL);
+ time(&ifi->first_sending);
ifi->interval = 0;
if (stop_selecting <= time(NULL))
state_selecting(ifi);
else
- set_timeout(stop_selecting, state_selecting, ifi);
+ set_timeout(ifi, stop_selecting, state_selecting);
}
void
ifi->state = S_BOUND;
/* Set timeout to start the renewal process. */
- set_timeout(ifi->active->renewal - cur_time, state_bound, ifi);
+ set_timeout(ifi, ifi->active->renewal - cur_time, state_bound);
}
/*
else
dest->s_addr = INADDR_BROADCAST;
- ifi->first_sending = time(NULL);
+ time(&ifi->first_sending);
ifi->interval = 0;
ifi->state = S_RENEWING;
log_warnx("dhclient cannot be used on %s", ifi->name);
quit = INTERNALSIG;
} else
- set_timeout(ifi->interval, send_discover, ifi);
+ set_timeout(ifi, ifi->interval, send_discover);
}
/*
*/
log_info("No working leases in persistent database - sleeping.");
ifi->state = S_INIT;
- set_timeout(config->retry_interval, state_init, ifi);
+ set_timeout(ifi, config->retry_interval, state_init);
go_daemon();
}
send_packet(ifi, from, destination.sin_addr);
- set_timeout(ifi->interval, send_request, ifi);
+ set_timeout(ifi, ifi->interval, send_request);
}
void
-/* $OpenBSD: dhcpd.h,v 1.189 2017/06/18 21:08:15 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.190 2017/06/21 15:24:34 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
/* dispatch.c */
void dispatch(struct interface_info *);
-void set_timeout(time_t, void (*)(struct interface_info *),
- struct interface_info *);
+void set_timeout( struct interface_info *, time_t,
+ void (*)(struct interface_info *));
void cancel_timeout(struct interface_info *);
void interface_link_forceup(char *);
int interface_status(struct interface_info *);
-/* $OpenBSD: dispatch.c,v 1.125 2017/06/19 19:28:35 krw Exp $ */
+/* $OpenBSD: dispatch.c,v 1.126 2017/06/21 15:24:34 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
}
void
-set_timeout(time_t secs, void (*where)(struct interface_info *),
- struct interface_info *ifi)
+set_timeout(struct interface_info *ifi, time_t secs,
+ void (*where)(struct interface_info *))
{
- ifi->timeout = time(NULL) + secs;
+ time(&ifi->timeout);
+ ifi->timeout += secs;
ifi->timeout_func = where;
}