-/* $OpenBSD: dhclient.c,v 1.435 2017/06/18 16:37:19 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.436 2017/06/18 17:01:46 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
if (ifi->linkstat) {
ifi->state = S_REBOOTING;
- set_timeout_interval(1, state_reboot, ifi);
+ set_timeout(1, state_reboot, ifi);
} else {
if (interval > config->link_timeout)
go_daemon();
ifi->state = S_PREBOOT;
- set_timeout_interval(1, state_preboot, ifi);
+ set_timeout(1, state_preboot, ifi);
}
}
ifi->state = S_BOUND;
/* Set timeout to start the renewal process. */
- set_timeout(ifi->active->renewal, state_bound, ifi);
+ set_timeout(ifi->active->renewal - cur_time, state_bound, ifi);
}
/*
log_warnx("dhclient cannot be used on %s", ifi->name);
quit = INTERNALSIG;
} else
- set_timeout_interval(ifi->interval, send_discover, ifi);
+ set_timeout(ifi->interval, send_discover, ifi);
}
/*
*/
log_info("No working leases in persistent database - sleeping.");
ifi->state = S_INIT;
- set_timeout_interval(config->retry_interval, state_init, ifi);
+ set_timeout(config->retry_interval, state_init, ifi);
go_daemon();
}
send_packet(ifi, from, destination.sin_addr);
- set_timeout_interval(ifi->interval, send_request, ifi);
+ set_timeout(ifi->interval, send_request, ifi);
}
void
-/* $OpenBSD: dhcpd.h,v 1.187 2017/06/18 11:21:39 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.188 2017/06/18 17:01:46 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
void dispatch(struct interface_info *);
void set_timeout(time_t, void (*)(struct interface_info *),
struct interface_info *);
-void set_timeout_interval(time_t, void (*)(struct interface_info *),
- struct interface_info *);
void cancel_timeout(void);
void interface_link_forceup(char *);
int interface_status(struct interface_info *);
-/* $OpenBSD: dispatch.c,v 1.122 2017/06/14 20:27:08 krw Exp $ */
+/* $OpenBSD: dispatch.c,v 1.123 2017/06/18 17:01:46 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
}
void
-set_timeout(time_t when, void (*where)(struct interface_info *),
- struct interface_info *ifi)
-{
- timeout.when = when;
- timeout.func = where;
- timeout.ifi = ifi;
-}
-
-void
-set_timeout_interval(time_t secs, void (*where)(struct interface_info *),
+set_timeout(time_t secs, void (*where)(struct interface_info *),
struct interface_info *ifi)
{
timeout.when = time(NULL) + secs;