Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Oct 2013 13:54:58 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r256741 - user/ae/inet6/sys/netinet6
Message-ID:  <201310181354.r9IDswqp081705@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310181354.r9IDswqp081705>