From owner-svn-src-user@FreeBSD.ORG Tue Oct 15 23:56:32 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 6C8898AE; Tue, 15 Oct 2013 23:56:32 +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 5A6EF216B; Tue, 15 Oct 2013 23:56:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9FNuWFw004142; Tue, 15 Oct 2013 23:56:32 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9FNuVCl004136; Tue, 15 Oct 2013 23:56:31 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310152356.r9FNuVCl004136@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 15 Oct 2013 23:56:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256569 - in user/ae/inet6/sys: netinet 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: Tue, 15 Oct 2013 23:56:32 -0000 Author: ae Date: Tue Oct 15 23:56:31 2013 New Revision: 256569 URL: http://svnweb.freebsd.org/changeset/base/256569 Log: Add scope zone id argument to in6_pcblookup_local function. Modified: user/ae/inet6/sys/netinet/in_pcb.c user/ae/inet6/sys/netinet6/in6_pcb.c user/ae/inet6/sys/netinet6/in6_pcb.h Modified: user/ae/inet6/sys/netinet/in_pcb.c ============================================================================== --- user/ae/inet6/sys/netinet/in_pcb.c Tue Oct 15 23:31:08 2013 (r256568) +++ user/ae/inet6/sys/netinet/in_pcb.c Tue Oct 15 23:56:31 2013 (r256569) @@ -448,7 +448,8 @@ in_pcb_lport(struct inpcb *inp, struct i #ifdef INET6 if ((inp->inp_vflag & INP_IPV6) != 0) tmpinp = in6_pcblookup_local(pcbinfo, - &inp->in6p_laddr, lport, lookupflags, cred); + &inp->in6p_laddr, inp->in6p_zoneid, lport, + lookupflags, cred); #endif #if defined(INET) && defined(INET6) else Modified: user/ae/inet6/sys/netinet6/in6_pcb.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6_pcb.c Tue Oct 15 23:31:08 2013 (r256568) +++ user/ae/inet6/sys/netinet6/in6_pcb.c Tue Oct 15 23:56:31 2013 (r256569) @@ -193,8 +193,8 @@ in6_pcbbind(struct inpcb *inp, struct so priv_check_cred(inp->inp_cred, PRIV_NETINET_REUSEPORT, 0) != 0) { t = in6_pcblookup_local(pcbinfo, - &sin6->sin6_addr, lport, - INPLOOKUP_WILDCARD, cred); + &sin6->sin6_addr, sin6->sin6_scope_id, + lport, INPLOOKUP_WILDCARD, cred); if (t && ((t->inp_flags & INP_TIMEWAIT) == 0) && (so->so_type != SOCK_STREAM || @@ -227,7 +227,7 @@ in6_pcbbind(struct inpcb *inp, struct so #endif } t = in6_pcblookup_local(pcbinfo, &sin6->sin6_addr, - lport, lookupflags, cred); + sin6->sin6_scope_id, lport, lookupflags, cred); if (t && (t->inp_flags & INP_TIMEWAIT)) { /* * XXXRW: If an incpb has had its timewait @@ -269,6 +269,7 @@ in6_pcbbind(struct inpcb *inp, struct so #endif } inp->in6p_laddr = sin6->sin6_addr; + inp->in6p_zoneid = sin6->sin6_scope_id; } if (lport == 0) { if ((error = in6_pcbsetport(&inp->in6p_laddr, inp, cred)) != 0) { @@ -676,7 +677,7 @@ in6_pcbnotify(struct inpcbinfo *pcbinfo, */ struct inpcb * in6_pcblookup_local(struct inpcbinfo *pcbinfo, struct in6_addr *laddr, - u_short lport, int lookupflags, struct ucred *cred) + uint32_t zoneid, u_short lport, int lookupflags, struct ucred *cred) { register struct inpcb *inp; int matchwild = 3, wildcard; @@ -700,6 +701,7 @@ in6_pcblookup_local(struct inpcbinfo *pc continue; if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) && IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) && + inp->in6p_zoneid == zoneid && inp->inp_lport == lport) { /* Found. */ if (cred == NULL || @@ -734,7 +736,6 @@ in6_pcblookup_local(struct inpcbinfo *pc * fit. */ LIST_FOREACH(inp, &phd->phd_pcblist, inp_portlist) { - wildcard = 0; if (cred != NULL && !prison_equal_ip6(cred->cr_prison, inp->inp_cred->cr_prison)) @@ -742,6 +743,7 @@ in6_pcblookup_local(struct inpcbinfo *pc /* XXX inp locking */ if ((inp->inp_vflag & INP_IPV6) == 0) continue; + wildcard = 0; if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) wildcard++; if (!IN6_IS_ADDR_UNSPECIFIED( @@ -751,6 +753,8 @@ in6_pcblookup_local(struct inpcbinfo *pc else if (!IN6_ARE_ADDR_EQUAL( &inp->in6p_laddr, laddr)) continue; + else if (inp->in6p_zoneid != zoneid) + continue; } else { if (!IN6_IS_ADDR_UNSPECIFIED(laddr)) wildcard++; Modified: user/ae/inet6/sys/netinet6/in6_pcb.h ============================================================================== --- user/ae/inet6/sys/netinet6/in6_pcb.h Tue Oct 15 23:31:08 2013 (r256568) +++ user/ae/inet6/sys/netinet6/in6_pcb.h Tue Oct 15 23:56:31 2013 (r256569) @@ -87,9 +87,8 @@ int in6_pcbconnect_mbuf(struct inpcb *, struct ucred *, struct mbuf *); void in6_pcbdisconnect(struct inpcb *); struct inpcb * - in6_pcblookup_local(struct inpcbinfo *, - struct in6_addr *, u_short, int, - struct ucred *); + in6_pcblookup_local(struct inpcbinfo *, struct in6_addr *, uint32_t, + u_short, int, struct ucred *); struct inpcb * in6_pcblookup(struct inpcbinfo *, struct in6_addr *, u_int, struct in6_addr *, u_int, int,