Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.216.245.30 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796058197; b=Zxsn9FYaSWWu4ElcSLVilFR6SqsBU9nWeFS+4PyoRoBjV8MOomshxKtqYKWsaT/+EmVX XpyzjKhaZRzCtTdTzaUN18WdN6MW3YXOatldTCQBuPdgwXz4cmyotYOKgG2bUCg4XQBJS TsImXcLXmQ54HSruR9xIf9vioLRAZOJAKAkhcuRCtVoGUJai395COhkjp2KBzilCP3Iy2 3n81XH0cD19MMwhEot36JnyccwIzgkgYV+YCQDCEYhNnlsymzCQmrzIsMdETuezSvU+FY C86gy1qoZz7t8Votbitk3Ni6BRdFX1c9e/iDnsekmzm/KWPuLEmmjFs5npv3UCTJe2A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796058197; h=DMARC-Filter:Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding; bh=Ztl3uvRjtMmdz/ycvw0EVtoNYPFWS6I9tywAuMVb7T0=; b=y31C7sfRUookehkda5Htz8l+3hVVUyID8XF3vfiuP21csYdq9RX8Me9CLnyXfpaLgcg4 hM5C0QCaM4rd8Z1LjkSoUCafhk7lxMztJQpg7rhutM7vPbIlO6ARWMcH+qk7jMWUDEm1r GKKvy5yOhrV/cqzVapqe0Xba/lkvWGqtqMyG3+MHaDkjnYdh1iBgnv30XU0uCaDfklFV3 M/pMiDMVcpkr/b4pgpzb5OMgl0D2rfzggz3mssbyC4Kb0kAWc8bV0/Les3XYBTBhDHJBd rau9MSPpUkWuhLlZSAW8U7ekgP7aIQcyRdbxnkgPturMIcXP03H3hKABFqRP8tYpuJw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=strlen.de; spf=pass smtp.mailfrom=Chamillionaire.breakpoint.cc; arc=none smtp.remote-ip=91.216.245.30 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [91.216.245.30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 638E1606A327 for ; Mon, 30 Nov 2026 17:03:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 638E1606A327 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=Chamillionaire.breakpoint.cc Received: by Chamillionaire.breakpoint.cc (Postfix, from userid 1003) id 070786045B; Mon, 30 Nov 2026 18:03:14 +0100 (CET) From: Florian Westphal To: Cc: Florian Westphal Subject: [PATCH nf-next v12 0/5] ipset: replace internal hash table with rhashtable Date: Mon, 30 Nov 2026 18:00:12 +0100 Message-ID: <20261130170017.28897-1-fw@strlen.de> X-Mailer: git-send-email 2.56.1 X-Mailing-List: netfilter-devel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit v12: patch 3: revert v11 yielding in mtype_list; it makes things unecessarily complex and requires pathological case where rhashtable is huge, virtually empty and all elements are timed out. No other changes. v11: - Only first patch is unchanged (I ignored AI comments) - patch 2 only has commit message changed - squash patch 4 into patch 3, AI complained about Fixes-tag and stable backport (it was dependant on rhashtable too) - changes in patches 3, 4, 5, see those patches for details. 1) Add rhashtable_flush_and_free, From Herbert Xu. The initial user of this function is added in patch 3. 2) Add rhashtable boilerplate stubs to ipset. Implement its initialization and destruction logic. 3) Replace ipset internal hash tables with rhashtables. This drops functionality, in particular, MULTI sets will not work correctly. This is restored in patch 5. 4) Reimplement hash:net,iface (IP_SET_HASH_WITH_MULTI) using a group-of-elements structure with explicit exact-over-wildcard match priority. Update gc, list, flush, and destroy paths for the extra group level. 5) Restore SET_WITH_FORCEADD eviction support to netfilter ipset. Add mtype_remove_random() helper to facilitate element eviction during additions. Florian Westphal (4): netfilter: ipset: add rhashtable boilerplate stubs netfilter: ipset: replace internal hash table with rhashtable netfilter: ipset: re-add IP_SET_HASH_WITH_MULTI support netfilter: ipset: re-add forceadd support Herbert Xu (1): rhashtable: Add rhashtable_flush_and_free helper include/linux/rhashtable.h | 40 +- lib/rhashtable.c | 186 +- net/netfilter/ipset/ip_set_hash_gen.h | 2210 ++++++++++-------- net/netfilter/ipset/ip_set_hash_ip.c | 6 +- net/netfilter/ipset/ip_set_hash_ipmac.c | 6 +- net/netfilter/ipset/ip_set_hash_ipmark.c | 6 +- net/netfilter/ipset/ip_set_hash_ipport.c | 6 +- net/netfilter/ipset/ip_set_hash_ipportip.c | 6 +- net/netfilter/ipset/ip_set_hash_ipportnet.c | 6 +- net/netfilter/ipset/ip_set_hash_mac.c | 3 +- net/netfilter/ipset/ip_set_hash_net.c | 6 +- net/netfilter/ipset/ip_set_hash_netiface.c | 73 +- net/netfilter/ipset/ip_set_hash_netnet.c | 6 +- net/netfilter/ipset/ip_set_hash_netport.c | 6 +- net/netfilter/ipset/ip_set_hash_netportnet.c | 6 +- 15 files changed, 1502 insertions(+), 1070 deletions(-) -- 2.56.1