From owner-svn-src-projects@FreeBSD.ORG Tue Nov 4 17:01:41 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 595AF8AF; Tue, 4 Nov 2014 17:01:41 +0000 (UTC) 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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B6A1E05; Tue, 4 Nov 2014 17:01:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA4H1f2v088579; Tue, 4 Nov 2014 17:01:41 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA4H1fNY088578; Tue, 4 Nov 2014 17:01:41 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201411041701.sA4H1fNY088578@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Tue, 4 Nov 2014 17:01:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r274093 - projects/routing/sys/netinet X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Nov 2014 17:01:41 -0000 Author: melifaro Date: Tue Nov 4 17:01:40 2014 New Revision: 274093 URL: https://svnweb.freebsd.org/changeset/base/274093 Log: Convert tcp_maxmtu6() to use new routing api. Modified: projects/routing/sys/netinet/tcp_subr.c Modified: projects/routing/sys/netinet/tcp_subr.c ============================================================================== --- projects/routing/sys/netinet/tcp_subr.c Tue Nov 4 16:35:56 2014 (r274092) +++ projects/routing/sys/netinet/tcp_subr.c Tue Nov 4 17:01:40 2014 (r274093) @@ -1829,39 +1829,36 @@ tcp_maxmtu(struct in_conninfo *inc, stru u_long tcp_maxmtu6(struct in_conninfo *inc, struct tcp_ifcap *cap) { - struct route_in6 sro6; struct ifnet *ifp; + struct nhop6_extended nh_ext; + struct in6_addr dst; + uint32_t scopeid; + uint32_t fibnum; u_long maxmtu = 0; KASSERT(inc != NULL, ("tcp_maxmtu6 with NULL in_conninfo pointer")); - bzero(&sro6, sizeof(sro6)); - if (!IN6_IS_ADDR_UNSPECIFIED(&inc->inc6_faddr)) { - sro6.ro_dst.sin6_family = AF_INET6; - sro6.ro_dst.sin6_len = sizeof(struct sockaddr_in6); - sro6.ro_dst.sin6_addr = inc->inc6_faddr; - in6_rtalloc_ign(&sro6, 0, inc->inc_fibnum); - } - if (sro6.ro_rt != NULL) { - ifp = sro6.ro_rt->rt_ifp; - if (sro6.ro_rt->rt_mtu == 0) - maxmtu = IN6_LINKMTU(sro6.ro_rt->rt_ifp); - else - maxmtu = min(sro6.ro_rt->rt_mtu, - IN6_LINKMTU(sro6.ro_rt->rt_ifp)); - - /* Report additional interface capabilities. */ - if (cap != NULL) { - if (ifp->if_capenable & IFCAP_TSO6 && - ifp->if_hwassist & CSUM_TSO) { - cap->ifcap |= CSUM_TSO; - cap->tsomax = ifp->if_hw_tsomax; - cap->tsomaxsegcount = ifp->if_hw_tsomaxsegcount; - cap->tsomaxsegsize = ifp->if_hw_tsomaxsegsize; - } + in6_splitscope(&inc->inc6_faddr, &dst, &scopeid); + fibnum = inc->inc_fibnum; + + if (fib6_lookup_nh_ext(fibnum, &dst, scopeid, 0, + NHOP_LOOKUP_REF, &nh_ext) != 0) + return (0); + + maxmtu = nh_ext.nh_mtu; + ifp = nh_ext.nh_ifp; + + /* Report additional interface capabilities. */ + if (cap != NULL) { + if (ifp->if_capenable & IFCAP_TSO6 && + ifp->if_hwassist & CSUM_TSO) { + cap->ifcap |= CSUM_TSO; + cap->tsomax = ifp->if_hw_tsomax; + cap->tsomaxsegcount = ifp->if_hw_tsomaxsegcount; + cap->tsomaxsegsize = ifp->if_hw_tsomaxsegsize; } - RTFREE(sro6.ro_rt); } + fib6_free_nh_ext(fibnum, &nh_ext); return (maxmtu); }