]> git.ipfire.org Git - thirdparty/libnftnl.git/commitdiff
expr: lookup: print flags only if they are available
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 21 Jul 2016 17:14:13 +0000 (19:14 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 21 Jul 2016 18:12:49 +0000 (20:12 +0200)
Follow same approach as with other objects, print what it is set only.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/expr/lookup.c

index 16cfce21d69ceeaa5dd2ec70091119f185b58501..97478c25ffef3e1adeeafd37479a01ec29e22fb6 100644 (file)
@@ -264,8 +264,10 @@ nftnl_expr_lookup_snprintf_default(char *buf, size_t size,
                SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
        }
 
-       ret = snprintf(buf + offset, len, "0x%x ", l->flags);
-       SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
+       if (e->flags & (1 << NFTNL_EXPR_LOOKUP_FLAGS)) {
+               ret = snprintf(buf + offset, len, "0x%x ", l->flags);
+               SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
+       }
 
        return offset;
 }