diff --git a/sys/netinet6/in6_pcb.h b/sys/netinet6/in6_pcb.h index b394d88200e7..f884415217c2 100644 --- a/sys/netinet6/in6_pcb.h +++ b/sys/netinet6/in6_pcb.h @@ -1,5 +1,5 @@ -/* $NetBSD: in6_pcb.h,v 1.13 2000/10/19 20:23:02 itojun Exp $ */ -/* $KAME: in6_pcb.h,v 1.28 2000/06/09 01:10:12 itojun Exp $ */ +/* $NetBSD: in6_pcb.h,v 1.14 2001/02/08 14:56:15 itojun Exp $ */ +/* $KAME: in6_pcb.h,v 1.44 2001/02/06 09:16:53 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -177,10 +177,6 @@ struct in6_addr *in6_selectsrc __P((struct sockaddr_in6 *, struct in6_addr *, int *)); int in6_selecthlim __P((struct in6pcb *, struct ifnet *)); int in6_pcbsetport __P((struct in6_addr *, struct in6pcb *)); -int in6_embedscope __P((struct in6_addr *, const struct sockaddr_in6 *, - struct in6pcb *, struct ifnet **)); -int in6_recoverscope __P((struct sockaddr_in6 *, const struct in6_addr *, - struct ifnet *)); extern struct rtentry * in6_pcbrtentry __P((struct in6pcb *)); diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index c56ea221ab8c..3b50d55eeef6 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -1,5 +1,5 @@ -/* $NetBSD: in6_src.c,v 1.4 2000/08/26 11:03:46 itojun Exp $ */ -/* $KAME: in6_src.c,v 1.34 2000/08/26 10:00:45 itojun Exp $ */ +/* $NetBSD: in6_src.c,v 1.5 2001/02/08 14:56:16 itojun Exp $ */ +/* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -102,9 +102,9 @@ extern struct ifnet loif[NLOOP]; /* - * Return an IPv6 address, which is the most appropriate for given + * Return an IPv6 address, which is the most appropriate for a given * destination and user specified options. - * If necessary, this function lookups the routing table and return + * If necessary, this function lookups the routing table and returns * an entry to the caller for later use. */ struct in6_addr * @@ -246,12 +246,15 @@ in6_selectsrc(dstsock, opts, mopts, ro, laddr, errorp) } if (ro->ro_rt == (struct rtentry *)0 || ro->ro_rt->rt_ifp == (struct ifnet *)0) { + struct sockaddr_in6 *sa6; + /* No route yet, so try to acquire one */ bzero(&ro->ro_dst, sizeof(struct sockaddr_in6)); - ro->ro_dst.sin6_family = AF_INET6; - ro->ro_dst.sin6_len = sizeof(struct sockaddr_in6); - ro->ro_dst.sin6_addr = *dst; - ro->ro_dst.sin6_scope_id = dstsock->sin6_scope_id; + sa6 = (struct sockaddr_in6 *)&ro->ro_dst; + sa6->sin6_family = AF_INET6; + sa6->sin6_len = sizeof(struct sockaddr_in6); + sa6->sin6_addr = *dst; + sa6->sin6_scope_id = dstsock->sin6_scope_id; if (IN6_IS_ADDR_MULTICAST(dst)) { ro->ro_rt = rtalloc1(&((struct route *)ro) ->ro_dst, 0); @@ -513,3 +516,15 @@ in6_recoverscope(sin6, in6, ifp) return 0; } + +/* + * just clear the embedded scope identifer. + * XXX: currently used for bsdi4 only as a supplement function. + */ +void +in6_clearscope(addr) + struct in6_addr *addr; +{ + if (IN6_IS_SCOPE_LINKLOCAL(addr)) + addr->s6_addr16[1] = 0; +} diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index 92d9b0d01caa..8b58913e94a9 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -1,5 +1,5 @@ -/* $NetBSD: in6_var.h,v 1.16 2000/04/16 15:28:00 itojun Exp $ */ -/* $KAME: in6_var.h,v 1.31 2000/03/25 07:23:46 sumikawa Exp $ */ +/* $NetBSD: in6_var.h,v 1.17 2001/02/08 14:56:16 itojun Exp $ */ +/* $KAME: in6_var.h,v 1.52 2001/02/06 09:16:54 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -586,6 +586,13 @@ int in6_prefix_ioctl __P((struct socket *so, u_long cmd, caddr_t data, int in6_prefix_add_ifid __P((int iilen, struct in6_ifaddr *ia)); void in6_prefix_remove_ifid __P((int iilen, struct in6_ifaddr *ia)); void in6_purgeprefix __P((struct ifnet *)); + +struct in6pcb; +int in6_embedscope __P((struct in6_addr *, const struct sockaddr_in6 *, + struct in6pcb *, struct ifnet **)); +int in6_recoverscope __P((struct sockaddr_in6 *, const struct in6_addr *, + struct ifnet *)); +void in6_clearscope __P((struct in6_addr *)); #endif /* _KERNEL */ #endif /* _NETINET6_IN6_VAR_H_ */