Article View: linux.kernel.netdev
Article #21059[PATCH net-next 13/15] netfilter: ipset: also report mem size for cidr storage to userspace
From: Pablo Neira Ayuso
Date: Mon, 23 Nov 2026 13:57
Date: Mon, 23 Nov 2026 13:57
43 lines
9285 bytes
9285 bytes
From: Florian Westphal <fw@strlen.de>
After the 'Fixes' commit, the storage is allocated dynamically.
Include this when reporting the mem usage.
Fixes: 8e5fd2a55e24 ("netfilter: ipset: rework cidr bookkeeping")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/ipset/ip_set_hash_gen.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h
index 8ac1b0f04856..e7f2e584a7a5 100644
--- a/net/netfilter/ipset/ip_set_hash_gen.h
+++ b/net/netfilter/ipset/ip_set_hash_gen.h
@@ -616,6 +616,23 @@ mtype_rht_size(struct ip_set *set, u32 *elements, size_t *ext_size)
*elements = ipset_hash_nelems(h);
*ext_size = *elements *
(offsetof(struct mtype_rht_elem, elem) + set->dsize);
+
+#ifdef IP_SET_HASH_WITH_NETS
+ {
+ const struct net_prefixes *nets;
+ int i;
+
+ rcu_read_lock();
+
+ for (i = 0; i < IPSET_NET_COUNT; i++) {
+ nets = rcu_dereference(h->rnets[i]);
+ if (nets)
+ *ext_size += ksize(nets);
+ }
+
+ rcu_read_unlock();
+ }
+#endif
}
/**
--
2.47.3
Technical Details
Message-ID:
<20261123135726.3940688-14-pablo@netfilter.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369453-linux-kernel-netdev=dewy.ruReferences:
<20261123135726.3940688-1-pablo@netfilter.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369453-linux-kernel-netdev=dewy.ru From: pablo@netfilter.org (Pablo Neira Ayuso) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next 13/15] netfilter: ipset: also report mem size for cidr storage to userspace Date: Mon, 23 Nov 2026 14:57:24 +0100 Organization: Usenet Network Message-ID: <20261123135726.3940688-14-pablo@netfilter.org> References: <20261123135726.3940688-1-pablo@netfilter.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3895450"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:IP6YLqreI7lq8LStdSa1vqvqIms= sha256:yPxXV7sKtjMiFy5QMr+dhGw5IsRdIbCMX4SiuTHedPQ= sha1:w07rUdzuudN7zdkpxvs2qM7cui4= sha256:quunNl8zs18SgsivCGeZGg85tlCm7zilCSj7yFXPgLM= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 0905B125DB9; Mon, 23 Nov 2026 16:59:53 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=netfilter.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1-1PjqEeB92M; Mon, 23 Nov 2026 16:59:49 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369453-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=netfilter.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 5228A125DB6; Mon, 23 Nov 2026 16:59:41 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id A37283BCA4; Mon, 23 Nov 2026 13:58:09 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1795442281; b=ZUcULKsDzWtcVy7JwYpTXnZAY7VYFgSVm3Y342XQEyqUDQbLHil8ei/Jts6eXkHZQdud yyIfa36nGmp5tOmVHP3KWatOz5kkKAhdjuZ/aL/FqHoT7e20OddJnX889k62MoQhrxQ9s TJ7HmSDbpS2dLg9GAVwtP436yyQAJFVT7eQN6WTib217Gwfyoh6RBn7ocV6T0omDnPnGO nvpnOWhtZOX4q7+C/VkiN1g18LxDxsNT0VL0ZWV3aj6PUzd/EgY7EI5hgE/E+y8DqT2ly AbeowbeG8y5vAwvqDStiVzm1cIXPKs6Tk+t3Kq5pjumsj++Ae5ReLSXfuBLZ9XGqJ5w== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795442281; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:From:To: Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=myUGGX+F6ZcHO7a3JIENspm3MjUjgJGi7zSbu1RcHZA=; b=xjExOim925BktYkKYU09nMCkjga911Mmp79eUmb1Rt2wAExdNnpomEfR7vR2FN5pdyAK INgWhhQMZ+Nxfs34Qx8FyheaebzvgKh8oW3wgtJ4rSXYOhYzERYI17/jk7yKMKc0F349R l2MoHu+P/diwGC2vJuzIeQVNGUp74r8m7fa//4W8J8GE695lYFao0HORGA5R9jz8nPgGT ygWXFdVe/oHyPKWASl1OARTYvhmzzXRfOKDUo9S3+Ia5nYgJHf/7KEya+F/lb+hSJmC4T j9CNd1CkAgzrg6FoKCXpqcEHWFD1nw0rhyU249jgOddLBBwiEWVfjX9iEyZ33R4ULAw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=netfilter.org header.i=@netfilter.org header.a=rsa-sha256 header.s=2025 header.b=FLE5ZqIn; dmarc=none header.from=netfilter.org; spf=pass smtp.mailfrom=netfilter.org; arc=fail smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 31183606A69F; Mon, 23 Nov 2026 13:58:01 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=netfilter.org header.i=@netfilter.org header.a=rsa-sha256 header.s=2025 header.b=FLE5ZqIn X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.70.190.124 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795442280; b=JztuWXjGlEmuNhDEFzv9fD7hnke05TyNSw3SaoFH43iqcBNy8RZZSHeVbu/B9LWIyrhy CyWClBvyDrBOdwlTyAVgC6e2DKJyls2yT39XoecmbQSQgzpBL26nQHE3+N4IYPhv9BaKz ilN3dmq/fkgbi5o+J3rZ+uqG17NffbiViXlGLPUdfnpFRJchELO4mntso6XInmM4pVx1a 8UBlS2mcbePWSdlu0+ORQJV8yh6eRsi6OHnByxZonY0bSRGnW9nc83axpEjBECAP4Giqy F5PnEWxufqmHXvepkdPxbFBBD4VZQ/cUTdf+M7uhG/4RHRqidbUSXfyEKnNPksFQZSA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795442280; h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Spam-Status:X-Spam-Checker-Version; bh=myUGGX+F6ZcHO7a3JIENspm3MjUjgJGi7zSbu1RcHZA=; b=Lr4mXnIjzZ/w4nlcQnBaepLX9HMNG8gpPwMs8R562nLXur1czaGaNfTEvaKcMbpjKJEY bJUQO/LvzJjTbMNTtYrz+WkENCj7e6AlMAT9DQmf85VJwaaLFgy9VknV8ZPBbiYon/0Xy qCbSsk+MRLoxNFZqVCVp83mKznYcLvDSqVb5c7oqj0hdCefZLo07ZOQnz4cKgScMdN4B2 mPAtK+/6tsMLz18jbj5QQe1LYsPQ9JIzkT4vvySdGKWBbnUgHu9O9z+4a4E1jI0YvBQOR ebY6pwVLjRqyfOmtvrFzCBiDDRDaMSFahGkhKxA8MBGJCcr8EzFHR0f7iYlrrNwnaiw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=netfilter.org; spf=pass smtp.mailfrom=netfilter.org; dkim=pass header.d=netfilter.org header.i=@netfilter.org header.a=rsa-sha256 header.s=2025 header.b=FLE5ZqIn; arc=none smtp.remote-ip=217.70.190.124 X-Received: from mail.netfilter.org (mail.netfilter.org [217.70.190.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BFAE606A33D; Mon, 23 Nov 2026 13:57:59 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3BFAE606A33D X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=netfilter.org X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=netfilter.org X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netfilter.org; s=2025; t=1795442277; bh=myUGGX+F6ZcHO7a3JIENspm3MjUjgJGi7zSbu1RcHZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FLE5ZqInpE3/HcX3YBZyh7xUtP7y4PcO0N9lUNNi3GMQkitPolfYRXzNJ912boosE bCLRSrQl8ykd2UmzCLLFsZkj94xgBjRroCMmN7NZh1QX51ijczYVvLqQTcdJInWugk UI73HfSYAZCL5/T9JtRHfEyuzC6b+3ou9Uk2qHj7u+XoLUhiIrKCyX46g3V2BApjFe p/OyGULIrJOFe9rZMEjIq3ye8M/jwVCPUJIFvbUvWXJn6OMM0Z/wKZNrLHFZl5vSBf tVefZSnw2cRKB3HLubjr0DSMIGzzYEXvo1R/nGdsUEKSylrAe91iitk8buQe/i97dI ++GmJ7swsVJDg== X-Received: from localhost.localdomain (mail-agni [217.70.190.124]) by mail.netfilter.org (Postfix) with ESMTPSA id 7CD0B602F8; Mon, 23 Nov 2026 14:57:56 +0100 (CET) X-Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com, edumazet@kernel.org, horms@kernel.org, fw@strlen.de, ja@ssi.bg X-Mailer: git-send-email 2.47.3 X-In-Reply-To: <20261123135726.3940688-1-pablo@netfilter.org> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list