From owner-svn-src-user@FreeBSD.ORG Tue Jan 29 19:59:57 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]) by hub.freebsd.org (Postfix) with ESMTP id 531A6251; Tue, 29 Jan 2013 19:59:57 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2404C2ED; Tue, 29 Jan 2013 19:59:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0TJxvpl031754; Tue, 29 Jan 2013 19:59:57 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0TJxvV8031752; Tue, 29 Jan 2013 19:59:57 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201301291959.r0TJxvV8031752@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 29 Jan 2013 19:59:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246089 - 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: Tue, 29 Jan 2013 19:59:57 -0000 Author: ae Date: Tue Jan 29 19:59:56 2013 New Revision: 246089 URL: http://svnweb.freebsd.org/changeset/base/246089 Log: Change the first part of in6_selectsrc to not use in6_setscope. Modified: user/ae/inet6/sys/netinet6/in6_src.c Modified: user/ae/inet6/sys/netinet6/in6_src.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6_src.c Tue Jan 29 19:55:53 2013 (r246088) +++ user/ae/inet6/sys/netinet6/in6_src.c Tue Jan 29 19:59:56 2013 (r246089) @@ -225,7 +225,6 @@ in6_selectsrc(struct sockaddr_in6 *dstso */ if (opts && (pi = opts->ip6po_pktinfo) && !IN6_IS_ADDR_UNSPECIFIED(&pi->ipi6_addr)) { - struct sockaddr_in6 srcsock; struct in6_ifaddr *ia6; /* get the outgoing interface */ @@ -233,37 +232,27 @@ in6_selectsrc(struct sockaddr_in6 *dstso (inp != NULL) ? inp->inp_inc.inc_fibnum : RT_DEFAULT_FIB)) != 0) return (error); - + KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); /* - * determine the appropriate zone id of the source based on + * Determine the appropriate zone id of the source based on * the zone of the destination and the outgoing interface. - * If the specified address is ambiguous wrt the scope zone, - * the interface must be specified; otherwise, ifa_ifwithaddr() - * will fail matching the address. - */ - bzero(&srcsock, sizeof(srcsock)); - srcsock.sin6_family = AF_INET6; - srcsock.sin6_len = sizeof(srcsock); - srcsock.sin6_addr = pi->ipi6_addr; - if (ifp) { - error = in6_setscope(&srcsock.sin6_addr, ifp, NULL); - if (error) - return (error); - } + */ + odstzone = in6_getscopezone(ifp, + in6_addrscope(&pi->ipi6_addr)); + + /* XXX: prison_local_ip6 can override pi->ipi6_addr */ if (cred != NULL && (error = prison_local_ip6(cred, - &srcsock.sin6_addr, (inp != NULL && + &pi->ipi6_addr, (inp != NULL && (inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0) return (error); - ia6 = (struct in6_ifaddr *)ifa_ifwithaddr( - (struct sockaddr *)&srcsock); + ia6 = in6ifa_ifwithaddr(&pi->ipi6_addr, odstzone); if (ia6 == NULL || (ia6->ia6_flags & (IN6_IFF_ANYCAST | IN6_IFF_NOTREADY))) { if (ia6 != NULL) ifa_free(&ia6->ia_ifa); return (EADDRNOTAVAIL); } - pi->ipi6_addr = srcsock.sin6_addr; /* XXX: this overrides pi */ if (ifpp) *ifpp = ifp; bcopy(&ia6->ia_addr.sin6_addr, srcp, sizeof(*srcp));