-/* $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>
prefixlen2mask6(uint8_t, uint32_t *);
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);
-/* $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>
}
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);
return (buf);
}
-const char *
-print_addr(void *addr)
-{
- return print_host(addr, NULL, 0);
-}
-
char *
get_string(uint8_t *ptr, size_t len)
{