summaryrefslogtreecommitdiff
path: root/sbin/iked
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2023-06-16 10:28:44 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2023-06-16 10:28:44 +0000
commit9da0f798923e8b590d007d6c7e9cc9c8f4b4cd73 (patch)
tree6be48681c0e39ae1afdb19441730a9bf0590f996 /sbin/iked
parent8c2e694848735f8cfec8f67f981b209119880c10 (diff)
Now that print_host() is unused, rename it to print_addr() and simplify.
ok claudio tobhe
Diffstat (limited to 'sbin/iked')
-rw-r--r--sbin/iked/iked.h4
-rw-r--r--sbin/iked/util.c33
2 files changed, 15 insertions, 22 deletions
diff --git a/sbin/iked/iked.h b/sbin/iked/iked.h
index f429d554244..84999630d9f 100644
--- a/sbin/iked/iked.h
+++ b/sbin/iked/iked.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iked.h,v 1.216 2023/06/13 12:34:12 tb Exp $ */
+/* $OpenBSD: iked.h,v 1.217 2023/06/16 10:28:43 tb Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
@@ -1251,8 +1251,6 @@ struct in6_addr *
uint32_t
prefixlen2mask(uint8_t);
const char *
- print_host(struct sockaddr *, char *, size_t);
-const char *
print_addr(void *);
char *get_string(uint8_t *, size_t);
const char *
diff --git a/sbin/iked/util.c b/sbin/iked/util.c
index 9f827b1c899..586233abea5 100644
--- a/sbin/iked/util.c
+++ b/sbin/iked/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.41 2023/06/13 12:34:12 tb Exp $ */
+/* $OpenBSD: util.c,v 1.42 2023/06/16 10:28:43 tb Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -636,19 +636,20 @@ prefixlen2mask6(uint8_t prefixlen, uint32_t *mask)
}
const char *
-print_host(struct sockaddr *sa, char *buf, size_t len)
+print_addr(void *addr)
{
- static char sbuf[IKED_CYCLE_BUFFERS][NI_MAXHOST + 7];
- static int idx = 0;
- char pbuf[7];
- in_port_t port;
-
- if (buf == NULL) {
- buf = sbuf[idx];
- len = sizeof(sbuf[idx]);
- if (++idx >= IKED_CYCLE_BUFFERS)
- idx = 0;
- }
+ static char sbuf[IKED_CYCLE_BUFFERS][NI_MAXHOST + 7];
+ static int idx;
+ struct sockaddr *sa = addr;
+ char *buf;
+ size_t len;
+ char pbuf[7];
+ in_port_t port;
+
+ buf = sbuf[idx];
+ len = sizeof(sbuf[idx]);
+ if (++idx >= IKED_CYCLE_BUFFERS)
+ idx = 0;
if (sa->sa_family == AF_UNSPEC) {
strlcpy(buf, "any", len);
@@ -669,12 +670,6 @@ print_host(struct sockaddr *sa, char *buf, size_t len)
return (buf);
}
-const char *
-print_addr(void *addr)
-{
- return print_host(addr, NULL, 0);
-}
-
char *
get_string(uint8_t *ptr, size_t len)
{