From d455860c783f11a6306ce1b0fe396cef8937f731 Mon Sep 17 00:00:00 2001 From: Florian Obser Date: Wed, 15 Sep 2021 15:18:24 +0000 Subject: Rewrite and simplify dhcpleasectl(8). With this dhcpleasectl em0 does the same as dhclient em0 used to do. To please people's muscle memory one can be aliased to the other. earlier version OK benno with lots of help massaging the output & OK deraadt --- sbin/dhcpleased/engine.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'sbin/dhcpleased/engine.c') diff --git a/sbin/dhcpleased/engine.c b/sbin/dhcpleased/engine.c index 3e28c638d44..40574ef1aa2 100644 --- a/sbin/dhcpleased/engine.c +++ b/sbin/dhcpleased/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.26 2021/09/15 06:08:01 florian Exp $ */ +/* $OpenBSD: engine.c,v 1.27 2021/09/15 15:18:23 florian Exp $ */ /* * Copyright (c) 2017, 2021 Florian Obser @@ -591,16 +591,11 @@ engine_showinfo_ctl(struct imsg *imsg, uint32_t if_index) switch (imsg->hdr.type) { case IMSG_CTL_SHOW_INTERFACE_INFO: - if (if_index == 0) { - LIST_FOREACH (iface, &dhcpleased_interfaces, entries) - send_interface_info(iface, imsg->hdr.pid); - } else { - if ((iface = get_dhcpleased_iface_by_id(if_index)) != - NULL) - send_interface_info(iface, imsg->hdr.pid); - } - engine_imsg_compose_frontend(IMSG_CTL_END, imsg->hdr.pid, NULL, - 0); + if ((iface = get_dhcpleased_iface_by_id(if_index)) != NULL) + send_interface_info(iface, imsg->hdr.pid); + else + engine_imsg_compose_frontend(IMSG_CTL_END, + imsg->hdr.pid, NULL, 0); break; default: log_debug("%s: error handling imsg", __func__); -- cgit v1.2.3