]> git.ipfire.org Git - thirdparty/nftables.git/commit
datatype: fix print of raw numerical symbol values
authorFlorian Westphal <fw@strlen.de>
Mon, 17 Jun 2019 09:55:42 +0000 (11:55 +0200)
committerFlorian Westphal <fw@strlen.de>
Mon, 17 Jun 2019 15:22:15 +0000 (17:22 +0200)
commitca12e455e98fb4247e0aa4c2d361195038debe65
tree5fba8701c290b4edd3123f8b31349e3c496f0c2b
parentdc5372b6e8448549a770f9d09477fd2a9207d69c
datatype: fix print of raw numerical symbol values

The two rules:
arp operation 1-2 accept
arp operation 256-512 accept

are both shown as 256-512:

        chain in_public {
                arp operation 256-512 accept
                arp operation 256-512 accept
                meta mark "1"
                tcp flags 2,4
        }

This is because range expression enforces numeric output,
yet nft_print doesn't respect byte order.

Behave as if we had no symbol in the first place and call
the base type print function instead.

This means we now respect format specifier as well:
chain in_public {
                arp operation 1-2 accept
                arp operation 256-512 accept
                meta mark 0x00000001
                tcp flags 0x2,0x4
}

Without fix, added test case will fail:
'add rule arp test-arp input arp operation 1-2': 'arp operation 1-2' mismatches 'arp operation 256-512'

v2: in case of -n, also elide quotation marks, just as if we would not
have found a symbolic name.

Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/datatype.c
tests/py/arp/arp.t
tests/py/arp/arp.t.payload
tests/py/arp/arp.t.payload.netdev