All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nft] set_elem: convert flag value to inclusive-OR binops during delinearize
@ 2015-03-23 23:40 Patrick McHardy
  0 siblings, 0 replies; only message in thread
From: Patrick McHardy @ 2015-03-23 23:40 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

When a set contains combined flag values, they are displayed as numeric
value since they don't match any of the single flag values:

tcp flags { 18, psh, syn}

Convert to a series of inclusive-OR binops of the single flag values
for improved readability:

tcp flags { syn | ack, psh, syn}

Signed-off-by: Patrick McHardy <kaber@trash.net>
---
 src/netlink.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/netlink.c b/src/netlink.c
index bd6aa93..24dda67 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -1383,6 +1383,10 @@ static int netlink_delinearize_setelem(struct nft_set_elem *nlse,
 	    expr->byteorder == BYTEORDER_HOST_ENDIAN)
 		mpz_switch_byteorder(expr->value, expr->len / BITS_PER_BYTE);
 
+	if (expr->dtype->basetype != NULL &&
+	    expr->dtype->basetype->type == TYPE_BITMASK)
+		expr = bitmask_expr_to_binops(expr);
+
 	if (flags & NFT_SET_ELEM_INTERVAL_END) {
 		expr->flags |= EXPR_F_INTERVAL_END;
 	} else {
-- 
2.1.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-03-23 23:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-23 23:40 [PATCH nft] set_elem: convert flag value to inclusive-OR binops during delinearize Patrick McHardy

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.