diff options
Diffstat (limited to 'usr.bin/netstat/route.c')
-rw-r--r-- | usr.bin/netstat/route.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index 363f4033dda..a7f842bae75 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.56 2003/08/27 00:33:33 henric Exp $ */ +/* $OpenBSD: route.c,v 1.57 2003/10/03 21:22:32 itojun Exp $ */ /* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94"; #else -static char *rcsid = "$OpenBSD: route.c,v 1.56 2003/08/27 00:33:33 henric Exp $"; +static char *rcsid = "$OpenBSD: route.c,v 1.57 2003/10/03 21:22:32 itojun Exp $"; #endif #endif /* not lint */ @@ -1043,7 +1043,25 @@ encap_print(struct rtentry *rt) s61.sin6_family = s62.sin6_family = AF_INET6; s61.sin6_len = s62.sin6_len = sizeof(s61); bcopy(&sen1.sen_ip6_src, &s61.sin6_addr, sizeof(struct in6_addr)); +#ifdef __KAME__ + if (IN6_IS_ADDR_LINKLOCAL(&s61.sin6_addr) || + IN6_IS_ADDR_MC_LINKLOCAL(&s61.sin6_addr)) { + s61.sin6_scope_id = + ((u_int16_t)s61.sin6_addr.s6_addr[2] << 8) | + s61.sin6_addr.s6_addr[3]; + s61.sin6_addr.s6_addr[2] = s61.sin6_addr.s6_addr[3] = 0; + } +#endif bcopy(&sen2.sen_ip6_src, &s62.sin6_addr, sizeof(struct in6_addr)); +#ifdef __KAME__ + if (IN6_IS_ADDR_LINKLOCAL(&s62.sin6_addr) || + IN6_IS_ADDR_MC_LINKLOCAL(&s62.sin6_addr)) { + s62.sin6_scope_id = + ((u_int16_t)s62.sin6_addr.s6_addr[2] << 8) | + s62.sin6_addr.s6_addr[3]; + s62.sin6_addr.s6_addr[2] = s62.sin6_addr.s6_addr[3] = 0; + } +#endif printf("%-42s %-5u ", netname6(&s61, &s62.sin6_addr), ntohs(sen1.sen_ip6_sport)); @@ -1053,7 +1071,25 @@ encap_print(struct rtentry *rt) s61.sin6_family = s62.sin6_family = AF_INET6; s61.sin6_len = s62.sin6_len = sizeof(s61); bcopy(&sen1.sen_ip6_dst, &s61.sin6_addr, sizeof(struct in6_addr)); +#ifdef __KAME__ + if (IN6_IS_ADDR_LINKLOCAL(&s61.sin6_addr) || + IN6_IS_ADDR_MC_LINKLOCAL(&s61.sin6_addr)) { + s61.sin6_scope_id = + ((u_int16_t)s61.sin6_addr.s6_addr[2] << 8) | + s61.sin6_addr.s6_addr[3]; + s61.sin6_addr.s6_addr[2] = s61.sin6_addr.s6_addr[3] = 0; + } +#endif bcopy(&sen2.sen_ip6_dst, &s62.sin6_addr, sizeof(struct in6_addr)); +#ifdef __KAME__ + if (IN6_IS_ADDR_LINKLOCAL(&s62.sin6_addr) || + IN6_IS_ADDR_MC_LINKLOCAL(&s62.sin6_addr)) { + s62.sin6_scope_id = + ((u_int16_t)s62.sin6_addr.s6_addr[2] << 8) | + s62.sin6_addr.s6_addr[3]; + s62.sin6_addr.s6_addr[2] = s62.sin6_addr.s6_addr[3] = 0; + } +#endif printf("%-42s %-5u %-5u ", netname6(&s61, &s62.sin6_addr), ntohs(sen1.sen_ip6_dport), sen1.sen_ip6_proto); |