mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-25 10:19:47 +00:00
netfilter: nft_osf: restrict osf to ipv4, ipv6 and inet families
[ Upstream commit5f3b7aae14
] As it was originally intended, restrict extension to supported families. Fixes:b96af92d6e
("netfilter: nf_tables: implement Passive OS fingerprint module in nft_osf") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
a2ce367ae7
commit
fba05d2502
1 changed files with 15 additions and 3 deletions
|
@ -115,9 +115,21 @@ static int nft_osf_validate(const struct nft_ctx *ctx,
|
||||||
const struct nft_expr *expr,
|
const struct nft_expr *expr,
|
||||||
const struct nft_data **data)
|
const struct nft_data **data)
|
||||||
{
|
{
|
||||||
return nft_chain_validate_hooks(ctx->chain, (1 << NF_INET_LOCAL_IN) |
|
unsigned int hooks;
|
||||||
(1 << NF_INET_PRE_ROUTING) |
|
|
||||||
(1 << NF_INET_FORWARD));
|
switch (ctx->family) {
|
||||||
|
case NFPROTO_IPV4:
|
||||||
|
case NFPROTO_IPV6:
|
||||||
|
case NFPROTO_INET:
|
||||||
|
hooks = (1 << NF_INET_LOCAL_IN) |
|
||||||
|
(1 << NF_INET_PRE_ROUTING) |
|
||||||
|
(1 << NF_INET_FORWARD);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nft_chain_validate_hooks(ctx->chain, hooks);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nft_expr_type nft_osf_type;
|
static struct nft_expr_type nft_osf_type;
|
||||||
|
|
Loading…
Reference in a new issue