Author: melifaro
Date: Wed Dec 16 09:18:20 2015
New Revision: 292331
URL: https://svnweb.freebsd.org/changeset/base/292331

Log:
  Convert if_stf(4) to new routing api.

Modified:
  head/sys/net/if_stf.c

Modified: head/sys/net/if_stf.c
==============================================================================
--- head/sys/net/if_stf.c       Wed Dec 16 09:17:07 2015        (r292330)
+++ head/sys/net/if_stf.c       Wed Dec 16 09:18:20 2015        (r292331)
@@ -101,6 +101,7 @@
 #include <net/vnet.h>
 
 #include <netinet/in.h>
+#include <netinet/in_fib.h>
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
 #include <netinet/ip_var.h>
@@ -557,26 +558,13 @@ stf_checkaddr4(struct stf_softc *sc, str
         * perform ingress filter
         */
        if (sc && (STF2IFP(sc)->if_flags & IFF_LINK2) == 0 && inifp) {
-               struct sockaddr_in sin;
-               struct rtentry *rt;
+               struct nhop4_basic nh4;
 
-               bzero(&sin, sizeof(sin));
-               sin.sin_family = AF_INET;
-               sin.sin_len = sizeof(struct sockaddr_in);
-               sin.sin_addr = *in;
-               rt = rtalloc1_fib((struct sockaddr *)&sin, 0,
-                   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);
+               if (fib4_lookup_nh_basic(sc->sc_fibnum, *in, 0, 0, &nh4) != 0)
+                       return (-1);
+
+               if (nh4.nh_ifp != inifp)
+                       return (-1);
        }
 
        return 0;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to