cache: Always set NFT_CACHE_TERSE for list cmd with --terse
Phil Sutter
reviewerPATCH 1/1 cache: Always set NFT_CACHE_TERSE for list cmd with --terse
This fixes at least 'nft -t list table ...' and 'nft -t list set ...'.
Note how --terse handling for 'list sets/maps' remains in place since setting NFT_CACHE_TERSE does not fully undo NFT_CACHE_SETELEM: setting both enables fetching of anonymous sets which is pointless for that command.
Reported-by [email protected]
Suggested-by Pablo Neira Ayuso <[email protected]>
Signed-off-by Phil Sutter <[email protected]>
--- src/cache.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
src/cache.c +3 -7
@@ -234,8 +234,6 @@ static unsigned int evaluate_cache_list(struct nft_ctx *nft, struct cmd *cmd, }if (filter->list.table && filter->list.set) flags |=NFT_CACHE_TABLE |NFT_CACHE_SET |NFT_CACHE_SETELEM ; -else if (nft_output_terse (&nft->output)) - flags |=NFT_CACHE_FULL |NFT_CACHE_TERSE ;else flags |=NFT_CACHE_FULL ;break ;
@@ -261,17 +259,15 @@ static unsigned int evaluate_cache_list(struct nft_ctx *nft, struct cmd *cmd, flags |=NFT_CACHE_TABLE |NFT_CACHE_FLOWTABLE ;break ;case CMD_OBJ_RULESET : -if (nft_output_terse (&nft->output)) - flags |=NFT_CACHE_FULL |NFT_CACHE_TERSE ; -else - flags |=NFT_CACHE_FULL ; -break ;default : flags |=NFT_CACHE_FULL ;break ; } flags |=NFT_CACHE_REFRESH ; +if (nft_output_terse (&nft->output)) + flags |=NFT_CACHE_TERSE ; +return flags; }
Signature · 1 line
2.43.0
Phil Sutter
reviewerQuoted 11 lines · Phil Sutter
This fixes at least 'nft -t list table ...' and 'nft -t list set ...'.
Note how --terse handling for 'list sets/maps' remains in place since setting
NFT_CACHE_TERSEdoes not fully undoNFT_CACHE_SETELEM: setting both enables fetching of anonymous sets which is pointless for that command.Reported-by [email protected]Suggested-by Pablo Neira Ayuso <[email protected]>Signed-off-by Phil Sutter <[email protected]>
Patch applied.