From ca0a3b146c65d803a350dbc118a64a32da66e812 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Fri, 19 Jul 2019 20:50:23 +0000 Subject: Nuke a bunch of 'name' parameters that haven't been used since dhclient(8) stopped writing interface names in the leases file. --- sbin/dhclient/clparse.c | 17 ++++++++--------- sbin/dhclient/dhclient.c | 31 +++++++++++++++---------------- sbin/dhclient/dhcpd.h | 4 ++-- 3 files changed, 25 insertions(+), 27 deletions(-) (limited to 'sbin') diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c index af3d3ccb413..e5c2d6589e7 100644 --- a/sbin/dhclient/clparse.c +++ b/sbin/dhclient/clparse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clparse.c,v 1.186 2019/06/29 16:39:57 krw Exp $ */ +/* $OpenBSD: clparse.c,v 1.187 2019/07/19 20:50:22 krw Exp $ */ /* Parser for dhclient config and lease files. */ @@ -72,8 +72,8 @@ int parse_hex_octets(FILE *, unsigned int *, uint8_t **); int parse_domain_list(FILE *, int *, char **); int parse_option_list(FILE *, int *, uint8_t *); int parse_interface(FILE *, char *); -int parse_lease(FILE *, char *, struct client_lease **); -void parse_lease_decl(FILE *, struct client_lease *, char *); +int parse_lease(FILE *, struct client_lease **); +void parse_lease_decl(FILE *, struct client_lease *); int parse_option(FILE *, int *, struct option_data *); int parse_reject_statement(FILE *); @@ -183,7 +183,7 @@ read_conf(char *name, char *ignore_list, struct ether_addr *hwaddr) * | leases lease */ void -read_lease_db(char *name, struct client_lease_tq *lease_db) +read_lease_db(struct client_lease_tq *lease_db) { struct client_lease *lease, *lp, *nlp; FILE *cfile; @@ -198,7 +198,7 @@ read_lease_db(char *name, struct client_lease_tq *lease_db) i = DHO_DHCP_CLIENT_IDENTIFIER; while (feof(cfile) == 0) { - if (parse_lease(cfile, name, &lease) == 0) + if (parse_lease(cfile, &lease) == 0) continue; /* @@ -629,8 +629,7 @@ parse_interface(FILE *cfile, char *name) * | lease-decls lease-decl */ int -parse_lease(FILE *cfile, char *name, - struct client_lease **lp) +parse_lease(FILE *cfile, struct client_lease **lp) { struct client_lease *lease; int token; @@ -669,7 +668,7 @@ parse_lease(FILE *cfile, char *name, *lp = lease; return 1; } - parse_lease_decl(cfile, lease, name); + parse_lease_decl(cfile, lease); } return 0; @@ -691,7 +690,7 @@ parse_lease(FILE *cfile, char *name, * | SSID string SEMI */ void -parse_lease_decl(FILE *cfile, struct client_lease *lease, char *name) +parse_lease_decl(FILE *cfile, struct client_lease *lease) { char *val; unsigned int len; diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 2d02f3bc706..285bdefa030 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.645 2019/07/19 14:49:43 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.646 2019/07/19 20:50:22 krw Exp $ */ /* * Copyright 2004 Henning Brauer @@ -150,9 +150,9 @@ void make_release(struct interface_info *, struct client_lease *); void release_lease(struct interface_info *); void propose_release(struct interface_info *); -void write_lease_db(char *, struct client_lease_tq *); -void write_option_db(char *, struct client_lease *, struct client_lease *); -char *lease_as_string(char *, char *, struct client_lease *); +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 *); void append_statement(char *, size_t, char *, char *); time_t lease_expiry(struct client_lease *); @@ -590,11 +590,11 @@ main(int argc, char *argv[]) fatal("setsockopt(ROUTE_TABLEFILTER)"); fd = take_charge(ifi, routefd, path_lease_db); - read_lease_db(ifi->name, &ifi->lease_db); + read_lease_db(&ifi->lease_db); if ((leaseFile = fopen(path_lease_db, "w")) == NULL) fatal("fopen(%s)", path_lease_db); - write_lease_db(ifi->name, &ifi->lease_db); + write_lease_db(&ifi->lease_db); if (path_option_db != NULL) { /* @@ -992,8 +992,8 @@ newlease: * the bind process is complete and all related information is in * place when dhclient(8) goes daemon. */ - write_lease_db(ifi->name, &ifi->lease_db); - write_option_db(ifi->name, ifi->active, lease); + write_lease_db(&ifi->lease_db); + write_option_db(ifi->active, lease); write_resolv_conf(); free_client_lease(lease); @@ -1779,7 +1779,7 @@ free_client_lease(struct client_lease *lease) } void -write_lease_db(char *name, struct client_lease_tq *lease_db) +write_lease_db(struct client_lease_tq *lease_db) { struct client_lease *lp; char *leasestr; @@ -1799,7 +1799,7 @@ write_lease_db(char *name, struct client_lease_tq *lease_db) TAILQ_FOREACH_REVERSE(lp, lease_db, client_lease_tq, next) { if (lease_expiry(lp) < cur_time) continue; - leasestr = lease_as_string(name, "lease", lp); + leasestr = lease_as_string("lease", lp); if (leasestr != NULL) fprintf(leaseFile, "%s", leasestr); else @@ -1813,8 +1813,7 @@ write_lease_db(char *name, struct client_lease_tq *lease_db) } void -write_option_db(char *name, struct client_lease *offered, - struct client_lease *effective) +write_option_db(struct client_lease *offered, struct client_lease *effective) { char *leasestr; @@ -1826,14 +1825,14 @@ write_option_db(char *name, struct client_lease *offered, return; } - leasestr = lease_as_string(name, "offered", offered); + 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(name, "effective", effective); + leasestr = lease_as_string("effective", effective); if (leasestr == NULL) log_warnx("%s: cannot make effective lease into string", log_procname); @@ -1948,7 +1947,7 @@ lease_as_proposal(struct client_lease *lease) } char * -lease_as_string(char *ifname, char *type, struct client_lease *lease) +lease_as_string(char *type, struct client_lease *lease) { static char string[8192]; char timebuf[27]; /* 6 2017/04/08 05:47:50 UTC; */ @@ -2675,7 +2674,7 @@ release_lease(struct interface_info *ifi) imsg_flush(unpriv_ibuf); TAILQ_REMOVE(&ifi->lease_db, ifi->active, next); - write_lease_db(ifi->name, &ifi->lease_db); + write_lease_db(&ifi->lease_db); if (optionDB != NULL) { ftruncate(fileno(optionDB), 0); diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 0505a39611e..8a5d55c74b3 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.278 2019/05/22 12:56:31 krw Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.279 2019/07/19 20:50:22 krw Exp $ */ /* * Copyright (c) 2004 Henning Brauer @@ -238,7 +238,7 @@ uint32_t wrapsum(uint32_t); /* clparse.c */ void init_config(void); void read_conf(char *, char *, struct ether_addr *); -void read_lease_db(char *, struct client_lease_tq *); +void read_lease_db(struct client_lease_tq *); /* kroute.c */ unsigned int extract_classless_route(uint8_t *, unsigned int, -- cgit v1.2.3