diff mbox series

[nft] rule: fix netlink debug flag when listing table/rules

Message ID 20171018230607.22375-1-fw@strlen.de
State Accepted
Delegated to: Pablo Neira
Headers show
Series [nft] rule: fix netlink debug flag when listing table/rules | expand

Commit Message

Florian Westphal Oct. 18, 2017, 11:06 p.m. UTC
nft --debug=netlink list table ...
has no effect anymore.

Callers pass in debug_mask & DEBUG_NETLINK, which gets converted
to 0/1 because the arg is a boolean.

Later on this bool is converted back to an integer, but that
won't have the desired result.

Fixes: be441e1ffdc24 ("src: add debugging mask to context structure")
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 src/rule.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Pablo Neira Ayuso Oct. 19, 2017, 9:56 a.m. UTC | #1
On Thu, Oct 19, 2017 at 01:06:07AM +0200, Florian Westphal wrote:
> nft --debug=netlink list table ...
> has no effect anymore.
> 
> Callers pass in debug_mask & DEBUG_NETLINK, which gets converted
> to 0/1 because the arg is a boolean.
> 
> Later on this bool is converted back to an integer, but that
> won't have the desired result.
> 
> Fixes: be441e1ffdc24 ("src: add debugging mask to context structure")
> Signed-off-by: Florian Westphal <fw@strlen.de>

Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/src/rule.c b/src/rule.c
index d744cf611100..d83284e5414f 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -123,7 +123,7 @@  static int cache_init_objects(struct netlink_ctx *ctx, enum cmd_ops cmd)
 
 static int cache_init(struct mnl_socket *nf_sock, struct nft_cache *cache,
 		      enum cmd_ops cmd, struct list_head *msgs,
-		      unsigned int debug_mask, struct output_ctx *octx)
+		      bool debug, struct output_ctx *octx)
 {
 	struct handle handle = {
 		.family = NFPROTO_UNSPEC,
@@ -134,7 +134,7 @@  static int cache_init(struct mnl_socket *nf_sock, struct nft_cache *cache,
 		.cache		= cache,
 		.msgs		= msgs,
 		.seqnum		= cache->seqnum++,
-		.debug_mask	= debug_mask,
+		.debug_mask	= debug ? DEBUG_NETLINK : 0,
 		.octx		= octx,
 	};
 	int ret;