Browse Source

provide log_sockaddr, from bgpd

OPENBSD_3_6
henning 20 years ago
parent
commit
e473e31441
1 changed files with 13 additions and 1 deletions
  1. +13
    -1
      src/usr.sbin/ntpd/log.c

+ 13
- 1
src/usr.sbin/ntpd/log.c View File

@ -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> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -155,3 +155,15 @@ fatalx(const char *emsg)
errno = 0; errno = 0;
fatal(emsg); 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);
}

Loading…
Cancel
Save