From owner-svn-src-projects@FreeBSD.ORG Thu Oct 23 21:38:55 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 6E74B904; Thu, 23 Oct 2014 21:38:55 +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 5A70F5EA; Thu, 23 Oct 2014 21:38:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NLctre075986; Thu, 23 Oct 2014 21:38:55 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NLctTt075984; Thu, 23 Oct 2014 21:38:55 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410232138.s9NLctTt075984@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Thu, 23 Oct 2014 21:38:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r273560 - 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: Thu, 23 Oct 2014 21:38:55 -0000 Author: melifaro Date: Thu Oct 23 21:38:54 2014 New Revision: 273560 URL: https://svnweb.freebsd.org/changeset/base/273560 Log: Convert inp_lookup_mcast_ifp() to new routing api. Modified: projects/routing/sys/netinet/in_mcast.c Modified: projects/routing/sys/netinet/in_mcast.c ============================================================================== --- projects/routing/sys/netinet/in_mcast.c Thu Oct 23 21:09:14 2014 (r273559) +++ projects/routing/sys/netinet/in_mcast.c Thu Oct 23 21:38:54 2014 (r273560) @@ -62,6 +62,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #ifndef KTR_IGMPV3 #define KTR_IGMPV3 KTR_INET #endif @@ -1877,6 +1879,7 @@ inp_getmoptions(struct inpcb *inp, struc * Returns NULL if no ifp could be found. * * SMPng: TODO: Acquire the appropriate locks for INADDR_TO_IFP. + * TODO: Provide guarantees @ifp won't disappear * FUTURE: Implement IPv4 source-address selection. */ static struct ifnet * @@ -1893,15 +1896,11 @@ inp_lookup_mcast_ifp(const struct inpcb if (!in_nullhost(ina)) { INADDR_TO_IFP(ina, ifp); } else { - struct route ro; - - ro.ro_rt = NULL; - memcpy(&ro.ro_dst, gsin, sizeof(struct sockaddr_in)); - in_rtalloc_ign(&ro, 0, inp ? inp->inp_inc.inc_fibnum : 0); - if (ro.ro_rt != NULL) { - ifp = ro.ro_rt->rt_ifp; - KASSERT(ifp != NULL, ("%s: null ifp", __func__)); - RTFREE(ro.ro_rt); + struct nhop4_basic nh4; + + if (fib4_lookup_nh_basic(inp ? inp->inp_inc.inc_fibnum : 0, + gsin->sin_addr, 0, &nh4) != 0) { + return (nh4.nh_ifp); } else { struct in_ifaddr *ia; struct ifnet *mifp;