-/* $OpenBSD: dhclient.c,v 1.714 2021/03/28 16:23:05 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.715 2021/03/28 17:25:21 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
make_request(ifi, ifi->active);
ifi->destination.s_addr = INADDR_BROADCAST;
- clock_gettime(CLOCK_REALTIME, &ifi->first_sending);
+ clock_gettime(CLOCK_MONOTONIC, &ifi->first_sending);
timespecadd(&ifi->first_sending, &reboot_intvl, &ifi->reboot_timeout);
ifi->interval = 0;
ifi->destination.s_addr = INADDR_BROADCAST;
ifi->state = S_SELECTING;
- clock_gettime(CLOCK_REALTIME, &ifi->first_sending);
+ clock_gettime(CLOCK_MONOTONIC, &ifi->first_sending);
timespecadd(&ifi->first_sending, &offer_intvl, &ifi->offer_timeout);
ifi->select_timeout = ifi->offer_timeout;
ifi->interval = 0;
}
ifi->destination.s_addr = INADDR_BROADCAST;
- clock_gettime(CLOCK_REALTIME, &ifi->first_sending);
+ clock_gettime(CLOCK_MONOTONIC, &ifi->first_sending);
ifi->interval = 0;
/*
struct timespec now;
struct client_lease *lease;
- clock_gettime(CLOCK_REALTIME, &now);
+ clock_gettime(CLOCK_MONOTONIC, &now);
lease = packet_to_lease(ifi, options);
if (lease != NULL) {
int rslt, seen;
tick_msg("lease", TICK_SUCCESS);
- clock_gettime(CLOCK_REALTIME, &now);
+ clock_gettime(CLOCK_MONOTONIC, &now);
lease = apply_defaults(ifi->offer);
get_lease_timeouts(ifi, lease);
else
dest->s_addr = INADDR_BROADCAST;
- clock_gettime(CLOCK_REALTIME, &ifi->first_sending);
+ clock_gettime(CLOCK_MONOTONIC, &ifi->first_sending);
ifi->interval = 0;
ifi->state = S_RENEWING;
struct timespec now;
ssize_t rslt;
- clock_gettime(CLOCK_REALTIME, &now);
+ clock_gettime(CLOCK_MONOTONIC, &now);
if (timespeccmp(&now, &ifi->offer_timeout, >=)) {
state_panic(ifi);
return;
ssize_t rslt;
cancel_timeout(ifi);
- clock_gettime(CLOCK_REALTIME, &now);
+ clock_gettime(CLOCK_MONOTONIC, &now);
switch (ifi->state) {
case S_REBOOTING:
struct rt_msghdr rtm;
int fd, nfds;
- clock_gettime(CLOCK_REALTIME, &now);
+ clock_gettime(CLOCK_MONOTONIC, &now);
resend = now;
timespecadd(&now, &max_timeout, &stop);
rtm.rtm_flags = RTF_UP | RTF_PROTO3;
for (fd = -1; fd == -1 && quit != TERMINATE;) {
- clock_gettime(CLOCK_REALTIME, &now);
+ clock_gettime(CLOCK_MONOTONIC, &now);
if (timespeccmp(&now, &stop, >=))
fatalx("failed to take charge");
{
struct timespec now, interval;
- clock_gettime(CLOCK_REALTIME, &now);
+ clock_gettime(CLOCK_MONOTONIC, &now);
timespecclear(&interval);
interval.tv_sec = lease_expiry(lease);
static int linkup, preamble_sent, sleeping;
int printmsg;
- clock_gettime(CLOCK_REALTIME, &now);
+ clock_gettime(CLOCK_MONOTONIC, &now);
if (!timespecisset(&stop)) {
preamble_sent = 0;
struct rt_msghdr rtm;
int nfds, routefd, rtfilter;
- clock_gettime(CLOCK_REALTIME, &now);
+ clock_gettime(CLOCK_MONOTONIC, &now);
timespecadd(&now, &max_timeout, &stop);
if ((routefd = socket(AF_ROUTE, SOCK_RAW, AF_INET)) == -1)
log_debug("%s: sent RTM_PROPOSAL to release lease", log_procname);
while (quit == 0) {
- clock_gettime(CLOCK_REALTIME, &now);
+ clock_gettime(CLOCK_MONOTONIC, &now);
if (timespeccmp(&now, &stop, >=))
break;
timespecsub(&stop, &now, &timeout);
-/* $OpenBSD: dispatch.c,v 1.171 2021/03/09 14:32:24 krw Exp $ */
+/* $OpenBSD: dispatch.c,v 1.172 2021/03/28 17:25:21 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
while (quit == 0 || quit == RESTART) {
if (quit == RESTART) {
quit = 0;
- clock_gettime(CLOCK_REALTIME, &ifi->link_timeout);
+ clock_gettime(CLOCK_MONOTONIC, &ifi->link_timeout);
timespecadd(&ifi->link_timeout, &link_intvl, &ifi->link_timeout);
free(ifi->configured);
ifi->configured = NULL;
state_preboot(ifi);
}
if (timespecisset(&ifi->timeout)) {
- clock_gettime(CLOCK_REALTIME, &timeout);
+ clock_gettime(CLOCK_MONOTONIC, &timeout);
if (timespeccmp(&timeout, &ifi->timeout, >=)) {
func = ifi->timeout_func;
cancel_timeout(ifi);
{
struct timespec now;
- clock_gettime(CLOCK_REALTIME, &now);
+ clock_gettime(CLOCK_MONOTONIC, &now);
timespecclear(&ifi->timeout);
ifi->timeout.tv_sec = secs;
timespecadd(&ifi->timeout, &now, &ifi->timeout);