Module Name: src Committed By: christos Date: Sat Oct 19 00:39:39 UTC 2013
Modified Files: src/sbin/route: route.c Log Message: use scopeid functions To generate a diff of this commit: cvs rdiff -u -r1.141 -r1.142 src/sbin/route/route.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sbin/route/route.c diff -u src/sbin/route/route.c:1.141 src/sbin/route/route.c:1.142 --- src/sbin/route/route.c:1.141 Fri Oct 18 17:01:00 2013 +++ src/sbin/route/route.c Fri Oct 18 20:39:39 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: route.c,v 1.141 2013/10/18 21:01:00 christos Exp $ */ +/* $NetBSD: route.c,v 1.142 2013/10/19 00:39:39 christos Exp $ */ /* * Copyright (c) 1983, 1989, 1991, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19 #if 0 static char sccsid[] = "@(#)route.c 8.6 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: route.c,v 1.141 2013/10/18 21:01:00 christos Exp $"); +__RCSID("$NetBSD: route.c,v 1.142 2013/10/19 00:39:39 christos Exp $"); #endif #endif /* not lint */ @@ -538,19 +538,7 @@ routename(const struct sockaddr *sa, str memcpy(&sin6, sa, sa->sa_len); sin6.sin6_len = sizeof(struct sockaddr_in6); sin6.sin6_family = AF_INET6; -#ifdef __KAME__ - if (sa->sa_len == sizeof(struct sockaddr_in6) && - (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr) || - IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr)) && - sin6.sin6_scope_id == 0) { - uint16_t scope; - memcpy(&scope, &sin6.sin6_addr.s6_addr[2], - sizeof(scope)); - sin6.sin6_scope_id = ntohs(scope); - sin6.sin6_addr.s6_addr[2] = 0; - sin6.sin6_addr.s6_addr[3] = 0; - } -#endif + inet6_getscopeid(&sin6, 3); nml = netmask_length(nm, AF_INET6); if (IN6_IS_ADDR_UNSPECIFIED(&sin6.sin6_addr)) { if (nml == 0) @@ -707,19 +695,7 @@ netname(const struct sockaddr *sa, struc memcpy(&sin6, sa, sa->sa_len); sin6.sin6_len = sizeof(struct sockaddr_in6); sin6.sin6_family = AF_INET6; -#ifdef __KAME__ - if (sa->sa_len == sizeof(struct sockaddr_in6) && - (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr) || - IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr)) && - sin6.sin6_scope_id == 0) { - uint16_t scope; - memcpy(&scope, &sin6.sin6_addr.s6_addr[2], - sizeof(scope)); - sin6.sin6_scope_id = ntohs(scope); - sin6.sin6_addr.s6_addr[2] = 0; - sin6.sin6_addr.s6_addr[3] = 0; - } -#endif + inet6_putscopeid(&sin6, 3); nml = netmask_length(nm, AF_INET6); if (IN6_IS_ADDR_UNSPECIFIED(&sin6.sin6_addr)) { if (nml == 0) @@ -1259,17 +1235,7 @@ getaddr(int which, const char *s, struct } memcpy(&su->sin6, res->ai_addr, sizeof(su->sin6)); freeaddrinfo(res); -#ifdef __KAME__ - if ((IN6_IS_ADDR_LINKLOCAL(&su->sin6.sin6_addr) || - IN6_IS_ADDR_MC_LINKLOCAL(&su->sin6.sin6_addr)) && - su->sin6.sin6_scope_id) { - uint16_t scope; - scope = htons(su->sin6.sin6_scope_id); - memcpy(&su->sin6.sin6_addr.s6_addr[2], &scope, - sizeof(scope)); - su->sin6.sin6_scope_id = 0; - } -#endif + inet6_getscopeid(&su->sin6, 3); if (hints.ai_flags == AI_NUMERICHOST) { if (slash) return prefixlen(slash + 1, soup);