]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
src: nft monitor ruleset
authorVarsha Rao <rvarsha016@gmail.com>
Fri, 28 Jul 2017 05:22:09 +0000 (10:52 +0530)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 31 Jul 2017 17:18:04 +0000 (19:18 +0200)
This patch adds event reporting for ruleset, which prints only ruleset
events.

Syntax : nft monitor ruleset

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/rule.h
src/evaluate.c
src/parser_bison.y

index 6acd5fa810ef5fcc3b7b9ef8c4d71063a12df0ed..e22002724f90501e23ab99bbc219d6ab73efb96e 100644 (file)
@@ -396,6 +396,7 @@ enum {
        CMD_MONITOR_OBJ_RULES,
        CMD_MONITOR_OBJ_SETS,
        CMD_MONITOR_OBJ_ELEMS,
+       CMD_MONITOR_OBJ_RULESET,
        CMD_MONITOR_OBJ_MAX
 };
 
index 27feef432ccf2f3997f73682523bc1068ca68a9f..959e8542dfff7bd91246a99075478f59b04c2379 100644 (file)
@@ -3235,6 +3235,18 @@ static uint32_t monitor_flags[CMD_MONITOR_EVENT_MAX][CMD_MONITOR_OBJ_MAX] = {
                                                  (1 << NFT_MSG_DELSET),
                [CMD_MONITOR_OBJ_ELEMS]         = (1 << NFT_MSG_NEWSETELEM) |
                                                  (1 << NFT_MSG_DELSETELEM),
+               [CMD_MONITOR_OBJ_RULESET]       = (1 << NFT_MSG_NEWTABLE) |
+                                                 (1 << NFT_MSG_DELTABLE) |
+                                                 (1 << NFT_MSG_NEWCHAIN) |
+                                                 (1 << NFT_MSG_DELCHAIN) |
+                                                 (1 << NFT_MSG_NEWRULE)  |
+                                                 (1 << NFT_MSG_DELRULE)  |
+                                                 (1 << NFT_MSG_NEWSET)   |
+                                                 (1 << NFT_MSG_DELSET)   |
+                                                 (1 << NFT_MSG_NEWSETELEM) |
+                                                 (1 << NFT_MSG_DELSETELEM) |
+                                                 (1 << NFT_MSG_NEWOBJ)   |
+                                                 (1 << NFT_MSG_DELOBJ),
        },
        [CMD_MONITOR_EVENT_NEW] = {
                [CMD_MONITOR_OBJ_ANY]           = (1 << NFT_MSG_NEWTABLE) |
@@ -3247,6 +3259,12 @@ static uint32_t monitor_flags[CMD_MONITOR_EVENT_MAX][CMD_MONITOR_OBJ_MAX] = {
                [CMD_MONITOR_OBJ_RULES]         = (1 << NFT_MSG_NEWRULE),
                [CMD_MONITOR_OBJ_SETS]          = (1 << NFT_MSG_NEWSET),
                [CMD_MONITOR_OBJ_ELEMS]         = (1 << NFT_MSG_NEWSETELEM),
+               [CMD_MONITOR_OBJ_RULESET]       = (1 << NFT_MSG_NEWTABLE) |
+                                                 (1 << NFT_MSG_NEWCHAIN) |
+                                                 (1 << NFT_MSG_NEWRULE)  |
+                                                 (1 << NFT_MSG_NEWSET)   |
+                                                 (1 << NFT_MSG_NEWSETELEM) |
+                                                 (1 << NFT_MSG_NEWOBJ)
        },
        [CMD_MONITOR_EVENT_DEL] = {
                [CMD_MONITOR_OBJ_ANY]           = (1 << NFT_MSG_DELTABLE) |
@@ -3259,6 +3277,12 @@ static uint32_t monitor_flags[CMD_MONITOR_EVENT_MAX][CMD_MONITOR_OBJ_MAX] = {
                [CMD_MONITOR_OBJ_RULES]         = (1 << NFT_MSG_DELRULE),
                [CMD_MONITOR_OBJ_SETS]          = (1 << NFT_MSG_DELSET),
                [CMD_MONITOR_OBJ_ELEMS]         = (1 << NFT_MSG_DELSETELEM),
+               [CMD_MONITOR_OBJ_RULESET]       = (1 << NFT_MSG_DELTABLE) |
+                                                 (1 << NFT_MSG_DELCHAIN) |
+                                                 (1 << NFT_MSG_DELRULE)  |
+                                                 (1 << NFT_MSG_DELSET)   |
+                                                 (1 << NFT_MSG_DELSETELEM) |
+                                                 (1 << NFT_MSG_DELOBJ),
        },
        [CMD_MONITOR_EVENT_TRACE] = {
                [CMD_MONITOR_OBJ_ANY]           = (1 << NFT_MSG_NEWTABLE) |
@@ -3274,6 +3298,14 @@ static uint32_t monitor_flags[CMD_MONITOR_EVENT_MAX][CMD_MONITOR_OBJ_MAX] = {
                                                  (1 << NFT_MSG_DELCHAIN),
                [CMD_MONITOR_OBJ_RULES]         = (1 << NFT_MSG_NEWRULE) |
                                                  (1 << NFT_MSG_DELRULE),
+               [CMD_MONITOR_OBJ_RULESET]       = (1 << NFT_MSG_NEWTABLE) |
+                                                 (1 << NFT_MSG_NEWCHAIN) |
+                                                 (1 << NFT_MSG_NEWRULE)  |
+                                                 (1 << NFT_MSG_NEWOBJ)   |
+                                                 (1 << NFT_MSG_DELTABLE) |
+                                                 (1 << NFT_MSG_DELCHAIN) |
+                                                 (1 << NFT_MSG_DELRULE)  |
+                                                 (1 << NFT_MSG_DELOBJ),
        },
 };
 
index 45b1dc9f94074774ffa8f6c49c71d01b77a9e4b4..86baf23a00c1c91fece903739c4f3ffb1dbadecc 100644 (file)
@@ -1195,6 +1195,7 @@ monitor_object            :       /* empty */     { $$ = CMD_MONITOR_OBJ_ANY; }
                        |       SETS            { $$ = CMD_MONITOR_OBJ_SETS; }
                        |       RULES           { $$ = CMD_MONITOR_OBJ_RULES; }
                        |       ELEMENTS        { $$ = CMD_MONITOR_OBJ_ELEMS; }
+                       |       RULESET         { $$ = CMD_MONITOR_OBJ_RULESET; }
                        ;
 
 monitor_format         :       /* empty */     { $$ = NFTNL_OUTPUT_DEFAULT; }