Please muscle memory when dhclient $if is run and request a new lease.
authorflorian <florian@openbsd.org>
Tue, 27 Jul 2021 18:17:37 +0000 (18:17 +0000)
committerflorian <florian@openbsd.org>
Tue, 27 Jul 2021 18:17:37 +0000 (18:17 +0000)
An upcoming diff for dhclient(8) will make it exit when it discovers
an autoconf flag at startup.
"Quite a pleasing diff." deraadt@

sbin/dhcpleased/frontend.c

index 9246960..bf33e6e 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: frontend.c,v 1.14 2021/07/26 09:26:36 florian Exp $   */
+/*     $OpenBSD: frontend.c,v 1.15 2021/07/27 18:17:37 florian Exp $   */
 
 /*
  * Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
@@ -761,6 +761,16 @@ handle_route_message(struct rt_msghdr *rtm, struct sockaddr **rti_info)
                        log_debug("RTP_PROPOSAL_SOLICIT");
                        frontend_imsg_compose_engine(IMSG_REPROPOSE_RDNS,
                            0, 0, NULL, 0);
+               } else if (rtm->rtm_flags & RTF_PROTO3) {
+                       uint32_t         if_index;
+                       char             ifnamebuf[IF_NAMESIZE], *if_name;
+
+                       if_index = rtm->rtm_index;
+                       if_name = if_indextoname(if_index, ifnamebuf);
+                       log_warnx("\"dhclient %s\" ran, requesting new lease",
+                           if_name != NULL ? if_name : "(unknown)");
+                       frontend_imsg_compose_engine(IMSG_CTL_SEND_REQUEST,
+                           0, 0, &if_index, sizeof(if_index));
                }
                break;
        default: