diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2012-09-20 07:22:49 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2012-09-20 07:22:49 +0000 |
commit | 01cd08d4901053796b54b570e024b6f04be7727f (patch) | |
tree | 03ec2b5587a691ed7413c22b7ea2ceaca7a443e5 /usr.sbin/ospf6d/log.c | |
parent | 0787d49a4f46e21cd7ca21a8719d5c60be1b259f (diff) |
Bring back log_in6addr_scope() as ospf6ctl uses it.
Found by kettenis@ the hard way.
Diffstat (limited to 'usr.sbin/ospf6d/log.c')
-rw-r--r-- | usr.sbin/ospf6d/log.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/usr.sbin/ospf6d/log.c b/usr.sbin/ospf6d/log.c index d010d18736d..db0ee9da7ac 100644 --- a/usr.sbin/ospf6d/log.c +++ b/usr.sbin/ospf6d/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.8 2012/09/19 19:15:27 bluhm Exp $ */ +/* $OpenBSD: log.c,v 1.9 2012/09/20 07:22:48 bluhm Exp $ */ /* * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org> @@ -189,6 +189,25 @@ log_in6addr(const struct in6_addr *addr) return (log_sockaddr(&sa_in6)); } +const char * +log_in6addr_scope(const struct in6_addr *addr, unsigned int ifindex) +{ + struct sockaddr_in6 sa_in6; + + 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, IPv6 & KAME, for this ugliness... */ + if (IN6_IS_ADDR_LINKLOCAL(&sa_in6.sin6_addr) || + IN6_IS_ADDR_MC_LINKLOCAL(&sa_in6.sin6_addr)) { + sa_in6.sin6_scope_id = ifindex; + } + + return (log_sockaddr(&sa_in6)); +} + #define NUM_LOGS 4 const char * log_rtr_id(u_int32_t id) |