priv_data 1/2
Subsystems (2)
PATCH 1/1 priv_data 1/2
Hi,
this is the first part. Modifications to the core netfilter code.
Signature · 2 lines
Saluti, Massimiliano Hofer
include/linux/netfilter/x_tables.h +30 -18
@@ -20,6 +20,7 @@/* Used inside the kernel */ struct xt_match *match; +void *priv_data; } kernel;/* Total length */
@@ -45,6 +46,7 @@/* Used inside the kernel */ struct xt_target *target; +void *priv_data; } kernel;/* Total length */
@@ -166,20 +168,22 @@const void *matchinfo, int offset, unsigned int protoff, - int *hotdrop); + int *hotdrop, + void *priv_data);/* Called when user tries to insert an entry of this type. */ /* Should return true or false. */ -int (*checkentry)(const char *tablename, -const void *ip, -const struct xt_match *match, -void *matchinfo, -unsigned int matchinfosize, -unsigned int hook_mask); +int (*init)(const char *tablename, +const void *ip, +const struct xt_match *match, +void *matchinfo, +unsigned int matchinfosize, +unsigned int hook_mask, +void *priv_data);/* Called when entry of this type deleted. */ void (*destroy)(const struct xt_match *match,void *matchinfo, -unsigned int matchinfosize); +unsigned int matchinfosize,void *priv_data);/* Called when userspace align differs from kernel space one */ int (*compat)(void *match,void **dstptr,int *size,int convert);
@@ -189,6 +193,7 @@char *table;unsigned int matchsize; +size_t priv_size;unsigned int hooks;unsigned short proto;
@@ -212,22 +217,24 @@unsigned int hooknum, const struct xt_target *target, const void *targinfo, - void *userdata); + void *userdata, + void *priv_data);/* Called when user tries to insert an entry of this type: hook_mask is a bitmask of hooks from which it can be called. */ /* Should return true or false. */ -int (*checkentry)(const char *tablename, +int (*init)(const char *tablename,const void *entry,const struct xt_target *target,void *targinfo,unsigned int targinfosize, -unsigned int hook_mask); +unsigned int hook_mask, +void *priv_data);/* Called when entry of this type deleted. */ void (*destroy)(const struct xt_target *target,void *targinfo, -unsigned int targinfosize); +unsigned int targinfosize,void *priv_data);/* Called when userspace align differs from kernel space one */ int (*compat)(void *target,void **dstptr,int *size,int convert);
@@ -237,6 +244,7 @@char *table;unsigned int targetsize; +size_t priv_size;unsigned int hooks;unsigned short proto;
@@ -293,12 +301,16 @@extern int xt_register_match (struct xt_match *target);extern void xt_unregister_match (struct xt_match *target); -extern int xt_check_match (const struct xt_match *match,unsigned short family, -unsigned int size,const char *table,unsigned int hook, -unsigned short proto,int inv_proto); -extern int xt_check_target (const struct xt_target *target,unsigned short family, -unsigned int size,const char *table,unsigned int hook, -unsigned short proto,int inv_proto); +extern int xt_init_match (struct xt_entry_match *m,char *module_prefix, +unsigned short family,const char *table, +unsigned int hook_mask,unsigned short proto, +int inv_proto); +extern void xt_destroy_match (struct xt_entry_match *m); +extern int xt_init_target (struct xt_entry_target *t,char *module_prefix, +unsigned short family,const char *table, +unsigned int hook_mask,unsigned short proto, +int inv_proto); +extern void xt_destroy_target (struct xt_entry_target *t); extern int xt_register_table(struct xt_table *table, struct xt_table_info *bootstrap,
net/ipv4/netfilter/arp_tables.c +22 -29
102 lines not on this page · raw message
net/ipv4/netfilter/ip_tables.c +58 -72
245 lines not on this page · raw message
net/ipv6/netfilter/ip6_tables.c +49 -63
219 lines not on this page · raw message
net/netfilter/x_tables.c +86 -9
124 lines not on this page · raw message
Hi,
I had the opportunity to test the patch on a x86_64 CPU and found that my previous version didn't even compile.
This one compiles and survives a quick test. The second part of the patch remains unmodified.
Signature · 2 lines
Bye, Massimiliano Hofer
include/linux/netfilter/x_tables.h +30 -18
@@ -20,6 +20,7 @@/* Used inside the kernel */ struct xt_match *match; +void *priv_data; } kernel;/* Total length */
@@ -45,6 +46,7 @@/* Used inside the kernel */ struct xt_target *target; +void *priv_data; } kernel;/* Total length */
@@ -166,20 +168,22 @@const void *matchinfo, int offset, unsigned int protoff, - int *hotdrop); + int *hotdrop, + void *priv_data);/* Called when user tries to insert an entry of this type. */ /* Should return true or false. */ -int (*checkentry)(const char *tablename, -const void *ip, -const struct xt_match *match, -void *matchinfo, -unsigned int matchinfosize, -unsigned int hook_mask); +int (*init)(const char *tablename, +const void *ip, +const struct xt_match *match, +void *matchinfo, +unsigned int matchinfosize, +unsigned int hook_mask, +void *priv_data);/* Called when entry of this type deleted. */ void (*destroy)(const struct xt_match *match,void *matchinfo, -unsigned int matchinfosize); +unsigned int matchinfosize,void *priv_data);/* Called when userspace align differs from kernel space one */ int (*compat)(void *match,void **dstptr,int *size,int convert);
@@ -189,6 +193,7 @@char *table;unsigned int matchsize; +size_t priv_size;unsigned int hooks;unsigned short proto;
@@ -212,22 +217,24 @@unsigned int hooknum, const struct xt_target *target, const void *targinfo, - void *userdata); + void *userdata, + void *priv_data);/* Called when user tries to insert an entry of this type: hook_mask is a bitmask of hooks from which it can be called. */ /* Should return true or false. */ -int (*checkentry)(const char *tablename, +int (*init)(const char *tablename,const void *entry,const struct xt_target *target,void *targinfo,unsigned int targinfosize, -unsigned int hook_mask); +unsigned int hook_mask, +void *priv_data);/* Called when entry of this type deleted. */ void (*destroy)(const struct xt_target *target,void *targinfo, -unsigned int targinfosize); +unsigned int targinfosize,void *priv_data);/* Called when userspace align differs from kernel space one */ int (*compat)(void *target,void **dstptr,int *size,int convert);
@@ -237,6 +244,7 @@char *table;unsigned int targetsize; +size_t priv_size;unsigned int hooks;unsigned short proto;
@@ -293,12 +301,16 @@extern int xt_register_match (struct xt_match *target);extern void xt_unregister_match (struct xt_match *target); -extern int xt_check_match (const struct xt_match *match,unsigned short family, -unsigned int size,const char *table,unsigned int hook, -unsigned short proto,int inv_proto); -extern int xt_check_target (const struct xt_target *target,unsigned short family, -unsigned int size,const char *table,unsigned int hook, -unsigned short proto,int inv_proto); +extern int xt_init_match (struct xt_entry_match *m,char *module_prefix, +unsigned short family,const char *table, +unsigned int hook_mask,unsigned short proto, +int inv_proto); +extern void xt_destroy_match (struct xt_entry_match *m); +extern int xt_init_target (struct xt_entry_target *t,char *module_prefix, +unsigned short family,const char *table, +unsigned int hook_mask,unsigned short proto, +int inv_proto); +extern void xt_destroy_target (struct xt_entry_target *t); extern int xt_register_table(struct xt_table *table, struct xt_table_info *bootstrap,
net/ipv4/netfilter/arp_tables.c +22 -29
102 lines not on this page · raw message
net/ipv4/netfilter/ip_tables.c +81 -88
304 lines not on this page · raw message
net/ipv6/netfilter/ip6_tables.c +49 -63
219 lines not on this page · raw message
net/netfilter/x_tables.c +86 -9
124 lines not on this page · raw message