svn commit: r256741 - user/ae/inet6/sys/netinet6

Andrey V. Elsukov ae at FreeBSD.org
Fri Oct 18 13:54:58 UTC 2013


Author: ae
Date: Fri Oct 18 13:54:58 2013
New Revision: 256741
URL: http://svnweb.freebsd.org/changeset/base/256741

Log:
  Use in6_getscopezone() instead of in6_setscope() and sa6_embedscope().

Modified:
  user/ae/inet6/sys/netinet6/in6.c

Modified: user/ae/inet6/sys/netinet6/in6.c
==============================================================================
--- user/ae/inet6/sys/netinet6/in6.c	Fri Oct 18 13:27:34 2013	(r256740)
+++ user/ae/inet6/sys/netinet6/in6.c	Fri Oct 18 13:54:58 2013	(r256741)
@@ -1010,25 +1010,11 @@ in6_update_ifa(struct ifnet *ifp, struct
 	 * zone identifier.
 	 */
 	dst6 = ifra->ifra_dstaddr;
-	if ((ifp->if_flags & (IFF_POINTOPOINT|IFF_LOOPBACK)) != 0 &&
-	    (dst6.sin6_family == AF_INET6)) {
-		struct in6_addr in6_tmp;
-		u_int32_t zoneid;
-
-		in6_tmp = dst6.sin6_addr;
-		if (in6_setscope(&in6_tmp, ifp, &zoneid))
-			return (EINVAL); /* XXX: should be impossible */
-
-		if (dst6.sin6_scope_id != 0) {
-			if (dst6.sin6_scope_id != zoneid)
-				return (EINVAL);
-		} else		/* user omit to specify the ID. */
-			dst6.sin6_scope_id = zoneid;
-
-		/* convert into the internal form */
-		if (sa6_embedscope(&dst6, 0))
-			return (EINVAL); /* XXX: should be impossible */
-	}
+	if ((ifp->if_flags & (IFF_POINTOPOINT | IFF_LOOPBACK)) != 0 &&
+	    dst6.sin6_family == AF_INET6 && dst6.sin6_scope_id != 0 &&
+	    dst6.sin6_scope_id != in6_getscopezone(ifp,
+		in6_addrscope(&dst6.sin6_addr)))
+		return (EINVAL);
 	/*
 	 * The destination address can be specified only for a p2p or a
 	 * loopback interface.  If specified, the corresponding prefix length


More information about the svn-src-user mailing list