From: Sepherosa Ziehau Date: Mon, 28 Jul 2008 13:45:43 +0000 (+0000) Subject: Use seperate variable to indicate whether ipfw has been loaded or not, so X-Git-Tag: v2.1.1~756 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/2930a9971d474302845628d59ebef35ece9a5e92 Use seperate variable to indicate whether ipfw has been loaded or not, so that following way could be used to protect various ipfw function pointers: ip_fw_loaded = 0; netmsg_service_sync(); /* clear all ipfw function pointers */ --- diff --git a/sys/net/ipfw/ip_fw2.c b/sys/net/ipfw/ip_fw2.c index c4afd50bdb..5911129ff6 100644 --- a/sys/net/ipfw/ip_fw2.c +++ b/sys/net/ipfw/ip_fw2.c @@ -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.46 2008/07/28 12:35:41 sephe Exp $ + * $DragonFly: src/sys/net/ipfw/ip_fw2.c,v 1.47 2008/07/28 13:45:43 sephe Exp $ */ #define DEB(x) @@ -2948,6 +2948,8 @@ ipfw_init_dispatch(struct netmsg *nmsg) verbose_limit); } callout_init(&ipfw_timeout_h); + + ip_fw_loaded = 1; callout_reset(&ipfw_timeout_h, hz, ipfw_tick, NULL); reply: crit_exit(); @@ -2967,6 +2969,10 @@ ipfw_fini_dispatch(struct netmsg *nmsg) } callout_stop(&ipfw_timeout_h); + + ip_fw_loaded = 0; + netmsg_service_sync(); + ip_fw_chk_ptr = NULL; ip_fw_ctl_ptr = NULL; ip_fw_dn_io_ptr = NULL; diff --git a/sys/net/ipfw/ip_fw2.h b/sys/net/ipfw/ip_fw2.h index 5a9337040d..8def52f2e6 100644 --- a/sys/net/ipfw/ip_fw2.h +++ b/sys/net/ipfw/ip_fw2.h @@ -23,7 +23,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netinet/ip_fw2.h,v 1.1.2.2 2002/08/16 11:03:11 luigi Exp $ - * $DragonFly: src/sys/net/ipfw/ip_fw2.h,v 1.8 2007/11/16 02:45:45 sephe Exp $ + * $DragonFly: src/sys/net/ipfw/ip_fw2.h,v 1.9 2008/07/28 13:45:43 sephe Exp $ */ #ifndef _IPFW2_H @@ -383,7 +383,9 @@ extern ip_fw_dn_io_t *ip_fw_dn_io_ptr; extern int fw_one_pass; extern int fw_enable; -#define IPFW_LOADED (ip_fw_chk_ptr != NULL) + +extern int ip_fw_loaded; +#define IPFW_LOADED (ip_fw_loaded) #endif /* _KERNEL */ diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 88e3ef8573..71826e46d6 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -65,7 +65,7 @@ * * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 * $FreeBSD: src/sys/netinet/ip_input.c,v 1.130.2.52 2003/03/07 07:01:28 silby Exp $ - * $DragonFly: src/sys/netinet/ip_input.c,v 1.83 2008/07/27 10:06:57 sephe Exp $ + * $DragonFly: src/sys/netinet/ip_input.c,v 1.84 2008/07/28 13:45:43 sephe Exp $ */ #define _IP_VHL @@ -260,6 +260,7 @@ static const int ipstealth = 0; /* Firewall hooks */ ip_fw_chk_t *ip_fw_chk_ptr; ip_fw_dn_io_t *ip_fw_dn_io_ptr; +int ip_fw_loaded; int fw_enable = 1; int fw_one_pass = 1;