]> www.infradead.org Git - users/dwmw2/linux.git/commit
netfilter: nf_tables: fix set size with rbtree backend
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 6 Jan 2025 22:40:50 +0000 (23:40 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 19 Jan 2025 15:41:41 +0000 (16:41 +0100)
commit8d738c1869f611955d91d8d0fd0012d9ef207201
treed5c8a0066cd19a0fecb1f8eae77fecec8003ba27
parent9c7ad35632297edc08d0f2c7b599137e9fb5f9ff
netfilter: nf_tables: fix set size with rbtree backend

The existing rbtree implementation uses singleton elements to represent
ranges, however, userspace provides a set size according to the number
of ranges in the set.

Adjust provided userspace set size to the number of singleton elements
in the kernel by multiplying the range by two.

Check if the no-match all-zero element is already in the set, in such
case release one slot in the set size.

Fixes: 0ed6389c483d ("netfilter: nf_tables: rename set implementations")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_tables.h
net/netfilter/nf_tables_api.c
net/netfilter/nft_set_rbtree.c