From owner-svn-src-user@FreeBSD.ORG Wed Oct 16 09:17:46 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 C56F7FA8; Wed, 16 Oct 2013 09:17:46 +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 99DF92D7E; Wed, 16 Oct 2013 09:17:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9G9Hk7n099870; Wed, 16 Oct 2013 09:17:46 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9G9HktA099869; Wed, 16 Oct 2013 09:17:46 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310160917.r9G9HktA099869@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 16 Oct 2013 09:17:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256605 - 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: Wed, 16 Oct 2013 09:17:46 -0000 Author: ae Date: Wed Oct 16 09:17:46 2013 New Revision: 256605 URL: http://svnweb.freebsd.org/changeset/base/256605 Log: When choosing hop limit, handle link-local destinations specially. Also some style fixes. 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 Wed Oct 16 09:15:07 2013 (r256604) +++ user/ae/inet6/sys/netinet6/in6_src.c Wed Oct 16 09:17:46 2013 (r256605) @@ -1242,35 +1242,41 @@ in6_selectroute_fib(struct sockaddr_in6 * 1. Hoplimit value specified via ioctl. * 2. (If the outgoing interface is detected) the current * hop limit of the interface specified by router advertisement. - * 3. The system default hoplimit. + * 3. If destination address is from link-local scope, use its zoneid + * to determine outgoing interface and use its hop limit. + * 4. The system default hoplimit. */ int in6_selecthlim(struct inpcb *in6p, struct ifnet *ifp) { + struct route_in6 ro6; if (in6p && in6p->in6p_hops >= 0) return (in6p->in6p_hops); - else if (ifp) + + if (ifp != NULL) return (ND_IFINFO(ifp)->chlim); - else if (in6p && !IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr)) { - struct route_in6 ro6; - struct ifnet *lifp; + /* XXX: should we check for multicast here?*/ + if (in6p && IN6_IS_ADDR_LINKLOCAL(&in6p->in6p_faddr)) { + if (in6p->in6p_zoneid != 0 && + (ifp = in6_getlinkifnet(in6p->in6p_zoneid))) + return (ND_IFINFO(ifp)->chlim); + } else if (in6p && !IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr)) { bzero(&ro6, sizeof(ro6)); ro6.ro_dst.sin6_family = AF_INET6; ro6.ro_dst.sin6_len = sizeof(struct sockaddr_in6); ro6.ro_dst.sin6_addr = in6p->in6p_faddr; in6_rtalloc(&ro6, in6p->inp_inc.inc_fibnum); if (ro6.ro_rt) { - lifp = ro6.ro_rt->rt_ifp; + ifp = ro6.ro_rt->rt_ifp; RTFREE(ro6.ro_rt); - if (lifp) - return (ND_IFINFO(lifp)->chlim); + if (ifp) + return (ND_IFINFO(ifp)->chlim); } } return (V_ip6_defhlim); } - /* * XXX: this is borrowed from in6_pcbbind(). If possible, we should * share this function by all *bsd*...