aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/netfilter
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2008-10-08 05:35:17 -0400
committerPatrick McHardy <kaber@trash.net>2008-10-08 05:35:17 -0400
commit367c679007fa4f990eb7ee381326ec59d8148b0e (patch)
treea543f22332eba9ef972ed8ea6e66448921671ef7 /net/ipv4/netfilter
parent147c3844ad381b58715a6ee2ea697594e3c06284 (diff)
netfilter: xtables: do centralized checkentry call (1/2)
It used to be that {ip,ip6,etc}_tables called extension->checkentry themselves, but this can be moved into the xtables core. Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/ipv4/netfilter')
-rw-r--r--net/ipv4/netfilter/arp_tables.c10
-rw-r--r--net/ipv4/netfilter/ip_tables.c23
2 files changed, 13 insertions, 20 deletions
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index b4a9a1799c9..ae525a9afbe 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -465,15 +465,13 @@ static inline int check_target(struct arpt_entry *e, const char *name)
465 465
466 ret = xt_check_target(target, NFPROTO_ARP, 466 ret = xt_check_target(target, NFPROTO_ARP,
467 t->u.target_size - sizeof(*t), 467 t->u.target_size - sizeof(*t),
468 name, e->comefrom, 0, 0); 468 name, e->comefrom, 0, 0, e, t->data);
469 if (!ret && t->u.kernel.target->checkentry 469 if (ret < 0) {
470 && !t->u.kernel.target->checkentry(name, e, target, t->data,
471 e->comefrom)) {
472 duprintf("arp_tables: check failed for `%s'.\n", 470 duprintf("arp_tables: check failed for `%s'.\n",
473 t->u.kernel.target->name); 471 t->u.kernel.target->name);
474 ret = -EINVAL; 472 return ret;
475 } 473 }
476 return ret; 474 return 0;
477} 475}
478 476
479static inline int 477static inline int
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index 4e7c719445c..b4c74a7a807 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -616,17 +616,14 @@ check_match(struct ipt_entry_match *m, const char *name,
616 match = m->u.kernel.match; 616 match = m->u.kernel.match;
617 ret = xt_check_match(match, AF_INET, m->u.match_size - sizeof(*m), 617 ret = xt_check_match(match, AF_INET, m->u.match_size - sizeof(*m),
618 name, hookmask, ip->proto, 618 name, hookmask, ip->proto,
619 ip->invflags & IPT_INV_PROTO); 619 ip->invflags & IPT_INV_PROTO, ip, m->data);
620 if (!ret && m->u.kernel.match->checkentry 620 if (ret < 0) {
621 && !m->u.kernel.match->checkentry(name, ip, match, m->data,
622 hookmask)) {
623 duprintf("ip_tables: check failed for `%s'.\n", 621 duprintf("ip_tables: check failed for `%s'.\n",
624 m->u.kernel.match->name); 622 m->u.kernel.match->name);
625 ret = -EINVAL; 623 return ret;
626 } 624 }
627 if (!ret) 625 ++*i;
628 (*i)++; 626 return 0;
629 return ret;
630} 627}
631 628
632static int 629static int
@@ -668,15 +665,13 @@ static int check_target(struct ipt_entry *e, const char *name)
668 target = t->u.kernel.target; 665 target = t->u.kernel.target;
669 ret = xt_check_target(target, AF_INET, t->u.target_size - sizeof(*t), 666 ret = xt_check_target(target, AF_INET, t->u.target_size - sizeof(*t),
670 name, e->comefrom, e->ip.proto, 667 name, e->comefrom, e->ip.proto,
671 e->ip.invflags & IPT_INV_PROTO); 668 e->ip.invflags & IPT_INV_PROTO, e, t->data);
672 if (!ret && t->u.kernel.target->checkentry 669 if (ret < 0) {
673 && !t->u.kernel.target->checkentry(name, e, target, t->data,
674 e->comefrom)) {
675 duprintf("ip_tables: check failed for `%s'.\n", 670 duprintf("ip_tables: check failed for `%s'.\n",
676 t->u.kernel.target->name); 671 t->u.kernel.target->name);
677 ret = -EINVAL; 672 return ret;
678 } 673 }
679 return ret; 674 return 0;
680} 675}
681 676
682static int 677static int