From 6d1f786e85c1cf2fa839ea18259e87b7591d5ce2 Mon Sep 17 00:00:00 2001 From: deraadt Date: Sat, 2 Jul 2022 17:21:32 +0000 Subject: [PATCH] dhclient(8) has been undergoing replacement with "ifconfig xxx inet auto" for a couple of years, backed by dhcpleased(8), which provides much better dns handling. The next step is to make the dhclient simply execve ifconfig in that way, and provide syslog warnings about deprecated options along the way. This way, we can find the last few dhclient users, and what they are missing. ok florian krw --- sbin/dhclient/dhclient.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index b79b5cbb1d0..97fc9b5b2fe 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.726 2021/10/24 21:24:21 deraadt Exp $ */ +/* $OpenBSD: dhclient.c,v 1.727 2022/07/02 17:21:32 deraadt Exp $ */ /* * Copyright 2004 Henning Brauer @@ -623,7 +623,9 @@ main(int argc, char *argv[]) path_dhclient_conf = _PATH_DHCLIENT_CONF; memset(actions, ACTION_USELEASE, sizeof(actions)); - while ((ch = getopt(argc, argv, "c:di:nrv")) != -1) + while ((ch = getopt(argc, argv, "c:di:nrv")) != -1) { + syslog(LOG_ALERT | LOG_CONS, + "dhclient will go away, so -%c option will not exist", ch); switch (ch) { case 'c': if (strlen(optarg) == 0) @@ -637,6 +639,8 @@ main(int argc, char *argv[]) cmd_opts |= OPT_FOREGROUND; break; case 'i': + syslog(LOG_ALERT | LOG_CONS, + "dhclient will go away, for -i learn dhcpleased.conf"); if (strlen(optarg) == 0) break; ignore_list = strdup(optarg); @@ -665,6 +669,7 @@ main(int argc, char *argv[]) default: usage(); } + } argc -= optind; argv += optind; @@ -672,6 +677,11 @@ main(int argc, char *argv[]) if (argc != 1) usage(); + syslog(LOG_ALERT | LOG_CONS, + "dhclient will go away, stop using it"); + + execl("/sbin/ifconfig", "ifconfig", argv[0], "inet", "autoconf", NULL); + if ((cmd_opts & (OPT_FOREGROUND | OPT_NOACTION)) != 0) cmd_opts |= OPT_VERBOSE; -- 2.20.1