diff options
author | Jan Engelhardt <jengelh@medozas.de> | 2009-07-05 12:26:37 -0400 |
---|---|---|
committer | Jan Engelhardt <jengelh@medozas.de> | 2010-05-11 12:23:43 -0400 |
commit | de74c16996287250f0d947663127f80c6beebd3c (patch) | |
tree | c7e77e254c5812c8561516dd668eaec732a89a0d /include/linux | |
parent | ef53d702c3614fb919e8a8291033e3dbccfd1aea (diff) |
netfilter: xtables: combine struct xt_match_param and xt_target_param
The structures carried - besides match/target - almost the same data.
It is possible to combine them, as extensions are evaluated serially,
and so, the callers end up a little smaller.
text data bss filename
-15318 740 104 net/ipv4/netfilter/ip_tables.o
+15286 740 104 net/ipv4/netfilter/ip_tables.o
-15333 540 152 net/ipv6/netfilter/ip6_tables.o
+15269 540 152 net/ipv6/netfilter/ip6_tables.o
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/netfilter/x_tables.h | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index eeb4884c30be..5efa3757d08c 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h | |||
@@ -182,13 +182,17 @@ struct xt_counters_info { | |||
182 | 182 | ||
183 | #include <linux/netdevice.h> | 183 | #include <linux/netdevice.h> |
184 | 184 | ||
185 | #define xt_match_param xt_action_param | ||
186 | #define xt_target_param xt_action_param | ||
185 | /** | 187 | /** |
186 | * struct xt_match_param - parameters for match extensions' match functions | 188 | * struct xt_action_param - parameters for matches/targets |
187 | * | 189 | * |
190 | * @match: the match extension | ||
191 | * @target: the target extension | ||
192 | * @matchinfo: per-match data | ||
193 | * @targetinfo: per-target data | ||
188 | * @in: input netdevice | 194 | * @in: input netdevice |
189 | * @out: output netdevice | 195 | * @out: output netdevice |
190 | * @match: struct xt_match through which this function was invoked | ||
191 | * @matchinfo: per-match data | ||
192 | * @fragoff: packet is a fragment, this is the data offset | 196 | * @fragoff: packet is a fragment, this is the data offset |
193 | * @thoff: position of transport header relative to skb->data | 197 | * @thoff: position of transport header relative to skb->data |
194 | * @hook: hook number given packet came from | 198 | * @hook: hook number given packet came from |
@@ -197,10 +201,15 @@ struct xt_counters_info { | |||
197 | * @hotdrop: drop packet if we had inspection problems | 201 | * @hotdrop: drop packet if we had inspection problems |
198 | * Network namespace obtainable using dev_net(in/out) | 202 | * Network namespace obtainable using dev_net(in/out) |
199 | */ | 203 | */ |
200 | struct xt_match_param { | 204 | struct xt_action_param { |
205 | union { | ||
206 | const struct xt_match *match; | ||
207 | const struct xt_target *target; | ||
208 | }; | ||
209 | union { | ||
210 | const void *matchinfo, *targinfo; | ||
211 | }; | ||
201 | const struct net_device *in, *out; | 212 | const struct net_device *in, *out; |
202 | const struct xt_match *match; | ||
203 | const void *matchinfo; | ||
204 | int fragoff; | 213 | int fragoff; |
205 | unsigned int thoff; | 214 | unsigned int thoff; |
206 | unsigned int hooknum; | 215 | unsigned int hooknum; |
@@ -243,23 +252,6 @@ struct xt_mtdtor_param { | |||
243 | }; | 252 | }; |
244 | 253 | ||
245 | /** | 254 | /** |
246 | * struct xt_target_param - parameters for target extensions' target functions | ||
247 | * | ||
248 | * @hooknum: hook through which this target was invoked | ||
249 | * @target: struct xt_target through which this function was invoked | ||
250 | * @targinfo: per-target data | ||
251 | * | ||
252 | * Other fields see above. | ||
253 | */ | ||
254 | struct xt_target_param { | ||
255 | const struct net_device *in, *out; | ||
256 | const struct xt_target *target; | ||
257 | const void *targinfo; | ||
258 | unsigned int hooknum; | ||
259 | u_int8_t family; | ||
260 | }; | ||
261 | |||
262 | /** | ||
263 | * struct xt_tgchk_param - parameters for target extensions' | 255 | * struct xt_tgchk_param - parameters for target extensions' |
264 | * checkentry functions | 256 | * checkentry functions |
265 | * | 257 | * |
@@ -298,7 +290,7 @@ struct xt_match { | |||
298 | non-linear skb, using skb_header_pointer and | 290 | non-linear skb, using skb_header_pointer and |
299 | skb_ip_make_writable. */ | 291 | skb_ip_make_writable. */ |
300 | bool (*match)(const struct sk_buff *skb, | 292 | bool (*match)(const struct sk_buff *skb, |
301 | const struct xt_match_param *); | 293 | const struct xt_action_param *); |
302 | 294 | ||
303 | /* Called when user tries to insert an entry of this type. */ | 295 | /* Called when user tries to insert an entry of this type. */ |
304 | int (*checkentry)(const struct xt_mtchk_param *); | 296 | int (*checkentry)(const struct xt_mtchk_param *); |
@@ -335,7 +327,7 @@ struct xt_target { | |||
335 | must now handle non-linear skbs, using skb_copy_bits and | 327 | must now handle non-linear skbs, using skb_copy_bits and |
336 | skb_ip_make_writable. */ | 328 | skb_ip_make_writable. */ |
337 | unsigned int (*target)(struct sk_buff *skb, | 329 | unsigned int (*target)(struct sk_buff *skb, |
338 | const struct xt_target_param *); | 330 | const struct xt_action_param *); |
339 | 331 | ||
340 | /* Called when user tries to insert an entry of this type: | 332 | /* Called when user tries to insert an entry of this type: |
341 | hook_mask is a bitmask of hooks from which it can be | 333 | hook_mask is a bitmask of hooks from which it can be |