]> git.ipfire.org Git - thirdparty/nftables.git/commit
netlink: store set byteorder in NFTA_SET_USERDATA
authorPablo Neira Ayuso <pablo@netfilter.org>
Sat, 25 Feb 2017 00:02:08 +0000 (01:02 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 25 Feb 2017 12:40:34 +0000 (13:40 +0100)
commit10bdec0add3dcb7c0115575c24a440c66c24f6fd
tree82a0e3c5410b9f1d292261863eca4810f46ae510
parentb9b6092304aef17fea704c25b3d9d7dcdb3995a5
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 <pablo@netfilter.org>
include/rule.h
src/netlink.c