From 1f484a27349e36cf23abbac84daf293e30482df1 Mon Sep 17 00:00:00 2001 From: christos Date: Sat, 19 Oct 2013 15:47:02 +0000 Subject: [PATCH] use new constants --- lib/libc/net/inet6_scopeid.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/libc/net/inet6_scopeid.c b/lib/libc/net/inet6_scopeid.c index 05bdf932f60f..8369af0a431f 100644 --- a/lib/libc/net/inet6_scopeid.c +++ b/lib/libc/net/inet6_scopeid.c @@ -34,7 +34,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: inet6_scopeid.c,v 1.1 2013/10/19 00:08:34 christos Exp $"); +__RCSID("$NetBSD: inet6_scopeid.c,v 1.2 2013/10/19 15:47:02 christos Exp $"); #include #include @@ -47,8 +47,12 @@ void inet6_getscopeid(struct sockaddr_in6 *sin6, int flags) { #if defined(__KAME__) - if ((IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) && (flags & 1)) || - (IN6_IS_ADDR_MC_LINKLOCAL(&sin6->sin6_addr) && (flags & 2))) { + if ((IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) && + (flags & INET6_IS_ADDR_LINKLOCAL)) || + (IN6_IS_ADDR_MC_LINKLOCAL(&sin6->sin6_addr) && + (flags & INET6_IS_ADDR_MC_LINKLOCAL)) || + (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr) && + (flags & INET6_IS_ADDR_SITELOCAL))) { uint16_t scope; memcpy(&scope, &sin6->sin6_addr.s6_addr[2], sizeof(scope)); sin6->sin6_scope_id = ntohs(scope); @@ -61,8 +65,12 @@ void inet6_putscopeid(struct sockaddr_in6 *sin6, int flags) { #if defined(__KAME__) - if ((IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) && (flags & 1)) || - (IN6_IS_ADDR_MC_LINKLOCAL(&sin6->sin6_addr) && (flags & 2))) { + if ((IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) && + (flags & INET6_IS_ADDR_LINKLOCAL)) || + (IN6_IS_ADDR_MC_LINKLOCAL(&sin6->sin6_addr) && + (flags & INET6_IS_ADDR_MC_LINKLOCAL)) || + (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr) && + (flags & INET6_IS_ADDR_SITELOCAL))) { uint16_t scope = htons(sin6->sin6_scope_id); memcpy(&sin6->sin6_addr.s6_addr[2], &scope, sizeof(scope)); sin6->sin6_scope_id = 0;