diff options
author | Patrick McHardy <kaber@trash.net> | 2006-03-20 21:02:15 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-20 21:02:15 -0500 |
commit | 1c524830d0b39472f0278989bf1119750a5e234d (patch) | |
tree | 9c60dd1717ddf458f66c4a71cb41c3ef7186cdd3 /net/ipv4 | |
parent | 5d04bff096180f032de8b9b12153a8a1b4009b8d (diff) |
[NETFILTER]: x_tables: pass registered match/target data to match/target functions
This allows to make decisions based on the revision (and address family
with a follow-up patch) at runtime.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/netfilter/arp_tables.c | 5 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_tables.c | 13 |
2 files changed, 10 insertions, 8 deletions
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 6162d0e328e..87b3b792010 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -300,6 +300,7 @@ unsigned int arpt_do_table(struct sk_buff **pskb, | |||
300 | verdict = t->u.kernel.target->target(pskb, | 300 | verdict = t->u.kernel.target->target(pskb, |
301 | in, out, | 301 | in, out, |
302 | hook, | 302 | hook, |
303 | t->u.kernel.target, | ||
303 | t->data, | 304 | t->data, |
304 | userdata); | 305 | userdata); |
305 | 306 | ||
@@ -491,7 +492,7 @@ static inline int check_entry(struct arpt_entry *e, const char *name, unsigned i | |||
491 | goto out; | 492 | goto out; |
492 | } | 493 | } |
493 | } else if (t->u.kernel.target->checkentry | 494 | } else if (t->u.kernel.target->checkentry |
494 | && !t->u.kernel.target->checkentry(name, e, t->data, | 495 | && !t->u.kernel.target->checkentry(name, e, target, t->data, |
495 | t->u.target_size | 496 | t->u.target_size |
496 | - sizeof(*t), | 497 | - sizeof(*t), |
497 | e->comefrom)) { | 498 | e->comefrom)) { |
@@ -560,7 +561,7 @@ static inline int cleanup_entry(struct arpt_entry *e, unsigned int *i) | |||
560 | 561 | ||
561 | t = arpt_get_target(e); | 562 | t = arpt_get_target(e); |
562 | if (t->u.kernel.target->destroy) | 563 | if (t->u.kernel.target->destroy) |
563 | t->u.kernel.target->destroy(t->data, | 564 | t->u.kernel.target->destroy(t->u.kernel.target, t->data, |
564 | t->u.target_size - sizeof(*t)); | 565 | t->u.target_size - sizeof(*t)); |
565 | module_put(t->u.kernel.target->me); | 566 | module_put(t->u.kernel.target->me); |
566 | return 0; | 567 | return 0; |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index 62f8d639ab9..2381a4aa71d 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -197,8 +197,8 @@ int do_match(struct ipt_entry_match *m, | |||
197 | int *hotdrop) | 197 | int *hotdrop) |
198 | { | 198 | { |
199 | /* Stop iteration if it doesn't match */ | 199 | /* Stop iteration if it doesn't match */ |
200 | if (!m->u.kernel.match->match(skb, in, out, m->data, offset, | 200 | if (!m->u.kernel.match->match(skb, in, out, m->u.kernel.match, m->data, |
201 | skb->nh.iph->ihl*4, hotdrop)) | 201 | offset, skb->nh.iph->ihl*4, hotdrop)) |
202 | return 1; | 202 | return 1; |
203 | else | 203 | else |
204 | return 0; | 204 | return 0; |
@@ -305,6 +305,7 @@ ipt_do_table(struct sk_buff **pskb, | |||
305 | verdict = t->u.kernel.target->target(pskb, | 305 | verdict = t->u.kernel.target->target(pskb, |
306 | in, out, | 306 | in, out, |
307 | hook, | 307 | hook, |
308 | t->u.kernel.target, | ||
308 | t->data, | 309 | t->data, |
309 | userdata); | 310 | userdata); |
310 | 311 | ||
@@ -464,7 +465,7 @@ cleanup_match(struct ipt_entry_match *m, unsigned int *i) | |||
464 | return 1; | 465 | return 1; |
465 | 466 | ||
466 | if (m->u.kernel.match->destroy) | 467 | if (m->u.kernel.match->destroy) |
467 | m->u.kernel.match->destroy(m->data, | 468 | m->u.kernel.match->destroy(m->u.kernel.match, m->data, |
468 | m->u.match_size - sizeof(*m)); | 469 | m->u.match_size - sizeof(*m)); |
469 | module_put(m->u.kernel.match->me); | 470 | module_put(m->u.kernel.match->me); |
470 | return 0; | 471 | return 0; |
@@ -517,7 +518,7 @@ check_match(struct ipt_entry_match *m, | |||
517 | goto err; | 518 | goto err; |
518 | 519 | ||
519 | if (m->u.kernel.match->checkentry | 520 | if (m->u.kernel.match->checkentry |
520 | && !m->u.kernel.match->checkentry(name, ip, m->data, | 521 | && !m->u.kernel.match->checkentry(name, ip, match, m->data, |
521 | m->u.match_size - sizeof(*m), | 522 | m->u.match_size - sizeof(*m), |
522 | hookmask)) { | 523 | hookmask)) { |
523 | duprintf("ip_tables: check failed for `%s'.\n", | 524 | duprintf("ip_tables: check failed for `%s'.\n", |
@@ -578,7 +579,7 @@ check_entry(struct ipt_entry *e, const char *name, unsigned int size, | |||
578 | goto cleanup_matches; | 579 | goto cleanup_matches; |
579 | } | 580 | } |
580 | } else if (t->u.kernel.target->checkentry | 581 | } else if (t->u.kernel.target->checkentry |
581 | && !t->u.kernel.target->checkentry(name, e, t->data, | 582 | && !t->u.kernel.target->checkentry(name, e, target, t->data, |
582 | t->u.target_size | 583 | t->u.target_size |
583 | - sizeof(*t), | 584 | - sizeof(*t), |
584 | e->comefrom)) { | 585 | e->comefrom)) { |
@@ -652,7 +653,7 @@ cleanup_entry(struct ipt_entry *e, unsigned int *i) | |||
652 | IPT_MATCH_ITERATE(e, cleanup_match, NULL); | 653 | IPT_MATCH_ITERATE(e, cleanup_match, NULL); |
653 | t = ipt_get_target(e); | 654 | t = ipt_get_target(e); |
654 | if (t->u.kernel.target->destroy) | 655 | if (t->u.kernel.target->destroy) |
655 | t->u.kernel.target->destroy(t->data, | 656 | t->u.kernel.target->destroy(t->u.kernel.target, t->data, |
656 | t->u.target_size - sizeof(*t)); | 657 | t->u.target_size - sizeof(*t)); |
657 | module_put(t->u.kernel.target->me); | 658 | module_put(t->u.kernel.target->me); |
658 | return 0; | 659 | return 0; |