Skip to content

Commit

Permalink
netfilter: nft_compat: check extension hook mask only if set
Browse files Browse the repository at this point in the history
If the x_tables extension comes with no hook mask, skip this validation.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Pablo Neira Ayuso committed Jul 19, 2017
1 parent 3840538 commit f7fb77f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/netfilter/nft_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ static int nft_target_validate(const struct nft_ctx *ctx,
const struct nf_hook_ops *ops = &basechain->ops[0];

hook_mask = 1 << ops->hooknum;
if (!(hook_mask & target->hooks))
if (target->hooks && !(hook_mask & target->hooks))
return -EINVAL;

ret = nft_compat_chain_validate_dependency(target->table,
Expand Down Expand Up @@ -484,7 +484,7 @@ static int nft_match_validate(const struct nft_ctx *ctx,
const struct nf_hook_ops *ops = &basechain->ops[0];

hook_mask = 1 << ops->hooknum;
if (!(hook_mask & match->hooks))
if (match->hooks && !(hook_mask & match->hooks))
return -EINVAL;

ret = nft_compat_chain_validate_dependency(match->table,
Expand Down

0 comments on commit f7fb77f

Please sign in to comment.