All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: [nft PATCH 03/15] mnl: Fix for missing info in rule dumps
Date: Wed, 24 Nov 2021 18:22:39 +0100	[thread overview]
Message-ID: <20211124172251.11539-4-phil@nwl.cc> (raw)
In-Reply-To: <20211124172251.11539-1-phil@nwl.cc>

Commit 0e52cab1e64ab improved error reporting by adding rule's table and
chain names to netlink message directly, prefixed by their location
info. This in turn caused netlink dumps of the rule to not contain table
and chain name anymore. Fix this by inserting the missing info before
dumping and remove it afterwards to not cause duplicated entries in
netlink message.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 src/netlink_linearize.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/netlink_linearize.c b/src/netlink_linearize.c
index 111102fd43346..34a6e1a941b56 100644
--- a/src/netlink_linearize.c
+++ b/src/netlink_linearize.c
@@ -1673,5 +1673,16 @@ void netlink_linearize_rule(struct netlink_ctx *ctx,
 		nftnl_udata_buf_free(udata);
 	}
 
-	netlink_dump_rule(lctx->nlr, ctx);
+	if (ctx->nft->debug_mask & NFT_DEBUG_NETLINK) {
+		nftnl_rule_set_str(lctx->nlr, NFTNL_RULE_TABLE,
+				   rule->handle.table.name);
+		if (rule->handle.chain.name)
+			nftnl_rule_set_str(lctx->nlr, NFTNL_RULE_CHAIN,
+					   rule->handle.chain.name);
+
+		netlink_dump_rule(lctx->nlr, ctx);
+
+		nftnl_rule_unset(lctx->nlr, NFTNL_RULE_CHAIN);
+		nftnl_rule_unset(lctx->nlr, NFTNL_RULE_TABLE);
+	}
 }
-- 
2.33.0


  parent reply	other threads:[~2021-11-24 17:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24 17:22 [nft PATCH 00/15] Fix netlink debug output on Big Endian Phil Sutter
2021-11-24 17:22 ` [nft PATCH 01/15] tests/py: Avoid duplicate records in *.got files Phil Sutter
2021-11-24 17:22 ` [nft PATCH 02/15] exthdr: Fix for segfault with unknown exthdr Phil Sutter
2021-11-24 17:22 ` Phil Sutter [this message]
2021-11-24 17:22 ` [nft PATCH 04/15] src: Fix payload statement mask on Big Endian Phil Sutter
2021-11-24 17:22 ` [nft PATCH 05/15] meta: Fix {g,u}id_type " Phil Sutter
2021-11-24 17:22 ` [nft PATCH 06/15] meta: Fix hour_type size Phil Sutter
2021-11-24 17:22 ` [nft PATCH 07/15] datatype: Fix size of time_type Phil Sutter
2021-11-24 17:22 ` [nft PATCH 08/15] ct: Fix ct label value parser Phil Sutter
2021-11-24 17:22 ` [nft PATCH 09/15] netlink_delinearize: Fix for escaped asterisk strings on Big Endian Phil Sutter
2021-11-24 17:22 ` [nft PATCH 10/15] Make string-based data types " Phil Sutter
2021-11-24 17:22 ` [nft PATCH 11/15] evaluate: Fix key byteorder value in range sets/maps Phil Sutter
2021-11-24 17:22 ` [nft PATCH 12/15] include: Use struct nftnl_set_desc Phil Sutter
2021-11-24 17:22 ` [nft PATCH 13/15] mnl: Provide libnftnl with set element meta info when dumping Phil Sutter
2021-11-24 17:22 ` [nft PATCH 14/15] tests/py/tools: Add regen_payloads.sh Phil Sutter
2021-11-30 13:47 ` [nft PATCH 00/15] Fix netlink debug output on Big Endian Pablo Neira Ayuso
2021-11-30 13:55   ` Phil Sutter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211124172251.11539-4-phil@nwl.cc \
    --to=phil@nwl.cc \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.