Hi,

In pf_refragment6() use the valid route from pf_route6() instead
of calling rtalloc() again.

ok?

bluhm

Index: net/pf.c
===================================================================
RCS file: /cvs/src/sys/net/pf.c,v
retrieving revision 1.1008
diff -u -p -r1.1008 pf.c
--- net/pf.c    28 Dec 2016 15:36:15 -0000      1.1008
+++ net/pf.c    28 Dec 2016 15:51:35 -0000
@@ -6003,7 +6003,7 @@ pf_route6(struct pf_pdesc *pd, struct pf
         * use pf_refragment6() here to turn it back to fragments.
         */
        if ((mtag = m_tag_find(m0, PACKET_TAG_PF_REASSEMBLED, NULL))) {
-               (void) pf_refragment6(&m0, mtag, dst, ifp);
+               (void) pf_refragment6(&m0, mtag, dst, ifp, rt);
        } else if ((u_long)m0->m_pkthdr.len <= ifp->if_mtu) {
                ifp->if_output(ifp, m0, sin6tosa(dst), rt);
        } else {
@@ -6925,7 +6925,7 @@ done:
                struct m_tag    *mtag;
 
                if ((mtag = m_tag_find(pd.m, PACKET_TAG_PF_REASSEMBLED, NULL)))
-                       action = pf_refragment6(&pd.m, mtag, NULL, NULL);
+                       action = pf_refragment6(&pd.m, mtag, NULL, NULL, NULL);
        }
 #endif /* INET6 */
        if (s && action != PF_DROP) {
Index: net/pf_norm.c
===================================================================
RCS file: /cvs/src/sys/net/pf_norm.c,v
retrieving revision 1.197
diff -u -p -r1.197 pf_norm.c
--- net/pf_norm.c       22 Nov 2016 19:29:54 -0000      1.197
+++ net/pf_norm.c       28 Dec 2016 15:51:35 -0000
@@ -687,11 +687,10 @@ fail:
 
 int
 pf_refragment6(struct mbuf **m0, struct m_tag *mtag, struct sockaddr_in6 *dst,
-    struct ifnet *ifp)
+    struct ifnet *ifp, struct rtentry *rt)
 {
        struct mbuf             *m = *m0, *t;
        struct pf_fragment_tag  *ftag = (struct pf_fragment_tag *)(mtag + 1);
-       struct rtentry          *rt = NULL;
        u_int32_t                mtu;
        u_int16_t                hdrlen, extoff, maxlen;
        u_int8_t                 proto;
@@ -748,15 +747,6 @@ pf_refragment6(struct mbuf **m0, struct 
                action = PF_DROP;
        }
 
-       if (ifp != NULL) {
-               rt = rtalloc(sin6tosa(dst), RT_RESOLVE,
-                   m->m_pkthdr.ph_rtableid);
-               if (rt == NULL) {
-                       ip6stat.ip6s_noroute++;
-                       error = -1;
-               }
-       }
-
        for (t = m; m; m = t) {
                t = m->m_nextpkt;
                m->m_nextpkt = NULL;
@@ -774,7 +764,6 @@ pf_refragment6(struct mbuf **m0, struct 
                        m_freem(m);
                }
        }
-       rtfree(rt);
 
        return (action);
 }
Index: net/pfvar.h
===================================================================
RCS file: /cvs/src/sys/net/pfvar.h,v
retrieving revision 1.445
diff -u -p -r1.445 pfvar.h
--- net/pfvar.h 22 Nov 2016 19:29:54 -0000      1.445
+++ net/pfvar.h 28 Dec 2016 15:51:36 -0000
@@ -1681,7 +1681,7 @@ int       pf_match_uid(u_int8_t, uid_t, uid_t,
 int    pf_match_gid(u_int8_t, gid_t, gid_t, gid_t);
 
 int    pf_refragment6(struct mbuf **, struct m_tag *mtag,
-           struct sockaddr_in6 *, struct ifnet *);
+           struct sockaddr_in6 *, struct ifnet *, struct rtentry *);
 void   pf_normalize_init(void);
 int    pf_normalize_ip(struct pf_pdesc *, u_short *);
 int    pf_normalize_ip6(struct pf_pdesc *, u_short *);

Reply via email to