Re: [PATCH nftables,v2 2/2] src: add set element catch-all support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 11, 2021 at 03:05:38PM +0200, Pablo Neira Ayuso wrote:
[...]
> diff --git a/src/expression.c b/src/expression.c
> index 9fdf23d98446..4d80e37a5bb6 100644
> --- a/src/expression.c
> +++ b/src/expression.c
> @@ -1270,7 +1270,11 @@ static void set_elem_expr_print(const struct expr *expr,
>  {
>  	struct stmt *stmt;
>  
> -	expr_print(expr->key, octx);
> +	if (expr->key->etype == EXPR_SET_ELEM_CATCHALL)
> +		nft_print(octx, "*");
> +	else
> +		expr_print(expr->key, octx);
> +
>  	list_for_each_entry(stmt, &expr->stmt_list, list) {
>  		nft_print(octx, " ");
>  		stmt_print(stmt, octx);
> @@ -1299,7 +1303,9 @@ static void set_elem_expr_destroy(struct expr *expr)
[...]
> @@ -1328,6 +1334,24 @@ struct expr *set_elem_expr_alloc(const struct location *loc, struct expr *key)
>  	return expr;
>  }
>  
> +static void set_elem_catchall_expr_print(const struct expr *expr,
> +					 struct output_ctx *octx)
> +{
> +	nft_print(octx, "_");
> +}

This is a leftover from v1. Since this went unnoticed, maybe you could
drop the special casing in set_elem_expr_print() and rely on
expr_print(expr->key, octx) to call the above? Or am I (probably)
confusing things?

Cheers, Phil



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux