From 37ecb4d066e5566411cc16b362d3960c93b1d0be Mon Sep 17 00:00:00 2001 From: krw Date: Sun, 28 Feb 2021 17:49:01 +0000 Subject: [PATCH] Move tick_msg(TICK_WAIT) calls after related log_debug() calls to avoid losing those debug messages if tick_msg() notices link-timeout has expired and daemonizes dhclient. --- sbin/dhclient/dhclient.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 34791632860..6ad8cd01515 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.706 2021/02/28 17:33:45 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.707 2021/02/28 17:49:01 krw Exp $ */ /* * Copyright 2004 Henning Brauer @@ -256,10 +256,10 @@ interface_state(struct interface_info *ifi) newlinkup = LINK_STATE_IS_UP(ifi->link_state); if (newlinkup != oldlinkup) { - tick_msg("link", newlinkup ? TICK_SUCCESS : TICK_WAIT); log_debug("%s: link %s -> %s", log_procname, (oldlinkup != 0) ? "up" : "down", (newlinkup != 0) ? "up" : "down"); + tick_msg("link", newlinkup ? TICK_SUCCESS : TICK_WAIT); } if (newlinkup != 0) { @@ -1433,8 +1433,6 @@ send_discover(struct interface_info *ifi) return; } - tick_msg("lease", TICK_WAIT); - set_interval(ifi, cur_time); set_secs(ifi, cur_time); @@ -1443,6 +1441,7 @@ send_discover(struct interface_info *ifi) log_debug("%s: DHCPDISCOVER - interval %lld", log_procname, (long long)ifi->interval); + tick_msg("lease", TICK_WAIT); set_timeout(ifi, ifi->interval, send_discover); } @@ -1489,7 +1488,6 @@ send_request(struct interface_info *ifi) cancel_timeout(ifi); clock_gettime(CLOCK_REALTIME, &now); cur_time = now.tv_sec; - tick_msg("lease", TICK_WAIT); /* Figure out how long it's been since we started transmitting. */ interval = cur_time - ifi->first_sending; @@ -1547,6 +1545,7 @@ send_request(struct interface_info *ifi) log_debug("%s: DHCPREQUEST to %s", log_procname, inet_ntoa(destination.sin_addr)); + tick_msg("lease", TICK_WAIT); set_timeout(ifi, ifi->interval, send_request); } -- 2.20.1