summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/relayd/log.c')
-rw-r--r--usr.sbin/relayd/log.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/usr.sbin/relayd/log.c b/usr.sbin/relayd/log.c
index c90c1fdf315..e9cd8cf202b 100644
--- a/usr.sbin/relayd/log.c
+++ b/usr.sbin/relayd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.11 2007/12/07 17:17:00 reyk Exp $ */
+/* $OpenBSD: log.c,v 1.12 2008/07/17 15:10:14 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -34,6 +34,7 @@
#include <string.h>
#include <syslog.h>
#include <event.h>
+#include <netdb.h>
#include <openssl/ssl.h>
@@ -218,15 +219,10 @@ print_availability(u_long cnt, u_long up)
const char *
print_host(struct sockaddr_storage *ss, char *buf, size_t len)
{
- int af = ss->ss_family;
- void *ptr;
-
- bzero(buf, len);
- if (af == AF_INET)
- ptr = &((struct sockaddr_in *)ss)->sin_addr;
- else
- ptr = &((struct sockaddr_in6 *)ss)->sin6_addr;
- return (inet_ntop(af, ptr, buf, len));
+ if (getnameinfo((struct sockaddr *)ss, ss->ss_len,
+ buf, len, NULL, 0, NI_NUMERICHOST) != 0)
+ return (NULL);
+ return (buf);
}
const char *