diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-01-03 22:20:00 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-01-03 22:20:00 +0000 |
commit | 4408d355bf203228e260018e43cfbc145f9ea1d3 (patch) | |
tree | d0ccb664c5001a2930f258c48055384edb874f68 /usr.sbin/bgpd/log.c | |
parent | a3c7f60ab9ba3c37009a70632cf95b8266282878 (diff) |
Move functions shared with bgpctl into new file util.c. Simplifies the
link between bgpctl and bgpd mostly because of rde_attr.c.
Diffstat (limited to 'usr.sbin/bgpd/log.c')
-rw-r--r-- | usr.sbin/bgpd/log.c | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/usr.sbin/bgpd/log.c b/usr.sbin/bgpd/log.c index 3769e5ba633..1cea36f0598 100644 --- a/usr.sbin/bgpd/log.c +++ b/usr.sbin/bgpd/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.46 2005/06/05 23:54:05 henning Exp $ */ +/* $OpenBSD: log.c,v 1.47 2006/01/03 22:19:59 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -331,49 +331,3 @@ log_conn_attempt(const struct peer *peer, struct sockaddr *sa) free(p); } } - -const char * -log_addr(const struct bgpd_addr *addr) -{ - static char buf[48]; - - if (inet_ntop(addr->af, &addr->ba, buf, sizeof(buf)) == NULL) - return ("?"); - else - return (buf); -} - -const char * -log_in6addr(const struct in6_addr *addr) -{ - struct sockaddr_in6 sa_in6; - u_int16_t tmp16; - - bzero(&sa_in6, sizeof(sa_in6)); - sa_in6.sin6_len = sizeof(sa_in6); - sa_in6.sin6_family = AF_INET6; - memcpy(&sa_in6.sin6_addr, addr, sizeof(sa_in6.sin6_addr)); - - /* XXX thanks, KAME, for this ugliness... adopted from route/show.c */ - if (IN6_IS_ADDR_LINKLOCAL(&sa_in6.sin6_addr) || - IN6_IS_ADDR_MC_LINKLOCAL(&sa_in6.sin6_addr)) { - memcpy(&tmp16, &sa_in6.sin6_addr.s6_addr[2], sizeof(tmp16)); - sa_in6.sin6_scope_id = ntohs(tmp16); - sa_in6.sin6_addr.s6_addr[2] = 0; - sa_in6.sin6_addr.s6_addr[3] = 0; - } - - return (log_sockaddr((struct sockaddr *)&sa_in6)); -} - -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); -} |