From nobody Fri Nov 14 04:11:33 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 4d73c61VKFz6GrfP; Fri, 14 Nov 2025 04:11:34 +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 4d73c56PBgz3Fx5; Fri, 14 Nov 2025 04:11:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763093493; 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=1QEiX5yL60cnzUc/7fMWO8sPJcQEUlW8yOA9GFGBU0I=; b=sinwmBo0gLP2S6NxkpN83IzAxs+CVKo4MaJsid3erBzffFC6hughwWfsy8QIILcC694ICn F7SWzUh56QXAUjApiTNpEilG4OcrJAKrOGpDb7vhPpdkG5VBwIoE8hSuqnJdgh668HVtIh uQFFQWqjrXdnwNwU3ARySoKGOcOQJMmYd1ToO5EYQSICugAGs6Xz2ovp0Xo51pkBLqHhZ9 FT6k1nG6qrb3Cz3eJ8ZvWJE649qLRCJ4iwKZRj30WBsoXWuG2aumeh86U9So76J9mxFQEG +OfY1PVAXoqOvkYmfo73lBRyrjetoFBW5Jwa4Ju6EjsC32FT2O8UJ1COt6TMBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763093493; 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=1QEiX5yL60cnzUc/7fMWO8sPJcQEUlW8yOA9GFGBU0I=; b=kuZ5stbPpssB6DSBNXUKoPz9vR+fEJoiQMP9WRy2e7BC+e+gC6NqUBGFcjX4qwKw4d/JKF WIQ15y/OEuy1468pXjLL9dOcCdytzrPGhkoCOrxNpJ9rpL9sZ+8jIGFhKXB/LmzHPrKPuB LbVHwstXNnui3sj87AimSXN9rBN86+Mmqr6Dvhkd3K3veuUfiAxShpnC3gxUl/4pHMyuhg xHx/E2EPB0azUX5djDvWjxNoEYZa+O6K7gufb/GM5qj8kft960wDPLlzJ9G5BTARsrTo8w cVYZ3kwBDw3sq5F2AnPPQASiQDcN1L6auzPYFeSsrjB13bA0tSgbesMT3s9LsQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1763093493; a=rsa-sha256; cv=none; b=Jixtboajn+VAE5TURqgJOYI8sZu2jQdR4X5l7chSS0otbdfuUT0t1vBnq9xB0gvapLN5xH vHd+VcSE3M03vUQTDvgYxhKPBbKCIJJN+bZ/Of6m3lez8MohNAt1KlAsA9vtIvbV3jOezR AuFDFlFwUFnW+TCGM3rf6jOvFtrFJLlYbh3CIbna7ffDgjs86/S1jpT1l1Y8i7JwM8Ssbx 6jHWucaSu8Y5+/HE943RaBRRw/5pwP8dpS/cdREvRJlS6tJDDed+zvV17pLiG0d96zy/EA wFbAqk8Sa3SSZguh2y23/Nmd2QQhCX1jE0Qi3OH//5FgFxVET/0H+ulH9NkQ3Q== 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 4d73c55vtWzrJL; Fri, 14 Nov 2025 04:11:33 +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 5AE4BXkh083679; Fri, 14 Nov 2025 04:11:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5AE4BXJ1083676; Fri, 14 Nov 2025 04:11:33 GMT (envelope-from git) Date: Fri, 14 Nov 2025 04:11:33 GMT Message-Id: <202511140411.5AE4BXJ1083676@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: 2d71662b74b0 - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 2d71662b74b062bd61da91b9fbd471a7a2b6a677 Auto-Submitted: auto-generated The branch stable/14 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=2d71662b74b062bd61da91b9fbd471a7a2b6a677 commit 2d71662b74b062bd61da91b9fbd471a7a2b6a677 Author: Cy Schubert AuthorDate: 2025-10-22 22:56:50 +0000 Commit: Cy Schubert CommitDate: 2025-11-14 04:11:15 +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 4c191cf71b18..94741d589601 100644 --- a/sys/netpfil/ipfilter/netinet/ip_htable.c +++ b/sys/netpfil/ipfilter/netinet/ip_htable.c @@ -100,6 +100,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 = { @@ -127,6 +128,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, @@ -209,6 +214,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