Skip to contentSkip to conversation

expr: lookup: print flags only if they are available

PATCH New Pablo Neira Ayuso 1 participant 1 message Jul 21, 2016 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 expr: lookup: print flags only if they are available

Follow same approach as with other objects, print what it is set only.

---
 src/expr/lookup.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
src/expr/lookup.c +4 -2
index 16cfce2..97478c2 100644
@@ -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;
 }
Signature · 1 line
2.1.4