From b9b6092304aef17fea704c25b3d9d7dcdb3995a5 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 24 Feb 2017 20:47:49 +0100 Subject: evaluate: store byteorder for set keys Selectors that rely on the integer type and expect host endian byteorder don't work properly. We need to keep the byteorder around based on the left hand size expression that provides the context, so store the byteorder when evaluating the map. Before this patch. # nft --debug=netlink add rule x y meta mark set meta cpu map { 0 : 1, 1 : 2 } __map%d x b __map%d x 0 element 00000000 : 00000001 0 [end] element 01000000 : 00000002 0 [end] ^^^^^^^^ This is expressed in network byteorder, because the invalid byteorder defaults on this. After this patch: # nft --debug=netlink add rule x y meta mark set meta cpu map { 0 : 1, 1 : 2 } __map%d x b __map%d x 0 element 00000000 : 00000001 0 [end] element 00000001 : 00000002 0 [end] ^^^^^^^^ This is in host byteorder, as the key selector in the map mandates. Signed-off-by: Pablo Neira Ayuso --- src/rule.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/rule.c') diff --git a/src/rule.c b/src/rule.c index 0d58073f..b47076f0 100644 --- a/src/rule.c +++ b/src/rule.c @@ -210,6 +210,7 @@ void set_free(struct set *set) if (set->init != NULL) expr_free(set->init); handle_free(&set->handle); + set_keytype_destroy(set->keytype); xfree(set); } -- cgit v1.2.3