netfilter: nf_tables: add NFT_CHAIN_POLICY_UNSET and use it

Default policy is defined as a unsigned 8-bit field, do not use a
negative value to leave it unset, use this new NFT_CHAIN_POLICY_UNSET
instead.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
Pablo Neira Ayuso 2019-09-16 18:33:08 +02:00
parent 864668bfc3
commit ad652f3811
2 changed files with 3 additions and 1 deletions

View File

@ -889,6 +889,8 @@ enum nft_chain_flags {
NFT_CHAIN_HW_OFFLOAD = 0x2, NFT_CHAIN_HW_OFFLOAD = 0x2,
}; };
#define NFT_CHAIN_POLICY_UNSET U8_MAX
/** /**
* struct nft_chain - nf_tables chain * struct nft_chain - nf_tables chain
* *

View File

@ -1715,7 +1715,7 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask,
goto err2; goto err2;
} }
nft_trans_chain_policy(trans) = -1; nft_trans_chain_policy(trans) = NFT_CHAIN_POLICY_UNSET;
if (nft_is_base_chain(chain)) if (nft_is_base_chain(chain))
nft_trans_chain_policy(trans) = policy; nft_trans_chain_policy(trans) = policy;