From 293c9b114faef074dbbda06df73f86317d28ef9b Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado Gomez" Date: Thu, 3 Sep 2020 11:16:06 +0200 Subject: src: add comment support for objects Enables specifying an optional comment when declaring named objects. The comment is to be specified inside the object's block ({} block) Relies on libnftnl exporting nftnl_obj_get_data and kernel space support to store the comments. For consistency, this patch makes the comment be printed first when listing objects. Adds a testcase importing all commented named objects except for secmark, although it's supported. Example: Adding a quota with a comment > add table inet filter > nft add quota inet filter q { over 1200 bytes \; comment "test_comment"\; } > list ruleset table inet filter { quota q { comment "test_comment" over 1200 bytes } } Signed-off-by: Jose M. Guisado Gomez Signed-off-by: Pablo Neira Ayuso --- include/rule.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/rule.h') diff --git a/include/rule.h b/include/rule.h index 56f1951f..837005b1 100644 --- a/include/rule.h +++ b/include/rule.h @@ -479,6 +479,7 @@ struct obj { struct handle handle; uint32_t type; unsigned int refcnt; + const char *comment; union { struct counter counter; struct quota quota; -- cgit v1.2.3