selftests: netfilter: add test case for recent mismatch bug
authorFlorian Westphal <fw@strlen.de>
Mon, 15 Jul 2024 11:55:29 +0000 (13:55 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 17 Jul 2024 17:00:47 +0000 (19:00 +0200)
commit0935ee6032dfe68bd1f8ddf4c43b618d7beafc69
tree666d7d6a9005c05cf70b45de32c1c8b6aa927b38
parent791a615b7ad2258c560f91852be54b0480837c93
selftests: netfilter: add test case for recent mismatch bug

Without 'netfilter: nf_set_pipapo: fix initial map fill' this fails:

TEST: reported issues
  Add two elements, flush, re-add       1s                              [ OK ]
  net,mac with reload                   1s                              [ OK ]
  net,port,proto                        1s                              [FAIL]
post-add: should have returned 10.5.8.0/24 . 51-60 . 6-17  but got table inet filter {
        set test {
                type ipv4_addr . inet_service . inet_proto
                flags interval,timeout
                elements = { 10.5.7.0/24 . 51-60 . 6-17 }
        }
}

The other sets defined in the selftest do not trigger this bug, it only
occurs if the first field group bitsize is smaller than the largest
group bitsize.

For each added element, check 'get' works and actually returns the
requested range.
After map has been filled, check all added ranges can still be
retrieved.

For each deleted element, check that 'get' fails.

Based on a reproducer script from Yi Chen.

Signed-off-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tools/testing/selftests/net/netfilter/nft_concat_range.sh