summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2021-02-27 10:21:08 +0000
committerflorian <florian@openbsd.org>2021-02-27 10:21:08 +0000
commit131c304b85583d4fc4ac3af7203d90e65f82382c (patch)
tree4e346b6653baab578b9b990f8c9c26f7b33b6525
parentRead the lease file into a statically sized buffer and pass it over to (diff)
downloadwireguard-openbsd-131c304b85583d4fc4ac3af7203d90e65f82382c.tar.xz
wireguard-openbsd-131c304b85583d4fc4ac3af7203d90e65f82382c.zip
Path #defines are traditionally prefixed with _PATH.
pointed out by deraadt
-rw-r--r--sbin/dhcpleased/dhcpleased.c16
-rw-r--r--sbin/dhcpleased/dhcpleased.h6
-rw-r--r--usr.sbin/dhcpleasectl/dhcpleasectl.c4
3 files changed, 13 insertions, 13 deletions
diff --git a/sbin/dhcpleased/dhcpleased.c b/sbin/dhcpleased/dhcpleased.c
index ae0efe7fa14..dca6461bdef 100644
--- a/sbin/dhcpleased/dhcpleased.c
+++ b/sbin/dhcpleased/dhcpleased.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpleased.c,v 1.2 2021/02/27 10:07:41 florian Exp $ */
+/* $OpenBSD: dhcpleased.c,v 1.3 2021/02/27 10:21:08 florian Exp $ */
/*
* Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
@@ -131,7 +131,7 @@ main(int argc, char *argv[])
int pipe_main2engine[2];
int frontend_routesock, rtfilter;
int rtable_any = RTABLE_ANY;
- char *csock = DHCPLEASED_SOCKET;
+ char *csock = _PATH_DHCPLEASED_SOCKET;
#ifndef SMALL
int control_fd;
#endif /* SMALL */
@@ -267,7 +267,7 @@ main(int argc, char *argv[])
if (unveil("/dev/bpf", "rw") == -1)
fatal("unveil");
- if (unveil(LEASE_PATH, "rwc") == -1)
+ if (unveil(_PATH_LEASE, "rwc") == -1)
fatal("unveil");
if (unveil(NULL, NULL) == -1)
@@ -621,9 +621,9 @@ configure_interface(struct imsg_configure_interface *imsg)
char *if_name;
char ntop_buf[INET_ADDRSTRLEN];
char lease_buf[LEASE_SIZE];
- char lease_file_buf[sizeof(LEASE_PATH) +
+ char lease_file_buf[sizeof(_PATH_LEASE) +
IF_NAMESIZE];
- char tmpl[] = LEASE_PATH"XXXXXXXXXX";
+ char tmpl[] = _PATH_LEASE"XXXXXXXXXX";
log_debug("%s", __func__);
@@ -721,7 +721,7 @@ configure_interface(struct imsg_configure_interface *imsg)
}
len = snprintf(lease_file_buf, sizeof(lease_file_buf), "%s%s",
- LEASE_PATH, if_name);
+ _PATH_LEASE, if_name);
if ( len == -1 || (size_t) len >= sizeof(lease_file_buf)) {
log_warnx("%s: failed to encode lease path for %s", __func__,
if_name);
@@ -960,7 +960,7 @@ read_lease_file(struct imsg_ifinfo *imsg_ifinfo)
{
int len, fd;
char if_name[IF_NAMESIZE];
- char lease_file_buf[sizeof(LEASE_PATH) + IF_NAMESIZE];
+ char lease_file_buf[sizeof(_PATH_LEASE) + IF_NAMESIZE];
memset(imsg_ifinfo->lease, 0, sizeof(imsg_ifinfo->lease));
@@ -971,7 +971,7 @@ read_lease_file(struct imsg_ifinfo *imsg_ifinfo)
}
len = snprintf(lease_file_buf, sizeof(lease_file_buf), "%s%s",
- LEASE_PATH, if_name);
+ _PATH_LEASE, if_name);
if ( len == -1 || (size_t) len >= sizeof(lease_file_buf)) {
log_warnx("%s: failed to encode lease path for %s", __func__,
if_name);
diff --git a/sbin/dhcpleased/dhcpleased.h b/sbin/dhcpleased/dhcpleased.h
index a81dd1871e2..b33312799d4 100644
--- a/sbin/dhcpleased/dhcpleased.h
+++ b/sbin/dhcpleased/dhcpleased.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpleased.h,v 1.2 2021/02/27 10:07:41 florian Exp $ */
+/* $OpenBSD: dhcpleased.h,v 1.3 2021/02/27 10:21:08 florian Exp $ */
/*
* Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
@@ -18,12 +18,12 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define DHCPLEASED_SOCKET "/dev/dhcpleased.sock"
+#define _PATH_DHCPLEASED_SOCKET "/dev/dhcpleased.sock"
#define DHCPLEASED_USER "_dhcp"
#define DHCPLEASED_RTA_LABEL "dhcpleased"
#define SERVER_PORT 67
#define CLIENT_PORT 68
-#define LEASE_PATH "/var/db/dhcpleased/"
+#define _PATH_LEASE "/var/db/dhcpleased/"
#define LEASE_PREFIX "version: 1\nip: "
#define LEASE_SIZE sizeof(LEASE_PREFIX"xxx.xxx.xxx.xxx\n")
/* MAXDNAME from arpa/namesr.h */
diff --git a/usr.sbin/dhcpleasectl/dhcpleasectl.c b/usr.sbin/dhcpleasectl/dhcpleasectl.c
index e05b70fe558..3bd19666a66 100644
--- a/usr.sbin/dhcpleasectl/dhcpleasectl.c
+++ b/usr.sbin/dhcpleasectl/dhcpleasectl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpleasectl.c,v 1.1 2021/02/26 16:16:37 florian Exp $ */
+/* $OpenBSD: dhcpleasectl.c,v 1.2 2021/02/27 10:21:08 florian Exp $ */
/*
* Copyright (c) 2021 Florian Obser <florian@openbsd.org>
@@ -74,7 +74,7 @@ main(int argc, char *argv[])
int ch;
char *sockname;
- sockname = DHCPLEASED_SOCKET;
+ sockname = _PATH_DHCPLEASED_SOCKET;
while ((ch = getopt(argc, argv, "s:")) != -1) {
switch (ch) {
case 's':