]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
netlink: fix listing of range set elements in host byteorder
authorPablo Neira Ayuso <pablo@netfilter.org>
Sun, 7 Dec 2014 23:25:13 +0000 (00:25 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 9 Dec 2014 18:12:20 +0000 (19:12 +0100)
We have to switch the byteorder of the element in
netlink_delinearize_setelem() for non-range values only.

This fixes the listing of:

  nft add rule filter input ct mark { 0x10-0x20 } counter

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/netlink.c

index 23f38b030451e1db109eab6cbf0a42313f490704..e59e297748134b925b152df1976c099c2004d71e 100644 (file)
@@ -1379,7 +1379,9 @@ static int netlink_delinearize_setelem(struct nft_set_elem *nlse,
        expr = netlink_alloc_value(&netlink_location, &nld);
        expr->dtype     = set->keytype;
        expr->byteorder = set->keytype->byteorder;
-       if (expr->byteorder == BYTEORDER_HOST_ENDIAN)
+
+       if (!(set->flags & SET_F_INTERVAL) &&
+           expr->byteorder == BYTEORDER_HOST_ENDIAN)
                mpz_switch_byteorder(expr->value, expr->len / BITS_PER_BYTE);
 
        if (flags & NFT_SET_ELEM_INTERVAL_END) {