svn commit: r257031 - user/ae/inet6/sys/netinet6
Andrey V. Elsukov
ae at FreeBSD.org
Thu Oct 24 00:48:31 UTC 2013
Author: ae
Date: Thu Oct 24 00:48:31 2013
New Revision: 257031
URL: http://svnweb.freebsd.org/changeset/base/257031
Log:
Scope related cleanup in rip6_bind():
* remove sa6_embedscope() call, use sa6_checkzone() instead;
* use in6ifa_ifwithaddr() to determine interface where address
is configured.
* initialize inp->in6p_zoneid.
Modified:
user/ae/inet6/sys/netinet6/raw_ip6.c
Modified: user/ae/inet6/sys/netinet6/raw_ip6.c
==============================================================================
--- user/ae/inet6/sys/netinet6/raw_ip6.c Thu Oct 24 00:39:27 2013 (r257030)
+++ user/ae/inet6/sys/netinet6/raw_ip6.c Thu Oct 24 00:48:31 2013 (r257031)
@@ -721,7 +721,7 @@ rip6_bind(struct socket *so, struct sock
{
struct inpcb *inp;
struct sockaddr_in6 *addr = (struct sockaddr_in6 *)nam;
- struct ifaddr *ifa = NULL;
+ struct in6_ifaddr *ifa = NULL;
int error = 0;
inp = sotoinpcb(so);
@@ -733,24 +733,24 @@ rip6_bind(struct socket *so, struct sock
return (error);
if (TAILQ_EMPTY(&V_ifnet) || addr->sin6_family != AF_INET6)
return (EADDRNOTAVAIL);
- if ((error = sa6_embedscope(addr, V_ip6_use_defzone)) != 0)
+ if ((error = sa6_checkzone(addr)) != 0)
return (error);
-
- if (!IN6_IS_ADDR_UNSPECIFIED(&addr->sin6_addr) &&
- (ifa = ifa_ifwithaddr((struct sockaddr *)addr)) == NULL)
- return (EADDRNOTAVAIL);
- if (ifa != NULL &&
- ((struct in6_ifaddr *)ifa)->ia6_flags &
- (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY|
- IN6_IFF_DETACHED|IN6_IFF_DEPRECATED)) {
- ifa_free(ifa);
+ if (!IN6_IS_ADDR_UNSPECIFIED(&addr->sin6_addr)) {
+ ifa = in6ifa_ifwithaddr(&addr->sin6_addr, addr->sin6_scope_id);
+ if (ifa == NULL)
+ return (EADDRNOTAVAIL);
+ }
+ if (ifa != NULL && ifa->ia6_flags & (IN6_IFF_ANYCAST |
+ IN6_IFF_NOTREADY | IN6_IFF_DETACHED | IN6_IFF_DEPRECATED)) {
+ ifa_free(&ifa->ia_ifa);
return (EADDRNOTAVAIL);
}
if (ifa != NULL)
- ifa_free(ifa);
+ ifa_free(&ifa->ia_ifa);
INP_INFO_WLOCK(&V_ripcbinfo);
INP_WLOCK(inp);
inp->in6p_laddr = addr->sin6_addr;
+ inp->in6p_zoneid = addr->sin6_scope_id;
INP_WUNLOCK(inp);
INP_INFO_WUNLOCK(&V_ripcbinfo);
return (0);
More information about the svn-src-user
mailing list