Free mtags for dummynet mbuf.
authormarta <marta@8c455092-636d-4788-adf5-e71def0336e8>
Thu, 23 Jul 2009 00:26:19 +0000 (00:26 +0000)
committermarta <marta@8c455092-636d-4788-adf5-e71def0336e8>
Thu, 23 Jul 2009 00:26:19 +0000 (00:26 +0000)
Enable the deallocation code in m_freem().

dummynet/include/sys/mbuf.h
dummynet/ipfw2_mod.c

index e4e7591..a7f95a1 100644 (file)
@@ -143,15 +143,16 @@ m_tag_locate(struct mbuf *m, u_int32_t n, int x, struct m_tag *t)
 static __inline void
 m_freem(struct mbuf *m)
 {
-#if 0
        struct m_tag *t;
 
+       /* free the m_tag chain */
        while ( (t = SLIST_FIRST(&m->m_pkthdr.tags) ) ) {
                SLIST_REMOVE_HEAD(&m->m_pkthdr.tags, m_tag_link);
                free(t, 0);
        }
-#endif
-       free(m, 0);
+
+       /* free the mbuf */
+       free(m, M_IPFW);
 };
 
 /* we cannot pullup */
index ff5a92f..0da1904 100644 (file)
@@ -348,7 +348,7 @@ ipfw2_queue_handler(QH_ARGS)
 
        if (m != NULL) {        /* Accept. reinject and free the mbuf */
                REINJECT(info, NF_STOP);
-               free(m, M_IPFW);
+               m_freem(m);
        } else if (ret == 0) {
                /* dummynet has kept the packet, will reinject later. */
        } else {
@@ -377,7 +377,7 @@ netisr_dispatch(int num, struct mbuf *m)
        struct nf_queue_entry *info = m->queue_entry;
        struct sk_buff *skb = m->m_skb; /* always used */
 
-       free(m, M_IPFW);
+       m_freem(m);
        KASSERT((info != NULL), ("%s info null!\n", __FUNCTION__));
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)       // XXX above 2.6.x ?
        __net_timestamp(skb);   /* update timestamp */