From owner-svn-src-projects@freebsd.org Sun Aug 23 18:15:59 2015 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D7479C176C for ; Sun, 23 Aug 2015 18:15:59 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.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 3E6611E5C; Sun, 23 Aug 2015 18:15:59 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7NIFxsR042307; Sun, 23 Aug 2015 18:15:59 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7NIFxhR042306; Sun, 23 Aug 2015 18:15:59 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201508231815.t7NIFxhR042306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 23 Aug 2015 18:15:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r287048 - 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.20 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: Sun, 23 Aug 2015 18:15:59 -0000 Author: melifaro Date: Sun Aug 23 18:15:58 2015 New Revision: 287048 URL: https://svnweb.freebsd.org/changeset/base/287048 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 Sun Aug 23 18:15:18 2015 (r287047) +++ projects/routing/sys/netinet/in_mcast.c Sun Aug 23 18:15:58 2015 (r287048) @@ -64,6 +64,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #ifndef KTR_IGMPV3 #define KTR_IGMPV3 KTR_INET #endif @@ -1875,6 +1877,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 * @@ -1892,15 +1895,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;