mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
netfilter: xtables: move extension arguments into compound structure (2/6)
This patch does this for match extensions' checkentry functions. Signed-off-by: Jan Engelhardt <[email protected]> Signed-off-by: Patrick McHardy <[email protected]>
This commit is contained in:
parent
f7108a20de
commit
9b4fce7a35
48 changed files with 240 additions and 386 deletions
|
|
@ -629,20 +629,20 @@ check_entry(struct ip6t_entry *e, const char *name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int check_match(struct ip6t_entry_match *m, const char *name,
|
||||
const struct ip6t_ip6 *ipv6,
|
||||
unsigned int hookmask, unsigned int *i)
|
||||
static int check_match(struct ip6t_entry_match *m, struct xt_mtchk_param *par,
|
||||
unsigned int *i)
|
||||
{
|
||||
struct xt_match *match;
|
||||
const struct ip6t_ip6 *ipv6 = par->entryinfo;
|
||||
int ret;
|
||||
|
||||
match = m->u.kernel.match;
|
||||
ret = xt_check_match(match, AF_INET6, m->u.match_size - sizeof(*m),
|
||||
name, hookmask, ipv6->proto,
|
||||
ipv6->invflags & IP6T_INV_PROTO, ipv6, m->data);
|
||||
par->match = m->u.kernel.match;
|
||||
par->matchinfo = m->data;
|
||||
|
||||
ret = xt_check_match(par, NFPROTO_IPV6, m->u.match_size - sizeof(*m),
|
||||
ipv6->proto, ipv6->invflags & IP6T_INV_PROTO);
|
||||
if (ret < 0) {
|
||||
duprintf("ip_tables: check failed for `%s'.\n",
|
||||
m->u.kernel.match->name);
|
||||
par.match->name);
|
||||
return ret;
|
||||
}
|
||||
++*i;
|
||||
|
|
@ -650,10 +650,7 @@ static int check_match(struct ip6t_entry_match *m, const char *name,
|
|||
}
|
||||
|
||||
static int
|
||||
find_check_match(struct ip6t_entry_match *m,
|
||||
const char *name,
|
||||
const struct ip6t_ip6 *ipv6,
|
||||
unsigned int hookmask,
|
||||
find_check_match(struct ip6t_entry_match *m, struct xt_mtchk_param *par,
|
||||
unsigned int *i)
|
||||
{
|
||||
struct xt_match *match;
|
||||
|
|
@ -668,7 +665,7 @@ find_check_match(struct ip6t_entry_match *m,
|
|||
}
|
||||
m->u.kernel.match = match;
|
||||
|
||||
ret = check_match(m, name, ipv6, hookmask, i);
|
||||
ret = check_match(m, par, i);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
|
|
@ -705,14 +702,17 @@ find_check_entry(struct ip6t_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 = IP6T_MATCH_ITERATE(e, find_check_match, name, &e->ipv6,
|
||||
e->comefrom, &j);
|
||||
mtpar.table = name;
|
||||
mtpar.entryinfo = &e->ipv6;
|
||||
mtpar.hook_mask = e->comefrom;
|
||||
ret = IP6T_MATCH_ITERATE(e, find_check_match, &mtpar, &j);
|
||||
if (ret != 0)
|
||||
goto cleanup_matches;
|
||||
|
||||
|
|
@ -1669,10 +1669,13 @@ static int compat_check_entry(struct ip6t_entry *e, const char *name,
|
|||
{
|
||||
unsigned int j;
|
||||
int ret;
|
||||
struct xt_mtchk_param mtpar;
|
||||
|
||||
j = 0;
|
||||
ret = IP6T_MATCH_ITERATE(e, check_match, name, &e->ipv6,
|
||||
e->comefrom, &j);
|
||||
mtpar.table = name;
|
||||
mtpar.entryinfo = &e->ipv6;
|
||||
mtpar.hook_mask = e->comefrom;
|
||||
ret = IP6T_MATCH_ITERATE(e, check_match, &mtpar, &j);
|
||||
if (ret)
|
||||
goto cleanup_matches;
|
||||
|
||||
|
|
@ -2166,14 +2169,9 @@ icmp6_match(const struct sk_buff *skb, const struct xt_match_param *par)
|
|||
}
|
||||
|
||||
/* Called when user tries to insert an entry of this type. */
|
||||
static bool
|
||||
icmp6_checkentry(const char *tablename,
|
||||
const void *entry,
|
||||
const struct xt_match *match,
|
||||
void *matchinfo,
|
||||
unsigned int hook_mask)
|
||||
static bool icmp6_checkentry(const struct xt_mtchk_param *par)
|
||||
{
|
||||
const struct ip6t_icmp *icmpinfo = matchinfo;
|
||||
const struct ip6t_icmp *icmpinfo = par->matchinfo;
|
||||
|
||||
/* Must specify no unknown invflags */
|
||||
return !(icmpinfo->invflags & ~IP6T_ICMP_INV);
|
||||
|
|
|
|||
|
|
@ -90,13 +90,9 @@ static bool ah_mt6(const struct sk_buff *skb, const struct xt_match_param *par)
|
|||
!(ahinfo->hdrres && ah->reserved);
|
||||
}
|
||||
|
||||
/* Called when user tries to insert an entry of this type. */
|
||||
static bool
|
||||
ah_mt6_check(const char *tablename, const void *entry,
|
||||
const struct xt_match *match, void *matchinfo,
|
||||
unsigned int hook_mask)
|
||||
static bool ah_mt6_check(const struct xt_mtchk_param *par)
|
||||
{
|
||||
const struct ip6t_ah *ahinfo = matchinfo;
|
||||
const struct ip6t_ah *ahinfo = par->matchinfo;
|
||||
|
||||
if (ahinfo->invflags & ~IP6T_AH_INV_MASK) {
|
||||
pr_debug("ip6t_ah: unknown flags %X\n", ahinfo->invflags);
|
||||
|
|
|
|||
|
|
@ -107,13 +107,9 @@ frag_mt6(const struct sk_buff *skb, const struct xt_match_param *par)
|
|||
&& (ntohs(fh->frag_off) & IP6_MF));
|
||||
}
|
||||
|
||||
/* Called when user tries to insert an entry of this type. */
|
||||
static bool
|
||||
frag_mt6_check(const char *tablename, const void *ip,
|
||||
const struct xt_match *match, void *matchinfo,
|
||||
unsigned int hook_mask)
|
||||
static bool frag_mt6_check(const struct xt_mtchk_param *par)
|
||||
{
|
||||
const struct ip6t_frag *fraginfo = matchinfo;
|
||||
const struct ip6t_frag *fraginfo = par->matchinfo;
|
||||
|
||||
if (fraginfo->invflags & ~IP6T_FRAG_INV_MASK) {
|
||||
pr_debug("ip6t_frag: unknown flags %X\n", fraginfo->invflags);
|
||||
|
|
|
|||
|
|
@ -160,13 +160,9 @@ hbh_mt6(const struct sk_buff *skb, const struct xt_match_param *par)
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Called when user tries to insert an entry of this type. */
|
||||
static bool
|
||||
hbh_mt6_check(const char *tablename, const void *entry,
|
||||
const struct xt_match *match, void *matchinfo,
|
||||
unsigned int hook_mask)
|
||||
static bool hbh_mt6_check(const struct xt_mtchk_param *par)
|
||||
{
|
||||
const struct ip6t_opts *optsinfo = matchinfo;
|
||||
const struct ip6t_opts *optsinfo = par->matchinfo;
|
||||
|
||||
if (optsinfo->invflags & ~IP6T_OPTS_INV_MASK) {
|
||||
pr_debug("ip6t_opts: unknown flags %X\n", optsinfo->invflags);
|
||||
|
|
|
|||
|
|
@ -118,12 +118,9 @@ ipv6header_mt6(const struct sk_buff *skb, const struct xt_match_param *par)
|
|||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
ipv6header_mt6_check(const char *tablename, const void *ip,
|
||||
const struct xt_match *match, void *matchinfo,
|
||||
unsigned int hook_mask)
|
||||
static bool ipv6header_mt6_check(const struct xt_mtchk_param *par)
|
||||
{
|
||||
const struct ip6t_ipv6header_info *info = matchinfo;
|
||||
const struct ip6t_ipv6header_info *info = par->matchinfo;
|
||||
|
||||
/* invflags is 0 or 0xff in hard mode */
|
||||
if ((!info->modeflag) && info->invflags != 0x00 &&
|
||||
|
|
|
|||
|
|
@ -67,13 +67,9 @@ static bool mh_mt6(const struct sk_buff *skb, const struct xt_match_param *par)
|
|||
!!(mhinfo->invflags & IP6T_MH_INV_TYPE));
|
||||
}
|
||||
|
||||
/* Called when user tries to insert an entry of this type. */
|
||||
static bool
|
||||
mh_mt6_check(const char *tablename, const void *entry,
|
||||
const struct xt_match *match, void *matchinfo,
|
||||
unsigned int hook_mask)
|
||||
static bool mh_mt6_check(const struct xt_mtchk_param *par)
|
||||
{
|
||||
const struct ip6t_mh *mhinfo = matchinfo;
|
||||
const struct ip6t_mh *mhinfo = par->matchinfo;
|
||||
|
||||
/* Must specify no unknown invflags */
|
||||
return !(mhinfo->invflags & ~IP6T_MH_INV_MASK);
|
||||
|
|
|
|||
|
|
@ -186,13 +186,9 @@ static bool rt_mt6(const struct sk_buff *skb, const struct xt_match_param *par)
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Called when user tries to insert an entry of this type. */
|
||||
static bool
|
||||
rt_mt6_check(const char *tablename, const void *entry,
|
||||
const struct xt_match *match, void *matchinfo,
|
||||
unsigned int hook_mask)
|
||||
static bool rt_mt6_check(const struct xt_mtchk_param *par)
|
||||
{
|
||||
const struct ip6t_rt *rtinfo = matchinfo;
|
||||
const struct ip6t_rt *rtinfo = par->matchinfo;
|
||||
|
||||
if (rtinfo->invflags & ~IP6T_RT_INV_MASK) {
|
||||
pr_debug("ip6t_rt: unknown flags %X\n", rtinfo->invflags);
|
||||
|
|
|
|||
Loading…
Reference in a new issue