xt_condition with 2.6.19+
PATCH 1/1 xt_condition with 2.6.19+
Hello Massimiliano,
attached is a patch to fix xt_condition with kernel 2.6.19+.
Without the patch the destroy() function never gets executed and so /proc won't be cleaned up. The result is a kernel WARN_ON() during module unload:
BUG: at fs/proc/generic.c:732 remove_proc_entry()
I've copied your 2.6.17 version and made the needed modifications in the new 2.6.19 directory.
Cheers,
Thomas
condition/linux-2.6.19/include/linux/netfilter/xt_condition.h +11 -0
@@ -0,0 +1,11 @@ +#ifndef _XT_CONDITION_H +#define _XT_CONDITION_H + +#define CONDITION_NAME_LEN 32 + +struct condition_info { +char name[CONDITION_NAME_LEN ]; +int invert; +}; + +#endif /* _XT_CONDITION_H */
condition/linux-2.6.19/net/netfilter/Kconfig.ladd +12 -0
@@ -0,0 +1,12 @@ +config NETFILTER_XT_MATCH_CONDITION + tristate '"condition" match support' + depends on NETFILTER_XTABLES + help + This option allows you to match firewall rules against condition + variables stored in the /proc/net/nf_condition directory. + + N.B.: older versions used /proc/net/ipt_condition. You can + reenable it with "compat_dir_name". + + If you want to compile it as a module, say M here and read + Documentation/modules.txt. If unsure, say `N'.
condition/linux-2.6.19/net/netfilter/Makefile.ladd +2 -0
@@ -0,0 +1,2 @@ +obj-$(CONFIG_NETFILTER_XT_MATCH_PHYSDEV) += xt_physdev.o +obj-$(CONFIG_NETFILTER_XT_MATCH_CONDITION) += xt_condition.o
condition/linux-2.6.19/net/netfilter/xt_condition.c +310 -0
310 lines not on this page · raw message
xt_condition.c renamed from xt_condition.c.old +2 -7
@@ -142,8 +142,7 @@static int checkentry (const char *tablename,const void *ip,const struct xt_match *match, -void *matchinfo,unsigned int matchsize, -unsigned int hook_mask) +void *matchinfo,unsigned int hook_mask) {static const char *const forbidden_names[]={"" ,"." ,".." };struct condition_info *info = (struct condition_info *) matchinfo;
@@ -217,15 +216,11 @@static void -destroy (const struct xt_match *match,void *matchinfo, -unsigned int matchsize) +destroy (const struct xt_match *match,void *matchinfo) {struct condition_info *info = (struct condition_info *) matchinfo;struct list_head *pos;struct condition_variable *var; - -if (matchsize !=XT_ALIGN (sizeof (struct condition_info ))) -return ;down (&proc_lock);