aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-03-20 20:59:06 -0500
committerDavid S. Miller <davem@davemloft.net>2006-03-20 20:59:06 -0500
commit37f9f7334b86ffc3b8a1921842ae33cb9aa22ee3 (patch)
treed207ae0a0f2eb37072dd4690de95b6cf170e4e04 /include/linux
parent6ea46c9c12da79ec6eead0cf4b3114143dd30bc1 (diff)
[NETFILTER]: xt_tables: add centralized error checking
Introduce new functions for common match/target checks (private data size, valid hooks, valid tables and valid protocols) to get more consistent error reporting and to avoid each module duplicating them. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/netfilter/x_tables.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 6500d4e59d46..b9c37e1e6730 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -92,8 +92,6 @@ struct xt_match
92 92
93 const char name[XT_FUNCTION_MAXNAMELEN-1]; 93 const char name[XT_FUNCTION_MAXNAMELEN-1];
94 94
95 u_int8_t revision;
96
97 /* Return true or false: return FALSE and set *hotdrop = 1 to 95 /* Return true or false: return FALSE and set *hotdrop = 1 to
98 force immediate packet drop. */ 96 force immediate packet drop. */
99 /* Arguments changed since 2.6.9, as this must now handle 97 /* Arguments changed since 2.6.9, as this must now handle
@@ -120,6 +118,12 @@ struct xt_match
120 118
121 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 119 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
122 struct module *me; 120 struct module *me;
121
122 char *table;
123 unsigned int matchsize;
124 unsigned int hooks;
125 unsigned short proto;
126 u_int8_t revision;
123}; 127};
124 128
125/* Registration hooks for targets. */ 129/* Registration hooks for targets. */
@@ -129,8 +133,6 @@ struct xt_target
129 133
130 const char name[XT_FUNCTION_MAXNAMELEN-1]; 134 const char name[XT_FUNCTION_MAXNAMELEN-1];
131 135
132 u_int8_t revision;
133
134 /* Returns verdict. Argument order changed since 2.6.9, as this 136 /* Returns verdict. Argument order changed since 2.6.9, as this
135 must now handle non-linear skbs, using skb_copy_bits and 137 must now handle non-linear skbs, using skb_copy_bits and
136 skb_ip_make_writable. */ 138 skb_ip_make_writable. */
@@ -156,6 +158,12 @@ struct xt_target
156 158
157 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 159 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
158 struct module *me; 160 struct module *me;
161
162 char *table;
163 unsigned int targetsize;
164 unsigned int hooks;
165 unsigned short proto;
166 u_int8_t revision;
159}; 167};
160 168
161/* Furniture shopping... */ 169/* Furniture shopping... */
@@ -207,6 +215,13 @@ extern void xt_unregister_target(int af, struct xt_target *target);
207extern int xt_register_match(int af, struct xt_match *target); 215extern int xt_register_match(int af, struct xt_match *target);
208extern void xt_unregister_match(int af, struct xt_match *target); 216extern void xt_unregister_match(int af, struct xt_match *target);
209 217
218extern int xt_check_match(const struct xt_match *match, unsigned short family,
219 unsigned int size, const char *table, unsigned int hook,
220 unsigned short proto, int inv_proto);
221extern int xt_check_target(const struct xt_target *target, unsigned short family,
222 unsigned int size, const char *table, unsigned int hook,
223 unsigned short proto, int inv_proto);
224
210extern int xt_register_table(struct xt_table *table, 225extern int xt_register_table(struct xt_table *table,
211 struct xt_table_info *bootstrap, 226 struct xt_table_info *bootstrap,
212 struct xt_table_info *newinfo); 227 struct xt_table_info *newinfo);