summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2020-11-06 21:53:55 +0000
committerkrw <krw@openbsd.org>2020-11-06 21:53:55 +0000
commitf1758526e218b8f9ae2e1b94485e804042a5ca89 (patch)
tree268a76978ab0498ed59a5c3ebb69cc66644b208d
parentExplain vcpu strides, provide example (diff)
downloadwireguard-openbsd-f1758526e218b8f9ae2e1b94485e804042a5ca89.tar.xz
wireguard-openbsd-f1758526e218b8f9ae2e1b94485e804042a5ca89.zip
Remove the -L option. A debugging tool that is no longer required.
man page and usage() tweaks from jmc@. ok lteo@
-rw-r--r--sbin/dhclient/dhclient.823
-rw-r--r--sbin/dhclient/dhclient.c79
-rw-r--r--sbin/dhclient/dhcpd.h3
3 files changed, 6 insertions, 99 deletions
diff --git a/sbin/dhclient/dhclient.8 b/sbin/dhclient/dhclient.8
index a0e5c5b274f..875a6e7dcce 100644
--- a/sbin/dhclient/dhclient.8
+++ b/sbin/dhclient/dhclient.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: dhclient.8,v 1.43 2020/11/06 21:15:41 krw Exp $
+.\" $OpenBSD: dhclient.8,v 1.44 2020/11/06 21:53:55 krw Exp $
.\"
.\" Copyright (c) 1997 The Internet Software Consortium.
.\" All rights reserved.
@@ -46,7 +46,6 @@
.Op Fl dnrv
.Op Fl c Ar file
.Op Fl i Ar options
-.Op Fl L Ar file
.Ar interface
.Sh DESCRIPTION
.Nm
@@ -96,21 +95,6 @@ This list will override any ignore statements in
.Ar options
must be a comma separated list of valid option names.
Invalid option names will cause the entire list to be discarded.
-.It Fl L Ar file
-Specify a
-.Ar file
-to write the option data to.
-This causes
-.Nm
-to write two pseudo-leases,
-.Dq offered
-and
-.Dq effective ,
-to the specified file.
-.Dq offered
-will be the lease offered by the DHCP server;
-.Dq effective
-will be the modified lease bound to the interface.
.It Fl n
Configtest mode.
Only check the configuration file for validity.
@@ -120,10 +104,7 @@ Release the current lease back to the server it came from.
exits after removing the active lease from
.Pa /var/db/dhclient.leases . Ns Aq Ar IFNAME ,
deleting the address the lease caused to be added to the interface,
-truncating any option file specified by
-.Fl L
-and sending a DHCPRELEASE packet to
-the server that supplied the lease.
+and sending a DHCPRELEASE packet to the server that supplied the lease.
.Pp
If there is no
.Nm
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 9cea1cca23d..165db3f6438 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.678 2020/07/31 12:12:11 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.679 2020/11/06 21:53:55 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -97,7 +97,6 @@
char *path_dhclient_conf = _PATH_DHCLIENT_CONF;
char *path_lease_db;
-char *path_option_db;
char *log_procname;
int nullfd = -1;
@@ -151,7 +150,6 @@ void release_lease(struct interface_info *);
void propose_release(struct interface_info *);
void write_lease_db(struct client_lease_tq *);
-void write_option_db(struct client_lease *, struct client_lease *);
char *lease_as_string(char *, struct client_lease *);
struct proposal *lease_as_proposal(struct client_lease *);
struct unwind_info *lease_as_unwind_info(struct client_lease *);
@@ -172,7 +170,6 @@ struct client_lease *get_recorded_lease(struct interface_info *);
#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
static FILE *leaseFile;
-static FILE *optionDB;
int
get_ifa_family(char *cp, int n)
@@ -471,7 +468,7 @@ main(int argc, char *argv[])
log_setverbose(0); /* Don't show log_debug() messages. */
- while ((ch = getopt(argc, argv, "c:di:L:nrv")) != -1)
+ while ((ch = getopt(argc, argv, "c:di:nrv")) != -1)
switch (ch) {
case 'c':
if (optarg == NULL)
@@ -488,12 +485,6 @@ main(int argc, char *argv[])
cmd_opts |= OPT_IGNORELIST;
ignore_list = strdup(optarg);
break;
- case 'L':
- if (optarg == NULL)
- usage();
- cmd_opts |= OPT_DBPATH;
- path_option_db = optarg;
- break;
case 'n':
cmd_opts |= OPT_NOACTION;
break;
@@ -513,18 +504,6 @@ main(int argc, char *argv[])
if (argc != 1)
usage();
- if ((cmd_opts & OPT_DBPATH) != 0) {
- if (lstat(path_option_db, &sb) == -1) {
- /*
- * Non-existant file is OK. An attempt will be
- * made to create it.
- */
- if (errno != ENOENT)
- fatal("lstat(%s)", path_option_db);
- } else if (S_ISREG(sb.st_mode) == 0)
- fatalx("'%s' is not a regular file",
- path_option_db);
- }
if ((cmd_opts & OPT_CONFPATH) != 0) {
if (lstat(path_dhclient_conf, &sb) == -1) {
/*
@@ -656,17 +635,6 @@ main(int argc, char *argv[])
log_warn("%s: fopen(%s)", log_procname, path_lease_db);
write_lease_db(&ifi->lease_db);
- if (path_option_db != NULL) {
- /*
- * Open 'a' so file is not truncated. The truncation
- * is done when new data is about to be written to the
- * file. This avoids false notifications to watchers that
- * network configuration changes have occurred.
- */
- if ((optionDB = fopen(path_option_db, "a")) == NULL)
- fatal("fopen(%s)", path_option_db);
- }
-
/* Create the udp and bpf sockets, growing rbuf if needed. */
ifi->udpfd = get_udp_sock(ifi->rdomain);
ifi->bpffd = get_bpf_sock(ifi->name);
@@ -712,7 +680,7 @@ usage(void)
extern char *__progname;
fprintf(stderr,
- "usage: %s [-dnrv] [-c file] [-i options] [-L file] "
+ "usage: %s [-dnrv] [-c file] [-i options] "
"interface\n", __progname);
exit(1);
}
@@ -1086,7 +1054,6 @@ newlease:
* place when dhclient(8) goes daemon.
*/
write_lease_db(&ifi->lease_db);
- write_option_db(ifi->active, lease);
write_resolv_conf();
free_client_lease(lease);
@@ -1903,39 +1870,6 @@ write_lease_db(struct client_lease_tq *lease_db)
}
void
-write_option_db(struct client_lease *offered, struct client_lease *effective)
-{
- char *leasestr;
-
- if (optionDB == NULL)
- return;
-
- if (ftruncate(fileno(optionDB), 0) == -1) {
- log_warn("optionDB ftruncate()");
- return;
- }
-
- leasestr = lease_as_string("offered", offered);
- if (leasestr == NULL)
- log_warnx("%s: cannot make offered lease into string",
- log_procname);
- else if (fprintf(optionDB, "%s", leasestr) == -1)
- log_warn("optionDB 'offered' fprintf()");
-
- leasestr = lease_as_string("effective", effective);
- if (leasestr == NULL)
- log_warnx("%s: cannot make effective lease into string",
- log_procname);
- else if (fprintf(optionDB, "%s", leasestr) == -1)
- log_warn("optionDB 'effective' fprintf()");
-
- if (fflush(optionDB) == EOF)
- log_warn("optionDB fflush()");
- else if (fsync(fileno(optionDB)) == -1)
- log_warn("optionDB fsync()");
-}
-
-void
append_statement(char *string, size_t sz, char *s1, char *s2)
{
strlcat(string, s1, sz);
@@ -2758,7 +2692,6 @@ tick_msg(const char *preamble, int success, time_t start)
* 1) Send DHCPRELEASE.
* 2) Unconfigure address/routes/etc.
* 3) Remove lease from database & write updated DB.
- * 4) Truncate optionDB if present.
*/
void
release_lease(struct interface_info *ifi)
@@ -2788,12 +2721,6 @@ release_lease(struct interface_info *ifi)
TAILQ_REMOVE(&ifi->lease_db, ifi->active, next);
write_lease_db(&ifi->lease_db);
- if (optionDB != NULL) {
- ftruncate(fileno(optionDB), 0);
- fclose(optionDB);
- optionDB = NULL;
- }
-
free_client_lease(ifi->active);
ifi->active = NULL;
free(ifi->configured);
diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h
index 7fa9775c46b..3d6fe046bc0 100644
--- a/sbin/dhclient/dhcpd.h
+++ b/sbin/dhclient/dhcpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpd.h,v 1.287 2020/05/21 01:07:52 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.288 2020/11/06 21:53:55 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
@@ -216,7 +216,6 @@ extern int cmd_opts;
#define OPT_FOREGROUND 0x04
#define OPT_RELEASE 0x08
#define OPT_CONFPATH 0x10
-#define OPT_DBPATH 0x20
#define OPT_IGNORELIST 0x40
void dhcpoffer(struct interface_info *, struct option_data *,