]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
rule: fix netlink debug flag when listing table/rules
authorFlorian Westphal <fw@strlen.de>
Wed, 18 Oct 2017 23:03:20 +0000 (01:03 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 19 Oct 2017 11:11:27 +0000 (13:11 +0200)
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>
src/rule.c

index d744cf611100f6dbcd65a6d92601b8a9fb5a1997..d83284e5414f17e6731c736e6753322fa49ef270 100644 (file)
@@ -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;