Convert if_stf(4) to new routing api.

This commit is contained in:
melifaro 2015-12-16 09:18:20 +00:00
parent f487c94c08
commit 2d94c81db6

View File

@ -101,6 +101,7 @@
#include <net/vnet.h> #include <net/vnet.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/in_fib.h>
#include <netinet/in_systm.h> #include <netinet/in_systm.h>
#include <netinet/ip.h> #include <netinet/ip.h>
#include <netinet/ip_var.h> #include <netinet/ip_var.h>
@ -557,26 +558,13 @@ stf_checkaddr4(struct stf_softc *sc, struct in_addr *in, struct ifnet *inifp)
* perform ingress filter * perform ingress filter
*/ */
if (sc && (STF2IFP(sc)->if_flags & IFF_LINK2) == 0 && inifp) { if (sc && (STF2IFP(sc)->if_flags & IFF_LINK2) == 0 && inifp) {
struct sockaddr_in sin; struct nhop4_basic nh4;
struct rtentry *rt;
bzero(&sin, sizeof(sin)); if (fib4_lookup_nh_basic(sc->sc_fibnum, *in, 0, 0, &nh4) != 0)
sin.sin_family = AF_INET; return (-1);
sin.sin_len = sizeof(struct sockaddr_in);
sin.sin_addr = *in; if (nh4.nh_ifp != inifp)
rt = rtalloc1_fib((struct sockaddr *)&sin, 0, return (-1);
0UL, sc->sc_fibnum);
if (!rt || rt->rt_ifp != inifp) {
#if 0
log(LOG_WARNING, "%s: packet from 0x%x dropped "
"due to ingress filter\n", if_name(STF2IFP(sc)),
(u_int32_t)ntohl(sin.sin_addr.s_addr));
#endif
if (rt)
RTFREE_LOCKED(rt);
return -1;
}
RTFREE_LOCKED(rt);
} }
return 0; return 0;