Re: [PATCH RFC nf-next 07/12] netfilter: ipset: add rhashtable boilerplate stubs
Jozsef Kadlecsik <[email protected]> Thu, 16 Jul 2026 14:53:55 +0200 (CEST)
| Newsgroups | gmane.comp.security.firewalls.netfilter.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Florian,
On Tue, 14 Jul 2026, Florian Westphal wrote:
> Preparation patch. Adds an rhashtable to the set and initialised
> and destroys it. No elements are ever added to this hashtable.
>
> This change is supposed to be devoid of side effects and is
> separate to reduce size of the conversion patch.
> +/* 0 = key matches object (equal), non-zero = not equal */
> +static int mtype_rht_cmpfn(struct rhashtable_compare_arg *arg, const void *obj)
> +{
> + const struct mtype_rht_elem *e = obj;
> + u32 multi = 0;
> +
> + return !mtype_data_equal(&e->elem,
> + (const struct mtype_elem *)arg->key, &multi);
> +}
It does not belong to this patch, but the "multi" arg of
mtype_data_equal() is needed only for the netiface type: it supports the
same ip/cidr behind multiple interfaces but the element can store a single
interface only. The "multi" flag made possible to take into account
multiple interfaces properly when growing the array in the hash.
The interfaces should be stored in a linked list at element level and the
"multi" arg of mtype_data_equal() can be removed, which is not needed in
rhashtable anyway.
Best regards,
Jozsef