summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2020-05-20 19:13:35 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2020-05-20 19:13:35 +0000
commitc66ee64a693e2829acc0c30003a3d9a2a5b87034 (patch)
tree46f9fc080c4da5edd492a1c0dc537a3cc4e7d042 /sbin
parent6714907a30fb4794bc84927427879031374e8a00 (diff)
Rename proposal{} fields rtstatic_len, rtsearch_len and rtdns_len to
routes_len, domains_len, ns_len. Removes obsolete alignment with names of RTM_PROPOSAL fields and makes code easier to read. No intentional functional change.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/dhclient/dhclient.c30
-rw-r--r--sbin/dhclient/kroute.c26
-rw-r--r--sbin/dhclient/privsep.h8
3 files changed, 32 insertions, 32 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index a46179a8e9f..f5f754b37fc 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.672 2020/05/20 18:27:16 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.673 2020/05/20 19:13:34 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -1981,8 +1981,8 @@ lease_as_proposal(struct client_lease *lease)
struct option_data fake;
struct option_data *opt;
struct proposal *proposal;
- uint8_t *dns, *p, *routes, *search;
- unsigned int routes_len = 0, search_len = 0, dns_len = 0;
+ uint8_t *ns, *p, *routes, *domains;
+ unsigned int routes_len = 0, domains_len = 0, ns_len = 0;
uint16_t mtu;
/* Determine sizes of variable length data. */
@@ -2011,19 +2011,19 @@ lease_as_proposal(struct client_lease *lease)
else if (lease->options[DHO_DOMAIN_NAME].len != 0)
opt = &lease->options[DHO_DOMAIN_NAME];
if (opt != NULL) {
- search_len = opt->len;
- search = opt->data;
+ domains_len = opt->len;
+ domains = opt->data;
}
if (lease->options[DHO_DOMAIN_NAME_SERVERS].len != 0) {
opt = &lease->options[DHO_DOMAIN_NAME_SERVERS];
- dns = opt->data;
- dns_len = opt->len;
+ ns_len = opt->len;
+ ns = opt->data;
}
/* Allocate proposal. */
- proposal = calloc(1, sizeof(*proposal) + routes_len + search_len +
- dns_len);
+ proposal = calloc(1, sizeof(*proposal) + routes_len + domains_len +
+ ns_len);
if (proposal == NULL)
fatal("proposal");
@@ -2044,12 +2044,12 @@ lease_as_proposal(struct client_lease *lease)
p = (uint8_t *)proposal + sizeof(struct proposal);
memcpy(p, routes, routes_len);
p += routes_len;
- proposal->rtstatic_len = routes_len;
- memcpy(p, search, search_len);
- p += search_len;
- proposal->rtsearch_len = search_len;
- memcpy(p, dns, dns_len);
- proposal->rtdns_len = dns_len;
+ proposal->routes_len = routes_len;
+ memcpy(p, domains, domains_len);
+ p += domains_len;
+ proposal->domains_len = domains_len;
+ memcpy(p, ns, ns_len);
+ proposal->ns_len = ns_len;
return proposal;
}
diff --git a/sbin/dhclient/kroute.c b/sbin/dhclient/kroute.c
index a97edfaf3cc..9a7a3edb10e 100644
--- a/sbin/dhclient/kroute.c
+++ b/sbin/dhclient/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.177 2020/05/20 18:27:16 krw Exp $ */
+/* $OpenBSD: kroute.c,v 1.178 2020/05/20 19:13:34 krw Exp $ */
/*
* Copyright 2012 Kenneth R Westerback <krw@openbsd.org>
@@ -884,8 +884,8 @@ propose(struct proposal *proposal)
int rslt;
rslt = imsg_compose(unpriv_ibuf, IMSG_PROPOSE, 0, 0, -1, proposal,
- sizeof(*proposal) + proposal->rtstatic_len +
- proposal->rtsearch_len + proposal->rtdns_len);
+ sizeof(*proposal) + proposal->routes_len +
+ proposal->domains_len + proposal->ns_len);
if (rslt == -1)
log_warn("%s: imsg_compose(IMSG_PROPOSE)", log_procname);
}
@@ -900,14 +900,14 @@ priv_propose(char *name, int ioctlfd, struct proposal *proposal,
char *search = NULL;
int rslt;
- if (sz != proposal->rtstatic_len + proposal->rtsearch_len + proposal->rtdns_len) {
+ if (sz != proposal->routes_len + proposal->domains_len + proposal->ns_len) {
log_warnx("%s: bad IMSG_PROPOSE data", log_procname);
return;
}
routes = (uint8_t *)proposal + sizeof(struct proposal);
- domains = routes + proposal->rtstatic_len;
- dns = domains + proposal->rtsearch_len;
+ domains = routes + proposal->routes_len;
+ dns = domains + proposal->domains_len;
memset(&ifr, 0, sizeof(ifr));
strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
@@ -917,21 +917,21 @@ priv_propose(char *name, int ioctlfd, struct proposal *proposal,
return;
memset(&unwind_info, 0, sizeof(unwind_info));
- if (proposal->rtdns_len >= sizeof(in_addr_t)) {
- if (proposal->rtdns_len > sizeof(unwind_info.ns)) {
+ if (proposal->ns_len >= sizeof(in_addr_t)) {
+ if (proposal->ns_len > sizeof(unwind_info.ns)) {
memcpy(unwind_info.ns, dns, sizeof(unwind_info.ns));
unwind_info.count = sizeof(unwind_info.ns) /
sizeof(in_addr_t);
} else {
- memcpy(unwind_info.ns, dns, proposal->rtdns_len);
- unwind_info.count = proposal->rtdns_len /
+ memcpy(unwind_info.ns, dns, proposal->ns_len);
+ unwind_info.count = proposal->ns_len /
sizeof(in_addr_t);
}
}
- if (proposal->rtsearch_len > 0) {
+ if (proposal->domains_len > 0) {
rslt = asprintf(&search, "search %.*s\n",
- proposal->rtsearch_len, domains);
+ proposal->domains_len, domains);
if (rslt == -1)
search = NULL;
}
@@ -951,7 +951,7 @@ priv_propose(char *name, int ioctlfd, struct proposal *proposal,
set_address(name, ioctlfd, proposal->ifa, proposal->netmask);
set_routes(name, index, rdomain, routefd, proposal->ifa,
- proposal->netmask, routes, proposal->rtstatic_len);
+ proposal->netmask, routes, proposal->routes_len);
}
/*
diff --git a/sbin/dhclient/privsep.h b/sbin/dhclient/privsep.h
index 39caf58aab3..60ce463e127 100644
--- a/sbin/dhclient/privsep.h
+++ b/sbin/dhclient/privsep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.h,v 1.65 2020/05/20 18:27:16 krw Exp $ */
+/* $OpenBSD: privsep.h,v 1.66 2020/05/20 19:13:34 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
@@ -29,9 +29,9 @@ enum imsg_code {
struct proposal {
struct in_addr ifa;
struct in_addr netmask;
- unsigned int rtstatic_len;
- unsigned int rtsearch_len;
- unsigned int rtdns_len;
+ unsigned int routes_len;
+ unsigned int domains_len;
+ unsigned int ns_len;
int mtu;
};