Re: [PATCH] src: print 'handle' attribute in tables

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

 



Hello,

Le 23/12/2017 à 20:45, Harsha Sharma a écrit :
> Print 'handle' attribute in tables, when listing via '-a' option
> 
> For eg.
> nft list ruleset -a
> 
> table ip test-ip4 {
> 	chain input {
> 		ip saddr 8.8.8.8 counter packets 0 bytes 0 # handle 3
> 	}
>  # handle 1}

[...]

> diff --git a/src/rule.c b/src/rule.c
> index bb9add0..e875816 100644
> --- a/src/rule.c
> +++ b/src/rule.c
> @@ -820,6 +820,8 @@ static void table_print(const struct table *table, struct output_ctx *octx)
>  		chain_print(chain, octx);
>  		delim = "\n";
>  	}
> +	if (octx->handle > 0)
> +		nft_print(octx, " # handle %" PRIu64, table->handle.handle.id);
>  	nft_print(octx, "}\n");
>  }
>  
> 

I'm wonderning if it wouldn't be easier (for something parsing "nft list ruleset -a" 's output) to have the " # handle ..." after the closing brace instead of before. It makes sence to consider "#" as a start of comment until end of line, and in such case the last "}" would be in the comment and missing (for something choosing to ignore all such "comments").

So the example would become instead:

nft list ruleset -a

table ip test-ip4 {
	chain input {
		ip saddr 8.8.8.8 counter packets 0 bytes 0 # handle 3
	}
} # handle 1

What do you think?

regards,
Adel Belhouane.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux