From 10bdec0add3dcb7c0115575c24a440c66c24f6fd Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sat, 25 Feb 2017 01:02:08 +0100 Subject: netlink: store set byteorder in NFTA_SET_USERDATA The integer datatype has neither specific byteorder nor length. This results in the following broken output: # nft list ruleset table ip x { chain y { mark set cpu map { 0 : 0x00000001, 16777216 : 0x00000002} } } Currently, with BYTEORDER_INVALID, nft defaults on network byteorder, hence the output above. This patch stores the key byteorder in the userdata using a TLV structure in the NFTA_SET_USERDATA area, so nft can interpret key accordingly when dumping the set back to userspace. Thus, after this patch the listing is correct: # nft list ruleset table ip x { chain y { mark set cpu map { 0 : 0x00000001, 1 : 0x00000002} } } Signed-off-by: Pablo Neira Ayuso --- include/rule.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/rule.h b/include/rule.h index 878563d9..f5160daf 100644 --- a/include/rule.h +++ b/include/rule.h @@ -477,4 +477,10 @@ enum udata_type { #define UDATA_COMMENT_MAXLEN 128 +enum udata_set_type { + UDATA_SET_KEYBYTEORDER, + __UDATA_SET_MAX, +}; +#define UDATA_SET_MAX (__UDATA_SET_MAX - 1) + #endif /* NFTABLES_RULE_H */ -- cgit v1.2.3