|
@@ -607,20 +607,20 @@ check_entry(struct ipt_entry *e, const char *name)
|
|
|
}
|
|
|
|
|
|
static int
|
|
|
-check_match(struct ipt_entry_match *m, const char *name,
|
|
|
- const struct ipt_ip *ip,
|
|
|
- unsigned int hookmask, unsigned int *i)
|
|
|
+check_match(struct ipt_entry_match *m, struct xt_mtchk_param *par,
|
|
|
+ unsigned int *i)
|
|
|
{
|
|
|
- struct xt_match *match;
|
|
|
+ const struct ipt_ip *ip = par->entryinfo;
|
|
|
int ret;
|
|
|
|
|
|
- match = m->u.kernel.match;
|
|
|
- ret = xt_check_match(match, AF_INET, m->u.match_size - sizeof(*m),
|
|
|
- name, hookmask, ip->proto,
|
|
|
- ip->invflags & IPT_INV_PROTO, ip, m->data);
|
|
|
+ par->match = m->u.kernel.match;
|
|
|
+ par->matchinfo = m->data;
|
|
|
+
|
|
|
+ ret = xt_check_match(par, NFPROTO_IPV4, m->u.match_size - sizeof(*m),
|
|
|
+ ip->proto, ip->invflags & IPT_INV_PROTO);
|
|
|
if (ret < 0) {
|
|
|
duprintf("ip_tables: check failed for `%s'.\n",
|
|
|
- m->u.kernel.match->name);
|
|
|
+ par.match->name);
|
|
|
return ret;
|
|
|
}
|
|
|
++*i;
|
|
@@ -628,10 +628,7 @@ check_match(struct ipt_entry_match *m, const char *name,
|
|
|
}
|
|
|
|
|
|
static int
|
|
|
-find_check_match(struct ipt_entry_match *m,
|
|
|
- const char *name,
|
|
|
- const struct ipt_ip *ip,
|
|
|
- unsigned int hookmask,
|
|
|
+find_check_match(struct ipt_entry_match *m, struct xt_mtchk_param *par,
|
|
|
unsigned int *i)
|
|
|
{
|
|
|
struct xt_match *match;
|
|
@@ -646,7 +643,7 @@ find_check_match(struct ipt_entry_match *m,
|
|
|
}
|
|
|
m->u.kernel.match = match;
|
|
|
|
|
|
- ret = check_match(m, name, ip, hookmask, i);
|
|
|
+ ret = check_match(m, par, i);
|
|
|
if (ret)
|
|
|
goto err;
|
|
|
|
|
@@ -683,14 +680,17 @@ find_check_entry(struct ipt_entry *e, const char *name, unsigned int size,
|
|
|
struct xt_target *target;
|
|
|
int ret;
|
|
|
unsigned int j;
|
|
|
+ struct xt_mtchk_param mtpar;
|
|
|
|
|
|
ret = check_entry(e, name);
|
|
|
if (ret)
|
|
|
return ret;
|
|
|
|
|
|
j = 0;
|
|
|
- ret = IPT_MATCH_ITERATE(e, find_check_match, name, &e->ip,
|
|
|
- e->comefrom, &j);
|
|
|
+ mtpar.table = name;
|
|
|
+ mtpar.entryinfo = &e->ip;
|
|
|
+ mtpar.hook_mask = e->comefrom;
|
|
|
+ ret = IPT_MATCH_ITERATE(e, find_check_match, &mtpar, &j);
|
|
|
if (ret != 0)
|
|
|
goto cleanup_matches;
|
|
|
|
|
@@ -1644,12 +1644,15 @@ static int
|
|
|
compat_check_entry(struct ipt_entry *e, const char *name,
|
|
|
unsigned int *i)
|
|
|
{
|
|
|
+ struct xt_mtchk_param mtpar;
|
|
|
unsigned int j;
|
|
|
int ret;
|
|
|
|
|
|
j = 0;
|
|
|
- ret = IPT_MATCH_ITERATE(e, check_match, name, &e->ip,
|
|
|
- e->comefrom, &j);
|
|
|
+ mtpar.table = name;
|
|
|
+ mtpar.entryinfo = &e->ip;
|
|
|
+ mtpar.hook_mask = e->comefrom;
|
|
|
+ ret = IPT_MATCH_ITERATE(e, check_match, &mtpar, &j);
|
|
|
if (ret)
|
|
|
goto cleanup_matches;
|
|
|
|
|
@@ -2144,15 +2147,9 @@ icmp_match(const struct sk_buff *skb, const struct xt_match_param *par)
|
|
|
!!(icmpinfo->invflags&IPT_ICMP_INV));
|
|
|
}
|
|
|
|
|
|
-/* Called when user tries to insert an entry of this type. */
|
|
|
-static bool
|
|
|
-icmp_checkentry(const char *tablename,
|
|
|
- const void *entry,
|
|
|
- const struct xt_match *match,
|
|
|
- void *matchinfo,
|
|
|
- unsigned int hook_mask)
|
|
|
+static bool icmp_checkentry(const struct xt_mtchk_param *par)
|
|
|
{
|
|
|
- const struct ipt_icmp *icmpinfo = matchinfo;
|
|
|
+ const struct ipt_icmp *icmpinfo = par->matchinfo;
|
|
|
|
|
|
/* Must specify no unknown invflags */
|
|
|
return !(icmpinfo->invflags & ~IPT_ICMP_INV);
|