]> git.ipfire.org Git - thirdparty/nftables.git/commit
segtree: incomplete output in get element command with maps
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 6 Mar 2025 17:49:21 +0000 (18:49 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 7 Mar 2025 12:56:47 +0000 (13:56 +0100)
commit6db28b2d71e7f61c64338787be5d82edfdb62a21
treefb86a271c4deec17724e371199f110eaf5f420ff
parent2b164aec4295d5f4f6d45aa098279494ab44289b
segtree: incomplete output in get element command with maps

get element command displays an incomplete range.

Using this simple test ruleset:

 table ip x {
        map y {
                typeof ip saddr : meta mark
                counter
                flags interval,timeout
                elements = { 1.1.1.1-1.1.1.10 timeout 10m : 20, 2.2.2.2-2.2.2.5 timeout 10m : 30}
        }

then, invoking the get element command:

 # nft get element x y { 1.1.1.2 }

results in, before (incomplete output):

 table ip x {
        map y {
                type ipv4_addr : mark
                flags interval,timeout
                elements = { 1.1.1.1 counter packets 0 bytes 0 timeout 10m expires 1m24s160ms : 0x00000014 }
        }
 }

Note that it displays 1.1.1.1, instead of 1.1.1.1-1.1.1.10.

After this fix:

 table ip x {
        map y {
                type ipv4_addr : mark
                flags interval,timeout
                elements = { 1.1.1.1-1.1.1.10 counter packets 0 bytes 0 timeout 10m expires 1m24s160ms : 0x00000014 }
        }
 }

Fixes: a43cc8d53096 ("src: support for get element command")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/segtree.c