svn commit: r287048 - projects/routing/sys/netinet
Alexander V. Chernikov
melifaro at FreeBSD.org
Sun Aug 23 18:15:59 UTC 2015
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 <netinet/ip_var.h>
#include <netinet/igmp_var.h>
+#include <net/rt_nhops.h>
+
#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;
More information about the svn-src-projects
mailing list