From 5b655627c0d522cb6b7317de9ddcdf2015a93625 Mon Sep 17 00:00:00 2001 From: krw Date: Sun, 21 Feb 2021 18:16:59 +0000 Subject: [PATCH] Rename struct client_config fields 'timeout', 'link_timeout' and 'reboot_timeout' to 'offer_interval', 'link_interval' and 'reboot_interval' to be consistant with other '_interval' fields that specify a number of seconds to wait. --- sbin/dhclient/clparse.c | 19 ++++++++++--------- sbin/dhclient/dhclient.c | 18 +++++++++--------- sbin/dhclient/dhcpd.h | 8 ++++---- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c index bb48cbb5850..11442e0e6ec 100644 --- a/sbin/dhclient/clparse.c +++ b/sbin/dhclient/clparse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clparse.c,v 1.201 2020/12/10 18:35:31 krw Exp $ */ +/* $OpenBSD: clparse.c,v 1.202 2021/02/21 18:16:59 krw Exp $ */ /* Parser for dhclient config and lease files. */ @@ -94,17 +94,17 @@ init_config(void) TAILQ_INIT(&config->reject_list); /* Set some defaults. */ - config->link_timeout = 10; /* secs before going daemon w/o lease */ + config->link_interval = 10; /* secs before going daemon w/o lease */ config->select_interval = 0; /* secs to wait for other OFFERs */ config->retry_interval = 1; /* secs before asking for OFFER */ #ifdef SMALL config->backoff_cutoff = 2; /* max secs between packet retries */ - config->reboot_timeout = 5; /* secs before giving up on reboot */ - config->timeout = 10; /* secs to wait for an OFFER */ + config->reboot_interval = 5; /* secs before giving up on reboot */ + config->offer_interval = 10; /* secs to wait for an OFFER */ #else config->backoff_cutoff = 10; /* max secs between packet retries */ - config->reboot_timeout = 1; /* secs before giving up on reboot */ - config->timeout = 30; /* secs to wait for an OFFER */ + config->reboot_interval = 1; /* secs before giving up on reboot */ + config->offer_interval = 30; /* secs to wait for an OFFER */ #endif config->initial_interval = 1; /* secs before 1st retry */ @@ -327,7 +327,7 @@ parse_conf_decl(FILE *cfile, char *name) parse_interface(cfile, name); return; case TOK_LINK_TIMEOUT: - if (parse_number(cfile, &config->link_timeout, 0, INT32_MAX) + if (parse_number(cfile, &config->link_interval, 0, INT32_MAX) == 0) return; break; @@ -344,7 +344,7 @@ parse_conf_decl(FILE *cfile, char *name) config->default_actions[i] = action; break; case TOK_REBOOT: - if (parse_number(cfile, &config->reboot_timeout, 0, INT32_MAX) + if (parse_number(cfile, &config->reboot_interval, 0, INT32_MAX) == 0) return; break; @@ -388,7 +388,8 @@ parse_conf_decl(FILE *cfile, char *name) config->default_actions[i] = ACTION_SUPERSEDE; break; case TOK_TIMEOUT: - if (parse_number(cfile, &config->timeout, 0, INT32_MAX) == 0) + if (parse_number(cfile, &config->offer_interval, 0, INT32_MAX) + == 0) return; break; case TOK_USELEASE: diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 78d4dd47d75..e621494ed81 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.696 2021/02/21 14:30:29 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.697 2021/02/21 18:16:59 krw Exp $ */ /* * Copyright 2004 Henning Brauer @@ -1416,7 +1416,7 @@ set_interval(struct interface_info *ifi, time_t cur_time) if (interval == 0) { if (ifi->state == S_REBOOTING) - interval = config->reboot_timeout; + interval = config->reboot_interval; else interval = config->initial_interval; } else { @@ -1432,14 +1432,14 @@ set_interval(struct interface_info *ifi, time_t cur_time) interval = ifi->expiry - cur_time; break; case S_REQUESTING: - if (cur_time + interval > ifi->first_sending + config->timeout) - interval = (ifi->first_sending + config->timeout) - cur_time; + if (cur_time + interval > ifi->first_sending + config->offer_interval) + interval = (ifi->first_sending + config->offer_interval) - cur_time; break; default: break; } - if (cur_time < ifi->startup_time + config->link_timeout) + if (cur_time < ifi->startup_time + config->link_interval) interval = 1; ifi->interval = interval ? interval : 1; @@ -1477,7 +1477,7 @@ send_discover(struct interface_info *ifi) if (log_getverbose()) tick_msg("lease", TICK_WAIT); - if (cur_time > ifi->first_sending + config->timeout) { + if (cur_time > ifi->first_sending + config->offer_interval) { state_panic(ifi); return; } @@ -1542,7 +1542,7 @@ send_request(struct interface_info *ifi) switch (ifi->state) { case S_REBOOTING: - if (interval > config->reboot_timeout) + if (interval > config->reboot_interval) ifi->state = S_INIT; else { destination.sin_addr.s_addr = INADDR_BROADCAST; @@ -1567,7 +1567,7 @@ send_request(struct interface_info *ifi) } break; case S_REQUESTING: - if (interval > config->timeout) + if (interval > config->offer_interval) ifi->state = S_INIT; else { destination.sin_addr.s_addr = INADDR_BROADCAST; @@ -2690,7 +2690,7 @@ void tick_msg(const char *preamble, int action) { const struct timespec grace_intvl = {3, 0}; - const struct timespec link_intvl = {config->link_timeout, 0}; + const struct timespec link_intvl = {config->link_interval, 0}; static struct timespec grace, stop; struct timespec now; static int preamble_sent, sleeping; diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 023af04e3b6..9660de954af 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.291 2021/02/01 01:42:20 krw Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.292 2021/02/21 18:16:59 krw Exp $ */ /* * Copyright (c) 2004 Henning Brauer @@ -101,12 +101,12 @@ struct client_config { uint8_t requested_options[DHO_COUNT]; int requested_option_count; int required_option_count; - time_t timeout; + time_t offer_interval; time_t initial_interval; - time_t link_timeout; + time_t link_interval; time_t retry_interval; time_t select_interval; - time_t reboot_timeout; + time_t reboot_interval; time_t backoff_cutoff; TAILQ_HEAD(, reject_elem) reject_list; char *filename; -- 2.20.1