Commit a374854f authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso Committed by Greg Kroah-Hartman

netfilter: nf_tables: allow to change chain policy without hook if it exists

commit d6b6cb1d upstream.

If there's an existing base chain, we have to allow to change the
default policy without indicating the hook information.

However, if the chain doesn't exists, we have to enforce the presence of
the hook attribute.
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b89c87de
...@@ -855,7 +855,10 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb, ...@@ -855,7 +855,10 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb,
if (nla[NFTA_CHAIN_POLICY]) { if (nla[NFTA_CHAIN_POLICY]) {
if ((chain != NULL && if ((chain != NULL &&
!(chain->flags & NFT_BASE_CHAIN)) || !(chain->flags & NFT_BASE_CHAIN)))
return -EOPNOTSUPP;
if (chain == NULL &&
nla[NFTA_CHAIN_HOOK] == NULL) nla[NFTA_CHAIN_HOOK] == NULL)
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment