Module Name: src Committed By: christos Date: Sat Oct 19 15:47:02 UTC 2013
Modified Files: src/lib/libc/net: inet6_scopeid.c Log Message: use new constants To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libc/net/inet6_scopeid.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/net/inet6_scopeid.c diff -u src/lib/libc/net/inet6_scopeid.c:1.1 src/lib/libc/net/inet6_scopeid.c:1.2 --- src/lib/libc/net/inet6_scopeid.c:1.1 Fri Oct 18 20:08:34 2013 +++ src/lib/libc/net/inet6_scopeid.c Sat Oct 19 11:47:02 2013 @@ -34,7 +34,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__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 <sys/endian.h> #include <string.h> @@ -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;