Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/route use scopeid functions
details: https://anonhg.NetBSD.org/src/rev/fec641a59a2e
branches: trunk
changeset: 790659:fec641a59a2e
user: christos <christos%NetBSD.org@localhost>
date: Sat Oct 19 00:39:39 2013 +0000
description:
use scopeid functions
diffstat:
sbin/route/route.c | 44 +++++---------------------------------------
1 files changed, 5 insertions(+), 39 deletions(-)
diffs (79 lines):
diff -r 5108be593b0d -r fec641a59a2e sbin/route/route.c
--- a/sbin/route/route.c Sat Oct 19 00:35:30 2013 +0000
+++ b/sbin/route/route.c Sat Oct 19 00:39:39 2013 +0000
@@ -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 @@
#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 @@
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 @@
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 @@
}
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);
Home |
Main Index |
Thread Index |
Old Index