From nobody Tue Jan 14 10:38:00 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 4YXQZK49V2z5kVwS; Tue, 14 Jan 2025 10:38: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXQZJ5fKkz3BrX; Tue, 14 Jan 2025 10:38:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851080; 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=8A1T5i2+oJayEIsJKK3NCP4x35vJnDsFZ+KFGmpL+Bg=; b=xdd/Npz+ZHCYdXkllVeOxqGhZZXolgihwmWKAkQB0f14+yT0FaCplWDm4DSp5a88GQ5Z22 BGWuL0y9FwKFpTRHvpI3PCjYrPos/A3cIT8oNigffjMsjhM2ALWCFev8tqNcU5uFi9YBiB zVadXtqSOhv8KUsdjFj+W2ZaZaaPtQi7LmT8/U2ehED7xoYUqWKSlPf3XmSfsIu1z3VvKR ztncHULFc4+jLrzgO7RxIgjbb390ktReGdyKpU4Ontiq6sfT6CzuzqbS+p2rJlac8kDz/p i9c1hSEahAr0l6AwJtJs6/aR7pt5AGghTA+IY9Y+BQBMmK6dI3yTfo92tzELEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851080; 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=8A1T5i2+oJayEIsJKK3NCP4x35vJnDsFZ+KFGmpL+Bg=; b=XlMFL8UR+MtIetJS36TmNqqxkogJ5F7i1fOnkkdTUO+wdU9KqjwuOcbPebjno48AhYJ7iB H6gMyp1fPYPuUrS/FEg5wfCZV5JgzjTcLOvJ60g3a6FPIUnv3urRQUp2Cnl1kGySVYpOSO I/8Ym50adn8b9FNc3DTbTDCvs9se+mclX6Gu5h3NeYGsaexOK1SWGIYPGq4VMzrsM5lS7P 0Z6oWzXBkjt4RXUWO/ffzpFGQ3tx6iPAHPCYD4htAzGAwsICKDT1y/h6dbETuRESNb6p93 KlAs8Lr9pOLdy9CWSPqCrMBvHk3MH7o8EwxJmF3OygzZkKg85uaX5jtDhjxyug== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736851080; a=rsa-sha256; cv=none; b=B7MjuyvRL2E889rI/adzy8c4lkm2x1iqhpahfjlfhYYplakTLN1bdeNRoGEWi43U8eu5SW jBR1TvT1rYxR9whcLdHmYs6hvh+ovb2f5siqhCNMXS6oz916mLl65H9y1dBSP63xv2X+AX TFFIzfpBjwpwBt0ULpujSARK5FkTbLPx2VSteUcsaXhPtzGmUvx2HW5MGpjRIqyBwGuXFt YGMXK13hEWyz2usAGwwdDN4OYesFEKUmpYcrABuH2r+vdpuY21qaAt50lA93yV4QpuwzBD vVpJy4szIHl3GZ/QovjgACE4lL3PhMJwYZ0MkrazWQZKA/MXQejeVcSxy0DRgA== 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 4YXQZJ4xx0z1BC3; Tue, 14 Jan 2025 10:38:00 +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 50EAc0Vw048418; Tue, 14 Jan 2025 10:38:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EAc047048415; Tue, 14 Jan 2025 10:38:00 GMT (envelope-from git) Date: Tue, 14 Jan 2025 10:38:00 GMT Message-Id: <202501141038.50EAc047048415@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: d90854a60a91 - main - pf: reset index if it's outside the table 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d90854a60a919fc574d1786486f85394f53ce2dd Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d90854a60a919fc574d1786486f85394f53ce2dd commit d90854a60a919fc574d1786486f85394f53ce2dd Author: Kristof Provost AuthorDate: 2025-01-09 13:31:22 +0000 Commit: Kristof Provost CommitDate: 2025-01-14 08:54:20 +0000 pf: reset index if it's outside the table when table content changes we need to reset index to the initial value and do not use the counter; reported by Sebastian Benoit and Daniel Krambrock, tested by Sebastian Benoit, ok henning zinke Obtained from: OpenBSD, mikeb , dba347c9d1 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_table.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index 35c9bd4ab655..03efa0b738da 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -2269,10 +2269,10 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter, return (-1); idx = *pidx; - if (idx >= 0) - use_counter = 1; - if (idx < 0) + if (idx < 0 || idx >= kt->pfrkt_cnt) idx = 0; + else if (counter != NULL) + use_counter = 1; startidx = idx; _next_block: