diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2015-03-17 13:21:42 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-07-03 19:49:05 -0700 |
commit | a374854f755a53f839abceb1cf0ff95b3d563339 (patch) | |
tree | 403681ad9c53155a2f40dbba8f50b404f53e33a0 | |
parent | b89c87de3c8836ef14e643ce89684a2a2afb9bb5 (diff) | |
download | lwn-a374854f755a53f839abceb1cf0ff95b3d563339.tar.gz lwn-a374854f755a53f839abceb1cf0ff95b3d563339.zip |
netfilter: nf_tables: allow to change chain policy without hook if it exists
commit d6b6cb1d3e6f78d55c2d4043d77d0d8def3f3b99 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: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/netfilter/nf_tables_api.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index c68e5e0628df..99de2409f731 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -855,7 +855,10 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb, if (nla[NFTA_CHAIN_POLICY]) { if ((chain != NULL && - !(chain->flags & NFT_BASE_CHAIN)) || + !(chain->flags & NFT_BASE_CHAIN))) + return -EOPNOTSUPP; + + if (chain == NULL && nla[NFTA_CHAIN_HOOK] == NULL) return -EOPNOTSUPP; |