Linux Netfilter development
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com, fw@strlen.de
Subject: [PATCH net-next 17/17] netfilter: xt_recent: Lift restrictions on max hitcount value
Date: Fri, 28 Jun 2024 18:05:05 +0200	[thread overview]
Message-ID: <20240628160505.161283-18-pablo@netfilter.org> (raw)
In-Reply-To: <20240628160505.161283-1-pablo@netfilter.org>

From: Phil Sutter <phil@nwl.cc>

Support tracking of up to 65535 packets per table entry instead of just
255 to better facilitate longer term tracking or higher throughput
scenarios.

Note how this aligns sizes of struct recent_entry's 'nstamps' and
'index' fields when 'nstamps' was larger before. This is unnecessary as
the value of 'nstamps' grows along with that of 'index' after being
initialized to 1 (see recent_entry_update()). Its value will thus never
exceed that of 'index' and therefore does not need to provide space for
larger values.

Requested-by: Fabio <pedretti.fabio@gmail.com>
Link: https://bugzilla.netfilter.org/show_bug.cgi?id=1745
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/xt_recent.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
index ef93e0d3bee0..588a5e6ad899 100644
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -59,9 +59,9 @@ MODULE_PARM_DESC(ip_list_gid, "default owning group of /proc/net/xt_recent/* fil
 /* retained for backwards compatibility */
 static unsigned int ip_pkt_list_tot __read_mostly;
 module_param(ip_pkt_list_tot, uint, 0400);
-MODULE_PARM_DESC(ip_pkt_list_tot, "number of packets per IP address to remember (max. 255)");
+MODULE_PARM_DESC(ip_pkt_list_tot, "number of packets per IP address to remember (max. 65535)");
 
-#define XT_RECENT_MAX_NSTAMPS	256
+#define XT_RECENT_MAX_NSTAMPS	65536
 
 struct recent_entry {
 	struct list_head	list;
@@ -69,7 +69,7 @@ struct recent_entry {
 	union nf_inet_addr	addr;
 	u_int16_t		family;
 	u_int8_t		ttl;
-	u_int8_t		index;
+	u_int16_t		index;
 	u_int16_t		nstamps;
 	unsigned long		stamps[];
 };
@@ -80,7 +80,7 @@ struct recent_table {
 	union nf_inet_addr	mask;
 	unsigned int		refcnt;
 	unsigned int		entries;
-	u8			nstamps_max_mask;
+	u_int16_t		nstamps_max_mask;
 	struct list_head	lru_list;
 	struct list_head	iphash[];
 };
-- 
2.30.2


      parent reply	other threads:[~2024-06-28 16:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-28 16:04 [PATCH net-next 00/17] Netfilter/IPVS updates for net-next Pablo Neira Ayuso
2024-06-28 16:04 ` [PATCH net-next 01/17] netfilter: nf_tables: make struct nft_trans first member of derived subtypes Pablo Neira Ayuso
2024-07-01  9:00   ` patchwork-bot+netdevbpf
2024-06-28 16:04 ` [PATCH net-next 02/17] netfilter: nf_tables: move bind list_head into relevant subtypes Pablo Neira Ayuso
2024-06-28 16:04 ` [PATCH net-next 03/17] netfilter: nf_tables: compact chain+ft transaction objects Pablo Neira Ayuso
2024-06-28 16:04 ` [PATCH net-next 04/17] netfilter: nf_tables: reduce trans->ctx.table references Pablo Neira Ayuso
2024-06-28 16:04 ` [PATCH net-next 05/17] netfilter: nf_tables: pass nft_chain to destroy function, not nft_ctx Pablo Neira Ayuso
2024-06-28 16:04 ` [PATCH net-next 06/17] netfilter: nf_tables: pass more specific nft_trans_chain where possible Pablo Neira Ayuso
2024-06-28 16:04 ` [PATCH net-next 07/17] netfilter: nf_tables: avoid usage of embedded nft_ctx Pablo Neira Ayuso
2024-06-28 16:04 ` [PATCH net-next 08/17] netfilter: nf_tables: store chain pointer in rule transaction Pablo Neira Ayuso
2024-06-28 16:04 ` [PATCH net-next 09/17] netfilter: nf_tables: reduce trans->ctx.chain references Pablo Neira Ayuso
2024-06-28 16:04 ` [PATCH net-next 10/17] netfilter: nf_tables: pass nft_table to destroy function Pablo Neira Ayuso
2024-06-28 16:04 ` [PATCH net-next 11/17] netfilter: nf_tables: do not store nft_ctx in transaction objects Pablo Neira Ayuso
2024-06-28 16:05 ` [PATCH net-next 12/17] ipvs: Avoid unnecessary calls to skb_is_gso_sctp Pablo Neira Ayuso
2024-06-28 16:05 ` [PATCH net-next 13/17] netfilter: nf_conncount: fix wrong variable type Pablo Neira Ayuso
2024-06-28 16:05 ` [PATCH net-next 14/17] netfilter: cttimeout: remove 'l3num' attr check Pablo Neira Ayuso
2024-06-28 16:05 ` [PATCH net-next 15/17] netfilter: nf_tables: rise cap on SELinux secmark context Pablo Neira Ayuso
2024-06-28 16:05 ` [PATCH net-next 16/17] selftests: netfilter: nft_queue.sh: add test for disappearing listener Pablo Neira Ayuso
2024-06-28 16:05 ` Pablo Neira Ayuso [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240628160505.161283-18-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox