Update the work on ipfw tables, reduce diffs.
[ipfw.git] / dummynet / ip_fw_pfil.c
index 9d65e7f..3fa643c 100644 (file)
@@ -49,6 +49,9 @@ __FBSDID("$FreeBSD: src/sys/netinet/ip_fw_pfil.c,v 1.25.2.2 2008/04/25 10:26:30
 
 #include <net/if.h>
 #include <net/pfil.h>
+#include <net/vnet.h>
+
+#include "missing.h"
 
 #include <netinet/in.h>
 #include <netinet/ip.h>
@@ -61,11 +64,9 @@ __FBSDID("$FreeBSD: src/sys/netinet/ip_fw_pfil.c,v 1.25.2.2 2008/04/25 10:26:30
 
 #include <machine/in_cksum.h>
 
-#include "missing.h"
-
-int fw_enable = 1;
+VNET_DEFINE(int, fw_enable) = 1;
 #ifdef INET6
-int fw6_enable = 1;
+VNET_DEFINE(int, fw6_enable) = 1;
 #endif
 
 int ipfw_chg_hook(SYSCTL_HANDLER_ARGS);
@@ -105,6 +106,8 @@ ipfw_check_in(void *arg, struct mbuf **m0, struct ifnet *ifp, int dir,
                KASSERT(ng_tag->dir == NG_IPFW_IN,
                    ("ng_ipfw tag with wrong direction"));
                args.rule = ng_tag->rule;
+               args.rule_id = ng_tag->rule_id;
+               args.chain_id = ng_tag->chain_id;
                m_tag_delete(*m0, (struct m_tag *)ng_tag);
        }
 
@@ -115,6 +118,8 @@ again:
 
                dt = (struct dn_pkt_tag *)(dn_tag+1);
                args.rule = dt->rule;
+               args.rule_id = dt->rule_id;
+               args.chain_id = dt->chain_id;
 
                m_tag_delete(*m0, dn_tag);
        }
@@ -230,6 +235,8 @@ ipfw_check_out(void *arg, struct mbuf **m0, struct ifnet *ifp, int dir,
                KASSERT(ng_tag->dir == NG_IPFW_OUT,
                    ("ng_ipfw tag with wrong direction"));
                args.rule = ng_tag->rule;
+               args.rule_id = ng_tag->rule_id;
+               args.chain_id = ng_tag->chain_id;
                m_tag_delete(*m0, (struct m_tag *)ng_tag);
        }
 
@@ -240,6 +247,8 @@ again:
 
                dt = (struct dn_pkt_tag *)(dn_tag+1);
                args.rule = dt->rule;
+               args.rule_id = dt->rule_id;
+               args.chain_id = dt->chain_id;
 
                m_tag_delete(*m0, dn_tag);
        }
@@ -422,7 +431,7 @@ nodivert:
        return 1;
 }
 
-static int
+int
 ipfw_hook(void)
 {
        struct pfil_head *pfh_inet;
@@ -431,13 +440,15 @@ ipfw_hook(void)
        if (pfh_inet == NULL)
                return ENOENT;
 
-       pfil_add_hook(ipfw_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet);
-       pfil_add_hook(ipfw_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet);
+       (void)pfil_add_hook(ipfw_check_in, NULL, PFIL_IN | PFIL_WAITOK,
+               pfh_inet);
+       (void)pfil_add_hook(ipfw_check_out, NULL, PFIL_OUT | PFIL_WAITOK,
+               pfh_inet);
 
        return 0;
 }
 
-static int
+int
 ipfw_unhook(void)
 {
        struct pfil_head *pfh_inet;
@@ -446,14 +457,16 @@ ipfw_unhook(void)
        if (pfh_inet == NULL)
                return ENOENT;
 
-       pfil_remove_hook(ipfw_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet);
-       pfil_remove_hook(ipfw_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet);
+       (void)pfil_remove_hook(ipfw_check_in, NULL, PFIL_IN | PFIL_WAITOK,
+               pfh_inet);
+       (void)pfil_remove_hook(ipfw_check_out, NULL, PFIL_OUT | PFIL_WAITOK,
+               pfh_inet);
 
        return 0;
 }
 
 #ifdef INET6
-static int
+int
 ipfw6_hook(void)
 {
        struct pfil_head *pfh_inet6;
@@ -462,13 +475,15 @@ ipfw6_hook(void)
        if (pfh_inet6 == NULL)
                return ENOENT;
 
-       pfil_add_hook(ipfw_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet6);
-       pfil_add_hook(ipfw_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet6);
+       (void)pfil_add_hook(ipfw_check_in, NULL, PFIL_IN | PFIL_WAITOK,
+               pfh_inet6);
+       (void)pfil_add_hook(ipfw_check_out, NULL, PFIL_OUT | PFIL_WAITOK,
+               pfh_inet6);
 
        return 0;
 }
 
-static int
+int
 ipfw6_unhook(void)
 {
        struct pfil_head *pfh_inet6;
@@ -477,8 +492,10 @@ ipfw6_unhook(void)
        if (pfh_inet6 == NULL)
                return ENOENT;
 
-       pfil_remove_hook(ipfw_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet6);
-       pfil_remove_hook(ipfw_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet6);
+       (void)pfil_remove_hook(ipfw_check_in, NULL, PFIL_IN | PFIL_WAITOK,
+               pfh_inet6);
+       (void)pfil_remove_hook(ipfw_check_out, NULL, PFIL_OUT | PFIL_WAITOK,
+               pfh_inet6);
 
        return 0;
 }