Index | Thread | Search

From:
Michał Markowski <markowski1@gmail.com>
Subject:
Re: dhcpd(8) sync verbosity
To:
Stuart Henderson <stu@spacehopper.org>, tech-openbsd <tech@openbsd.org>
Date:
Wed, 5 Jun 2024 11:25:38 +0200

Download raw body.

Thread
On 4 Jun 2024, at 14:41, Stuart Henderson <stu@spacehopper.org> wrote:
> This takes some lines above 80 columns (against KNF). But also means
> that these log messages are unusable without recompile. When getting
> things setup for sync in the first place I think they are useful so,
> if changing anything, I think I'd just change this from log_info to
> log_debug without the extra conditional.

Good point, this way you can still check sync status using “dhcpd -dv” during initial setup.

diff --git a/usr.sbin/dhcpd/sync.c b/usr.sbin/dhcpd/sync.c
index 1f701f60d46..19e9d2c1145 100644
--- a/usr.sbin/dhcpd/sync.c
+++ b/usr.sbin/dhcpd/sync.c
@@ -307,7 +307,7 @@ sync_recv(void)
 			    sizeof(lp->ip_addr));
 			memcpy(&lp->hardware_addr, &lv->lv_hardware_addr,
 			    sizeof(lp->hardware_addr));
-			log_info("DHCP_SYNC_LEASE from %s for hw %s -> ip %s, "
+			log_debug("DHCP_SYNC_LEASE from %s for hw %s -> ip %s, "
 			    "start %lld, end %lld",
 			    inet_ntoa(addr.sin_addr),
 			    print_hw_addr(lp->hardware_addr.htype,
@@ -431,7 +431,7 @@ sync_lease(struct lease *lease)
 	memcpy(&lv.lv_ip_addr, &lease->ip_addr, sizeof(lv.lv_ip_addr));
 	memcpy(&lv.lv_hardware_addr, &lease->hardware_addr,
 	    sizeof(lv.lv_hardware_addr));
-	log_info("sending DHCP_SYNC_LEASE for hw %s -> ip %s, start %d, "
+	log_debug("sending DHCP_SYNC_LEASE for hw %s -> ip %s, start %d, "
 	    "end %d", print_hw_addr(lv.lv_hardware_addr.htype,
 	    lv.lv_hardware_addr.hlen, lv.lv_hardware_addr.haddr),
 	    piaddr(lease->ip_addr), ntohl(lv.lv_starts), ntohl(lv.lv_ends));