From nobody Fri Nov 14 04:12:14 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 4d73cv3T1Lz6Grfh; Fri, 14 Nov 2025 04:12:15 +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 4d73cv16x5z3HLK; Fri, 14 Nov 2025 04:12:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763093535; 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=C/PBdIk0ZemNu477kGMiRwMF0u7QsguStG6Cl9J5vzM=; b=uaPE4QIXLe0IfpLGMp2gjrk5IviC2dGvI1y0k4ZXkIv5RfrGe/tYZRPQ0aJPaewYaFQxyP eJokHKgyGsocDR/YS54MAzoQVfMt6GacP0Pr32HrUYpq9X1hBxIukm/rlhbQvUxpBymwv/ M07Xn249xcOFBFsQXUscMKTHLIk7d6QvwjPNA5wLdyw4b/WkV8bXiZ7sCUi6apIPgxuq8/ hP+hT9gxF0ymYBcxi6tD9ywqR8gpO42PqKHJpKnpLRwCynGNB8zQpF9onbW1tPyYUnhwUd ASuAAns8ZkQWN6xBEq/G4jNL7wuHCu1aL+WtkveYcpWkHQY/VF+kTM1cXVZveQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763093535; 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=C/PBdIk0ZemNu477kGMiRwMF0u7QsguStG6Cl9J5vzM=; b=cR2NtMbEEeH1Kq/naPU20Jp+3wwTnRdZWqsaMibDBnZbwsqhkgCUUJJyGezcMbJZqrHXSS CYUFMx34RlTNCmwcALUHLLa32pMyUd/4an7nYNBs7m2CJ/DojBSOa8dts4HkeIWxJZjTOy 20o5ISG4bzbr89A96TKjKMBTHdzHSh9npgU6jJlOBUPwznHEDmxAtRQPYfWzzVXsGFig7O kfo8y+xU+e3fJt+qR1BJD4w83f/bpx+k87JKlHLvpaQ3pj0jZ4vLTOicDpcjIalXxNPxGS SU6sMxXyKodtSXYHuS1bkmsTsJF4hKRipMUP6E9F2lhaRgALhW8EkkEJVINKow== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1763093535; a=rsa-sha256; cv=none; b=kXR/kCobqmLat2AOKsldMDif0EkKjNy8SRLKJxnKy2/1UpLV6yFBmZoRycfVQxUCjs5huT vIfO/70HQk/iy+5t1IUm4YuCCUkPYHAQ/K2+qos8hpTS23vzkH/IBSHyxkHVBmU7++FbqS e/NC0H2KlHDq8i4GAmou9wIrGMfQLpOCioJeuYef5l9b8owmma7RcBxjFgDIiIMcTdYTpy xiwzGp4OieBKc9JLfZh5/vbei/nTLY42G3dC2Sx4kSRh1i7vaOAFGq5QXCWW3IXtEH1v8n wqVkqgOAnuU7lepZvN3l9jbfvBqyq7m2ZekTKHv/9az2U31aqcNXLq8qtlp9GQ== 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 4d73cv0kQCzrl2; Fri, 14 Nov 2025 04:12:15 +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 5AE4CEpv087239; Fri, 14 Nov 2025 04:12:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5AE4CEjA087236; Fri, 14 Nov 2025 04:12:14 GMT (envelope-from git) Date: Fri, 14 Nov 2025 04:12:14 GMT Message-Id: <202511140412.5AE4CEjA087236@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: e82f63c7257e - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: e82f63c7257e561a1b2b826b2712cec32eb9c787 Auto-Submitted: auto-generated The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=e82f63c7257e561a1b2b826b2712cec32eb9c787 commit e82f63c7257e561a1b2b826b2712cec32eb9c787 Author: Cy Schubert AuthorDate: 2025-10-22 22:56:50 +0000 Commit: Cy Schubert CommitDate: 2025-11-12 04:02:31 +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 80f916b6e509..28b3e7e82cec 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, @@ -211,6 +216,8 @@ ipf_htable_soft_init(softc, 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