This repo is obsolete, please see git://git.code.sf.net/p/dummynet/code@master
[ipfw.git] / dummynet2 / ip_fw_table.c
index 8cbf457..d8973d5 100644 (file)
@@ -64,7 +64,9 @@ __FBSDID("$FreeBSD: head/sys/netinet/ipfw/ip_fw_table.c 200601 2009-12-16 10:48:
 #include <net/vnet.h>
 
 #include <netinet/in.h>
+#include <netinet/ip_var.h>    /* struct ipfw_rule_ref */
 #include <netinet/ip_fw.h>
+#include <sys/queue.h> /* LIST_HEAD */
 #include <netinet/ipfw/ip_fw_private.h>
 
 #ifdef MAC
@@ -174,14 +176,18 @@ ipfw_flush_table(struct ip_fw_chain *ch, uint16_t tbl)
 }
 
 void
-ipfw_flush_tables(struct ip_fw_chain *ch)
+ipfw_destroy_tables(struct ip_fw_chain *ch)
 {
        uint16_t tbl;
+       struct radix_node_head *rnh;
 
        IPFW_WLOCK_ASSERT(ch);
 
-       for (tbl = 0; tbl < IPFW_TABLES_MAX; tbl++)
+       for (tbl = 0; tbl < IPFW_TABLES_MAX; tbl++) {
                ipfw_flush_table(ch, tbl);
+               rnh = ch->tables[tbl];
+               rn_detachhead((void **)&rnh);
+       }
 }
 
 int