We always wait during pfil hook's adding and removing; we could not afford
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 15 Sep 2008 05:11:02 +0000 (05:11 +0000)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 15 Sep 2008 05:11:02 +0000 (05:11 +0000)
to fail upon these operations.

sys/net/ipfw/ip_fw2.c
sys/net/pf/pf_ioctl.c
sys/net/pfil.h

index 2f25eae..c5de1f0 100644 (file)
@@ -23,7 +23,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/netinet/ip_fw2.c,v 1.6.2.12 2003/04/08 10:42:32 maxim Exp $
- * $DragonFly: src/sys/net/ipfw/ip_fw2.c,v 1.83 2008/09/13 12:57:07 sephe Exp $
+ * $DragonFly: src/sys/net/ipfw/ip_fw2.c,v 1.84 2008/09/15 05:11:02 sephe Exp $
  */
 
 #define        DEB(x)
@@ -4185,8 +4185,8 @@ ipfw_hook(void)
        if (pfh == NULL)
                return;
 
-       pfil_add_hook(ipfw_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh);
-       pfil_add_hook(ipfw_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh);
+       pfil_add_hook(ipfw_check_in, NULL, PFIL_IN, pfh);
+       pfil_add_hook(ipfw_check_out, NULL, PFIL_OUT, pfh);
 }
 
 static void
@@ -4200,8 +4200,8 @@ ipfw_dehook(void)
        if (pfh == NULL)
                return;
 
-       pfil_remove_hook(ipfw_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh);
-       pfil_remove_hook(ipfw_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh);
+       pfil_remove_hook(ipfw_check_in, NULL, PFIL_IN, pfh);
+       pfil_remove_hook(ipfw_check_out, NULL, PFIL_OUT, pfh);
 }
 
 static void
index 801a6f7..1752735 100644 (file)
@@ -1,6 +1,6 @@
 /*     $FreeBSD: src/sys/contrib/pf/net/pf_ioctl.c,v 1.12 2004/08/12 14:15:42 mlaier Exp $     */
 /*     $OpenBSD: pf_ioctl.c,v 1.112.2.2 2004/07/24 18:28:12 brad Exp $ */
-/*     $DragonFly: src/sys/net/pf/pf_ioctl.c,v 1.14 2008/04/11 18:21:48 dillon Exp $ */
+/*     $DragonFly: src/sys/net/pf/pf_ioctl.c,v 1.15 2008/09/15 05:11:02 sephe Exp $ */
 
 /*
  * Copyright (c) 2004 The DragonFly Project.  All rights reserved.
@@ -3012,19 +3012,17 @@ hook_pf(void)
        pfh_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET);
        if (pfh_inet == NULL)
                return (ENODEV);
-       pfil_add_hook(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet);
-       pfil_add_hook(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet);
+       pfil_add_hook(pf_check_in, NULL, PFIL_IN, pfh_inet);
+       pfil_add_hook(pf_check_out, NULL, PFIL_OUT, pfh_inet);
 #ifdef INET6
        pfh_inet6 = pfil_head_get(PFIL_TYPE_AF, AF_INET6);
        if (pfh_inet6 == NULL) {
-               pfil_remove_hook(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK,
-                   pfh_inet);
-               pfil_remove_hook(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK,
-                   pfh_inet);
+               pfil_remove_hook(pf_check_in, NULL, PFIL_IN, pfh_inet);
+               pfil_remove_hook(pf_check_out, NULL, PFIL_OUT, pfh_inet);
                return (ENODEV);
        }
-       pfil_add_hook(pf_check6_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet6);
-       pfil_add_hook(pf_check6_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet6);
+       pfil_add_hook(pf_check6_in, NULL, PFIL_IN, pfh_inet6);
+       pfil_add_hook(pf_check6_out, NULL, PFIL_OUT, pfh_inet6);
 #endif
 
        pf_pfil_hooked = 1;
@@ -3045,18 +3043,14 @@ dehook_pf(void)
        pfh_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET);
        if (pfh_inet == NULL)
                return (ENODEV);
-       pfil_remove_hook(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK,
-           pfh_inet);
-       pfil_remove_hook(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK,
-           pfh_inet);
+       pfil_remove_hook(pf_check_in, NULL, PFIL_IN, pfh_inet);
+       pfil_remove_hook(pf_check_out, NULL, PFIL_OUT, pfh_inet);
 #ifdef INET6
        pfh_inet6 = pfil_head_get(PFIL_TYPE_AF, AF_INET6);
        if (pfh_inet6 == NULL)
                return (ENODEV);
-       pfil_remove_hook(pf_check6_in, NULL, PFIL_IN | PFIL_WAITOK,
-           pfh_inet6);
-       pfil_remove_hook(pf_check6_out, NULL, PFIL_OUT | PFIL_WAITOK,
-           pfh_inet6);
+       pfil_remove_hook(pf_check6_in, NULL, PFIL_IN, pfh_inet6);
+       pfil_remove_hook(pf_check6_out, NULL, PFIL_OUT, pfh_inet6);
 #endif
 
        pf_pfil_hooked = 0;
index fe5219c..a028e65 100644 (file)
@@ -1,5 +1,5 @@
 /*     $NetBSD: pfil.h,v 1.22 2003/06/23 12:57:08 martin Exp $ */
-/* $DragonFly: src/sys/net/pfil.h,v 1.8 2008/09/14 11:13:00 sephe Exp $ */
+/* $DragonFly: src/sys/net/pfil.h,v 1.9 2008/09/15 05:11:02 sephe Exp $ */
 
 /*
  * Copyright (c) 1996 Matthew R. Green
@@ -60,7 +60,6 @@ struct packet_filter_hook {
 
 #define PFIL_IN                0x00000001
 #define PFIL_OUT       0x00000002
-#define PFIL_WAITOK    0x00000004
 #define PFIL_ALL       (PFIL_IN|PFIL_OUT)
 
 typedef        TAILQ_HEAD(pfil_list, packet_filter_hook) pfil_list_t;