From owner-svn-src-user@FreeBSD.ORG Mon Oct 28 04:03:17 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DC4FD424; Mon, 28 Oct 2013 04:03:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AEF512F0C; Mon, 28 Oct 2013 04:03:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9S43HEf075360; Mon, 28 Oct 2013 04:03:17 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9S43HGI075359; Mon, 28 Oct 2013 04:03:17 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310280403.r9S43HGI075359@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 28 Oct 2013 04:03:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257237 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2013 04:03:17 -0000 Author: ae Date: Mon Oct 28 04:03:17 2013 New Revision: 257237 URL: http://svnweb.freebsd.org/changeset/base/257237 Log: Remove in6_setscope() calls and unneeded variables. Use in6_getscopezone() to determine zone indexes. Modified: user/ae/inet6/sys/netinet6/ip6_mroute.c Modified: user/ae/inet6/sys/netinet6/ip6_mroute.c ============================================================================== --- user/ae/inet6/sys/netinet6/ip6_mroute.c Mon Oct 28 02:36:34 2013 (r257236) +++ user/ae/inet6/sys/netinet6/ip6_mroute.c Mon Oct 28 04:03:17 2013 (r257237) @@ -1402,9 +1402,8 @@ ip6_mdq(struct mbuf *m, struct ifnet *if mifi_t mifi, iif; struct mif6 *mifp; int plen = m->m_pkthdr.len; - struct in6_addr src0, dst0; /* copies for local work */ - u_int32_t iszone, idzone, oszone, odzone; - int error = 0; + uint32_t srczone, dstzone; + int srcscope, dstscope; /* * Macro to send packet on mif. Since RSVP packets don't get counted on @@ -1520,14 +1519,20 @@ ip6_mdq(struct mbuf *m, struct ifnet *if return (0); } /* if wrong iif */ + srcscope = in6_addrscope(&ip6->ip6_src); + dstscope = in6_addrscope(&ip6->ip6_dst); /* If I sourced this packet, it counts as output, else it was input. */ if (m->m_pkthdr.rcvif == NULL) { /* XXX: is rcvif really NULL when output?? */ mif6table[mifi].m6_pkt_out++; mif6table[mifi].m6_bytes_out += plen; + srczone = in6_getscopezone(ifp, srcscope); + dstzone = in6_getscopezone(ifp, dstscope); } else { mif6table[mifi].m6_pkt_in++; mif6table[mifi].m6_bytes_in += plen; + srczone = in6_getscopezone(m->m_pkthdr.rcvif, srcscope); + dstzone = in6_getscopezone(m->m_pkthdr.rcvif, dstscope); } rt->mf6c_pkt_cnt++; rt->mf6c_byte_cnt += plen; @@ -1536,13 +1541,6 @@ ip6_mdq(struct mbuf *m, struct ifnet *if * For each mif, forward a copy of the packet if there are group * members downstream on the interface. */ - src0 = ip6->ip6_src; - dst0 = ip6->ip6_dst; - if ((error = in6_setscope(&src0, ifp, &iszone)) != 0 || - (error = in6_setscope(&dst0, ifp, &idzone)) != 0) { - IP6STAT_INC(ip6s_badscope); - return (error); - } for (mifp = mif6table, mifi = 0; mifi < nummifs; mifp++, mifi++) { if (IF_ISSET(mifi, &rt->mf6c_ifset)) { /* @@ -1554,12 +1552,10 @@ ip6_mdq(struct mbuf *m, struct ifnet *if if (!(mif6table[rt->mf6c_parent].m6_flags & MIFF_REGISTER) && !(mif6table[mifi].m6_flags & MIFF_REGISTER)) { - if (in6_setscope(&src0, mif6table[mifi].m6_ifp, - &oszone) || - in6_setscope(&dst0, mif6table[mifi].m6_ifp, - &odzone) || - iszone != oszone || - idzone != odzone) { + if (srczone != in6_getscopezone( + mif6table[mifi].m6_ifp, srcscope) || + dstzone != in6_getscopezone( + mif6table[mifi].m6_ifp, dstscope)) { IP6STAT_INC(ip6s_badscope); continue; }