summaryrefslogtreecommitdiff
path: root/sbin/dhclient/dhclient.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2022-07-02 17:21:33 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2022-07-02 17:21:33 +0000
commit480c02b10f199773dd3768bdcdcfcb2d520fb6a4 (patch)
tree3ed1f3b0bac59a5b442df45c90a0bb43d260cd34 /sbin/dhclient/dhclient.c
parent02709b49c5ef83cccb21804d1e438050ea3a17b7 (diff)
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
Diffstat (limited to 'sbin/dhclient/dhclient.c')
-rw-r--r--sbin/dhclient/dhclient.c14
1 files 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 <henning@openbsd.org>
@@ -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;