From nobody Fri Nov 14 04:10:34 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4d73Zz0mMWz6GrJZ; Fri, 14 Nov 2025 04:10:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4d73Zy2vNrz3Dsr; Fri, 14 Nov 2025 04:10:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763093434; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7WZUoQiR9IMbwBXz28eq5pOxr1avzn8AXeOR9FeuKto=; b=bVqjJiROA7RFNRHNzuXVtwDDnVhBSs8RlbfZjIaqAahahtoDUp6CTWiOmOL/2jgp2yveNJ mRpOlVP9ssA8BMmuS3eS3CWUsubyCHU0jvj0VNIqlUsyr2x4uczmlwT1DsTXoK6t4YatWJ 8QmMPmLSD8DSKibEKj8ImYaAwghPMpLaGG0LCDOXMkohOpZABKPXxG6Be5f8/yEFJ4sNJY Niuw7JZtirRGsanKMvBCN03s+ufCycPe+c1Mw1SeGllAqqmEaXtOgFREs2Nrziqm+FcOmn X2JSTHS3mKkXRjgAQ5WEJh1d66Uc/6oaCVARZYt5aWzB+ePPtFeBV6VVJpYBtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763093434; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7WZUoQiR9IMbwBXz28eq5pOxr1avzn8AXeOR9FeuKto=; b=HbF9llJlKGXWRWUK+iPqCdB9UEkBXt0tXmOYEhqWFX8oc2qxAqet+nTYk8PAeAIgQI2uTC qN8IawEIJCGA/XCY9H10DENTI8kQEQtpwfHfRzGHfViLnG2C0+Bz/rpvG/CoJL+G1bJO3w CBs0k31HeL0OCFNG4ZXMuS2M3VhDY5Bo6UvnZvkabFdXgOHgSoXWIYlxNpzffk0FajdMr9 LJGUtzrCoLTE6lZQ6QqpDk2FeEQxY1OYXgL0MNcSE6wRFu0oVBO9YUyc2dEdYWqVikbAuY GoHkIjoIqL4mCWg1nJYdU/OhWYgEKaODWAjeZuIPy2YQDcSs45xyRfoulIX5qQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1763093434; a=rsa-sha256; cv=none; b=AKPhL/436wMH5BFJ6H5xeQBUU910dItjnfQXZY+1IlCg4yjQ5aSnQy3IENf5wcKzprXjqP y72TecfZeDggNXiTJ+uEjYKLcFkMNN9oRbz90n2n8qEvJ1ZXZiTyhsHkuzLDc32REPYRUr 6D44WyYuNnIO1IWRgxp3BFszt9dJXBXQIaY75SEBitGkt9tNwhFa4VHJ80v8v5UzER6pDw W4sWK04MnhLuBZzds9LX6rD//GffY42J70DcwdvbW2cpO7Vp4SCAJgijhAcmnO3TN9Y9/E IR8KbAdRuLpfYVl5fdhRyoh+ETphcFJDA795NM3aFAzJiqkQm12VHwPGVB5rOA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4d73Zy28TCzr5Y; Fri, 14 Nov 2025 04:10:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5AE4AYoQ082094; Fri, 14 Nov 2025 04:10:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5AE4AYHg082092; Fri, 14 Nov 2025 04:10:34 GMT (envelope-from git) Date: Fri, 14 Nov 2025 04:10:34 GMT Message-Id: <202511140410.5AE4AYHg082092@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: fe38c4fcb826 - stable/15 - ipfilter: Add an htable max size tuneable. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: fe38c4fcb826eaefbeefa2d4d6724b856f24fccf Auto-Submitted: auto-generated The branch stable/15 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=fe38c4fcb826eaefbeefa2d4d6724b856f24fccf commit fe38c4fcb826eaefbeefa2d4d6724b856f24fccf Author: Cy Schubert AuthorDate: 2025-10-22 22:56:50 +0000 Commit: Cy Schubert CommitDate: 2025-11-14 04:10:21 +0000 ipfilter: Add an htable max size tuneable. Add an ipfilter runtime option (ipf -T) to adjust the default maximum hash table size. Default it to 1024 entries. It will be used by a subsequent commit to limit any damage due to excessively large hash table input by the user. Reviewed by: markj Differential revision: https://reviews.freebsd.org/D53284 (cherry picked from commit f3b94f47f55c502e8983f9bd294e963e75b2963a) --- sys/netpfil/ipfilter/netinet/ip_htable.c | 7 +++++++ sys/netpfil/ipfilter/netinet/ip_htable.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/sys/netpfil/ipfilter/netinet/ip_htable.c b/sys/netpfil/ipfilter/netinet/ip_htable.c index 9680017eb399..39777508731f 100644 --- a/sys/netpfil/ipfilter/netinet/ip_htable.c +++ b/sys/netpfil/ipfilter/netinet/ip_htable.c @@ -97,6 +97,7 @@ typedef struct ipf_htable_softc_s { iphtable_t *ipf_htables[LOOKUP_POOL_SZ]; iphtent_t *ipf_node_explist; ipftuneable_t *ipf_htable_tune; + u_int ipf_htable_size_max; } ipf_htable_softc_t; ipf_lookup_t ipf_htable_backend = { @@ -124,6 +125,10 @@ ipf_lookup_t ipf_htable_backend = { static ipftuneable_t ipf_htable_tuneables[] = { + { { (void *)offsetof(ipf_htable_softc_t, ipf_htable_size_max) }, + "htable_size_max", 1, 0x7fffffff, + stsizeof(ipf_htable_softc_t, ipf_htable_size_max), + 0, NULL, NULL }, { { NULL }, NULL, 0, 0, 0, @@ -206,6 +211,8 @@ ipf_htable_soft_init(ipf_main_softc_t *softc, void *arg) bzero((char *)softh, sizeof(*softh)); + softh->ipf_htable_size_max = IPHTABLE_MAX_SIZE; + return (0); } diff --git a/sys/netpfil/ipfilter/netinet/ip_htable.h b/sys/netpfil/ipfilter/netinet/ip_htable.h index 55c289e57ff6..3a8782ccd4b2 100644 --- a/sys/netpfil/ipfilter/netinet/ip_htable.h +++ b/sys/netpfil/ipfilter/netinet/ip_htable.h @@ -55,6 +55,8 @@ typedef struct iphtable_s { char iph_name[FR_GROUPLEN]; /* hash table number */ } iphtable_t; +#define IPHTABLE_MAX_SIZE 1024 + /* iph_type */ #define IPHASH_LOOKUP 0 #define IPHASH_GROUPMAP 1