Grab the lock before reading uid/gid related structure, this will
[ipfw.git] / dummynet / ip_fw_pfil.c
index bc1f011..4e3568a 100644 (file)
@@ -49,6 +49,7 @@ __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 <netinet/in.h>
 #include <netinet/ip.h>
@@ -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);
        }
@@ -231,6 +236,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);
        }
 
@@ -241,6 +248,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);
        }
@@ -432,8 +441,10 @@ 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;
 }
@@ -447,8 +458,10 @@ 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;
 }
@@ -463,8 +476,10 @@ 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;
 }
@@ -478,8 +493,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;
 }