From nobody Tue Dec 30 13:17:12 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 4dgYXS5pXQz6Ltmx for ; Tue, 30 Dec 2025 13:17:12 +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 "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dgYXS43Msz3Tn2 for ; Tue, 30 Dec 2025 13:17:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767100632; 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=BsA539rFm6XFgsOu1blV7Qur7S0jZMOkwzIocpHzgMc=; b=R+354odsEEvrcoECgEzEt+3oSyDgxOB8+A2JfTaCaHWwxDOJBv2SklhnEjL+c2L3CjsfVs p5ECVaEJVAqWz53JKBb4wwlg4kn6Z6ZCqO4SzbY370HZazwja/2Omd+872pdTMMzsyQaL9 soRR3KZB+osUzPtrej6JHnM2po1zNLdlVJEUG2mfGTo/x/0n67xgbCG8Q1SmsBCw4VHNQM PrVx699cqavqjg16XrhAQd0OLbh4ifGV+ZkrN10muf8cK9+b8XFU1Y9ZfhntRsAr2Qo81C 1yVFrDf8hWJfREdsq2gaeR6zOww7NRTAd01hxfBF0u8Wn+6L3erCdHJg+/tDwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767100632; 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=BsA539rFm6XFgsOu1blV7Qur7S0jZMOkwzIocpHzgMc=; b=mgcDQqdunptGFPPEqnQ7mh/46lAmuvEtdMKFq17MPKyeBpGhtUVfJfqfFJ/vGck4QN6M00 Q9RD9LN4V5nY5lmISqper9ymGLwzGCQeUTsIysCqCYqBNSDWTISG24pETqb+iQceBKfcTh KSbXmM6GjbSHZdx1MfyBhB1DTnOubTSjk2YLl7NXN0TitgCot8b1ivzhNBsxuTFUjGbZ4F KMeSUbNz/nUp5bhbFcwcrpEmT0Yeu3fLkhRgw4+iOFsIPN01r4z8OP+yau3fjJIrrlqYcE E5N6MtPef3MJdm9Zaju+OoSAABbYqgHxlrdWJMA3gknnPCUwi7K+1mRv2u9x4A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1767100632; a=rsa-sha256; cv=none; b=Vdwg7QqCz1IxtN0rQEUiIwS8FsgdBkbwDOo+S/M7490fzb+PsAaGf6UB3uI9dihlFmYswd iBREN801DtdnJNPuSlc5GSlCP58qqCQxvEGsq/jaYXL6mdunZg7DOSCJRCaUL3Z0EIZ8+S ngnozTDppxCtbyxWwyXZVWcaGjRzBxbL2UMV/5HCWaRwfN/5tJuAaquvnQsHyKPkJ2k97D LMcdrjpU1BygtEEs2NpbdOrAvW2aPBiTm9kRA/WNss9PGFsxrMoJamKhlQMEfnQJU0ymAn lzGGVz8QNs5Hd7FOXaXnC/ehmkjFKz/G5KZ6MKv5JCEYJbjWdeq/jBvYN6ODkg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dgYXS3RxKz12Cb for ; Tue, 30 Dec 2025 13:17:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3c15f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 30 Dec 2025 13:17:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: c2e7a52374b3 - main - pf: move DIOCRCLRASTATS into libpfctl 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: c2e7a52374b3e4bef41c5cad4c24f158c870b476 Auto-Submitted: auto-generated Date: Tue, 30 Dec 2025 13:17:12 +0000 Message-Id: <6953d0d8.3c15f.4e8f391c@gitrepo.freebsd.org> The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c2e7a52374b3e4bef41c5cad4c24f158c870b476 commit c2e7a52374b3e4bef41c5cad4c24f158c870b476 Author: Kristof Provost AuthorDate: 2025-12-29 09:45:48 +0000 Commit: Kristof Provost CommitDate: 2025-12-30 13:16:52 +0000 pf: move DIOCRCLRASTATS into libpfctl Sponsored by: Rubicon Communications, LLC ("Netgate") --- lib/libpfctl/libpfctl.c | 25 +++++++++++++++++++++++++ lib/libpfctl/libpfctl.h | 2 ++ sbin/pfctl/pfctl_radix.c | 18 +----------------- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 7e5a07ccd55a..6aac9a9c04ae 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -3843,3 +3843,28 @@ pfctl_get_astats(struct pfctl_handle *h, const struct pfr_table *tbl, return (0); } + +int +pfctl_clr_astats(struct pfctl_handle *h, const struct pfr_table *tbl, + struct pfr_addr *addr, int size, int *nzero, int flags) +{ + struct pfioc_table io; + + if (size < 0 || !tbl || (size && !addr)) { + errno = EINVAL; + return (-1); + } + + bzero(&io, sizeof io); + io.pfrio_flags = flags; + io.pfrio_table = *tbl; + io.pfrio_buffer = addr; + io.pfrio_esize = sizeof(*addr); + io.pfrio_size = size; + if (ioctl(h->fd, DIOCRCLRASTATS, &io) == -1) + return (-1); + if (nzero) + *nzero = io.pfrio_nzero; + return (0); +} + diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 9576118fe146..b885497ab0e8 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -587,5 +587,7 @@ int pfctl_clear_addrs(struct pfctl_handle *h, const struct pfr_table *filter, int pfctl_get_astats(struct pfctl_handle *h, const struct pfr_table *tbl, struct pfr_astats *addr, int *size, int flags); +int pfctl_clr_astats(struct pfctl_handle *h, const struct pfr_table *tbl, + struct pfr_addr *addr, int size, int *nzero, int flags); #endif diff --git a/sbin/pfctl/pfctl_radix.c b/sbin/pfctl/pfctl_radix.c index 3ea127dd2451..4ae301756200 100644 --- a/sbin/pfctl/pfctl_radix.c +++ b/sbin/pfctl/pfctl_radix.c @@ -201,23 +201,7 @@ int pfr_clr_astats(struct pfr_table *tbl, struct pfr_addr *addr, int size, int *nzero, int flags) { - struct pfioc_table io; - - if (size < 0 || !tbl || (size && !addr)) { - errno = EINVAL; - return (-1); - } - bzero(&io, sizeof io); - io.pfrio_flags = flags; - io.pfrio_table = *tbl; - io.pfrio_buffer = addr; - io.pfrio_esize = sizeof(*addr); - io.pfrio_size = size; - if (ioctl(dev, DIOCRCLRASTATS, &io) == -1) - return (-1); - if (nzero) - *nzero = io.pfrio_nzero; - return (0); + return (pfctl_clr_astats(pfh, tbl, addr, size, nzero, flags)); } int