From nobody Wed Nov 05 15:34:01 2025 X-Original-To: dev-commits-src-all@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 4d1q9j505hz6GTRZ; Wed, 05 Nov 2025 15:34:01 +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 4d1q9j2cZGz3FkS; Wed, 05 Nov 2025 15:34:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762356841; 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=TZZ/mVjyNa+v2ZHhXneXagQ+4PSoESaDyoAyHx3UhNU=; b=LWy/C5psa8BsFpfFLW8Rhjp4aNKsDYLnCb2u5r104K02hrkB/4UKtaOPDH21BPCjCICURu RkHC0Ax4s3hut0F/xh8zXSridYjZopWREYmlou5qGp6v76WtysCccarBzxCXq8nOJ4pAyo z20zpsreSAyHP/NBUV8pxQWrkUfHOoRAnGyNGWAb6mR14q0FzluaePSpfyeFLJPL2raTr/ C2/2HLV+S9CieXbLlPhOZFTTlpP5YwuCsda4WnGX8ed0SXiJtLEkY4x1v34Yg/YIL036HP 5Hi8mPlbLZ0LNKUyo6+DhSMUtYp7FVFWxy7JzvFUwSnbtrvVN9yX4bPuZrQGqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762356841; 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=TZZ/mVjyNa+v2ZHhXneXagQ+4PSoESaDyoAyHx3UhNU=; b=p5FP/0kW7la8ywrxZpsQyEb7nEJIweCQtgg+fA3gNJNQTZem084jP8RUnXfu7QTtclVskL Gi5Vu36vtdwqJvUi2zPl7aDD784hcMeXxZy+m6KeagFkCEo8gIk7aoRzZwnpSg/MXHtcRG Jdx4KpQhjzGUW7rEdivFgDtQuauetFYlbJpOEKHYU3Y+z2cAUtuTGDW2wt3OelcRZFzjxl pilKOnQ/NCvQSGlSvnpEt04Bj16hdAotlp9N7tQbSCX1ZbT4jRkBgJoDCPFTE+FwmYsrTz 5VvmWRS0iBM1onmpYXNgwR1gMKUTwcHrlP8jGVqJmc3GH6KbR/sIMZhPSvhqHw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1762356841; a=rsa-sha256; cv=none; b=BcmLxT0SizYShB9mgk9FtX4vZO58tdrqRv3/6HokfuXd2ZGuTmbUeJYBI9RWP/vXSkSVSM 1XYIkYBvUtHG+YDSZyzXCPItrxm3equ5LRf5Nc7hVqF8u3cfju9gAfJsD+p83tlvzY/lXC pYhRo7FLp7OXtYKMgcJgngV6bDldbGMPDlthuaJYfLJFla8rs6OYU2BHFl4e75cL2QNbsh odMuSvQFk/YjoYiloZJ8HaSvAHYuHfv5f3mznrwrD3ytoaSP9+YQzYTd9201L5cBLtb+R3 +ivkdi4SER6wY9EKhV/6aj5T8+A69I5ONJbd3Qwya0fq+lD8I9AMm/agXr1mnw== 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 4d1q9j24vPzpbK; Wed, 05 Nov 2025 15:34:01 +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 5A5FY1tQ033292; Wed, 5 Nov 2025 15:34:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5A5FY1LA033289; Wed, 5 Nov 2025 15:34:01 GMT (envelope-from git) Date: Wed, 5 Nov 2025 15:34:01 GMT Message-Id: <202511051534.5A5FY1LA033289@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: f3b94f47f55c - main - ipfilter: Add an htable max size tuneable. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: f3b94f47f55c502e8983f9bd294e963e75b2963a Auto-Submitted: auto-generated The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=f3b94f47f55c502e8983f9bd294e963e75b2963a commit f3b94f47f55c502e8983f9bd294e963e75b2963a Author: Cy Schubert AuthorDate: 2025-10-22 22:56:50 +0000 Commit: Cy Schubert CommitDate: 2025-11-05 15:32:16 +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 MFC after: 1 week Differential revision: https://reviews.freebsd.org/D53284 --- 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