summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-06-17 19:15:28 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-06-17 19:15:28 +0000
commitf9e4cdc6e99bc859ee7e13773d3407643fe12f04 (patch)
tree40816206271ded3de1fa968d99c550c259df40e7
parentc74875d05b67dbdb0d781af861f32ebfb96c02fd (diff)
provide log_sockaddr, from bgpd
-rw-r--r--usr.sbin/ntpd/log.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.sbin/ntpd/log.c b/usr.sbin/ntpd/log.c
index f040acb877b..57ecbb442c4 100644
--- a/usr.sbin/ntpd/log.c
+++ b/usr.sbin/ntpd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.2 2004/06/01 20:28:19 henning Exp $ */
+/* $OpenBSD: log.c,v 1.3 2004/06/17 19:15:27 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -155,3 +155,15 @@ fatalx(const char *emsg)
errno = 0;
fatal(emsg);
}
+
+const char *
+log_sockaddr(struct sockaddr *sa)
+{
+ static char buf[NI_MAXHOST];
+
+ if (getnameinfo(sa, sa->sa_len, buf, sizeof(buf), NULL, 0,
+ NI_NUMERICHOST))
+ return ("(unknown)");
+ else
+ return (buf);
+}