From nobody Mon Feb 10 11:10:11 2025 X-Original-To: dev-commits-src-main@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 4Ys20z56PHz5nkqr; Mon, 10 Feb 2025 11:10:11 +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 4Ys20z4P4Rz3ctv; Mon, 10 Feb 2025 11:10:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1739185811; 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=o1PjLE4JnkcDoK+jUZ0CCBp4GsC9RBnwL41hTSSmnSw=; b=Zedpx/LjRGXJtF3AjjZy6tmt6a2ddfHvzuKhhYbHdLefcRp+zz6ypf75YjYMB63xo7LGRk 5GNiv81ldoJfKLTKFB63AIDsNL2pfOiednbyM/3QoT8qJBZGFn6XhkwA6fHJf7EPBriAs6 7pgFLq5vRV4ki7UJAXLPoFlkVCsewoHCOGpdmTF6qg2XBevEVUb5+dk72njv4MSxZOJVIk NYYBLZ55iYYjbs6BGEdhH1VzYrDVuDGUVJFFx4+rSJhFu+gTPp58iAe/O3TMcZXdWBlW3U amF+XlUPnmnGRjwliP4SRUDoI97bc6CQbJnW4MFf5Y/LreTrt4TFjn5ftSDUpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1739185811; 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=o1PjLE4JnkcDoK+jUZ0CCBp4GsC9RBnwL41hTSSmnSw=; b=ldfcq35iNPSb7ZAHgBkg1rBMHicHKnhpQw5xrOilm96d6I0hk1MljxB3Ku8v1Y/EkQod/m YwWPGBfhxVFLhQaLMm7kPCKG3sfg9S5kgywM24P1EIXUq8bCaGY7gRw0/TTgE7FWdQ4ukh xyIz5hEdnTJTacqw82qzcVxkB69clajnQ80o09n9xWt6g81a9rkxIM7WTZpDZmAQmKB9br p8x9Xs3RLTy5hCTWTjm6gUDEw9mDi/hIRP2DBcC8Myl27hy6OIefZYlqdMw9p9Cp0c06mI hG+dWrgC9bIrTDt0P9oH9TpYNYwVmJI5kmwPIIeF0nzAsmdJBu1QkrVzMbeiFA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1739185811; a=rsa-sha256; cv=none; b=TVHxR1KbDF5ddbMVqy73ia5cvD3vWgE905rS/dPX29ExoOdkxxGaryN6ugf4kpFVmbYDkC 27k/KRA9xCuDs44dBgDM+U4eeVKOQsX/Rzba5SbetIPGgv0+NIAp79bskOKSLslByij6wd YjEw38bMF2uhKcMREEEn9fhZ4JLmjkiGY82c7B4tMpUsGKSfwHN4J3zzyznihlCNrIi4Ek ILHBF4jim2irTZwHlKqWffvYOPXFrfgCco2X/JQnMNqeZvuSOFHHNCXl6T5JVRTBOFoNU2 WGhSr2dQghR/gPrVWptGxxxyYj4FrlcklyebDJdwIF9FYmT6MS9Lq62UQh6kOg== 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 4Ys20z3ZnRz8Y7; Mon, 10 Feb 2025 11:10:11 +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 51ABABQ0004257; Mon, 10 Feb 2025 11:10:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51ABABGH004250; Mon, 10 Feb 2025 11:10:11 GMT (envelope-from git) Date: Mon, 10 Feb 2025 11:10:11 GMT Message-Id: <202502101110.51ABABGH004250@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: b452e72bda5e - main - pfctl: simplify pfr_add_tables() to pfr_add_table() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: b452e72bda5eaa09d6fad94d3b538f21754c5313 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b452e72bda5eaa09d6fad94d3b538f21754c5313 commit b452e72bda5eaa09d6fad94d3b538f21754c5313 Author: Kristof Provost AuthorDate: 2024-12-04 09:48:13 +0000 Commit: Kristof Provost CommitDate: 2025-02-10 11:09:47 +0000 pfctl: simplify pfr_add_tables() to pfr_add_table() We only ever add a single table at a time, so remove the size argument. This will make subsequent conversion to netlink easier. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl.h | 2 +- sbin/pfctl/pfctl_radix.c | 8 ++------ sbin/pfctl/pfctl_table.c | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index 788232d89006..36dcd73ce57d 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -56,7 +56,7 @@ struct pfr_buffer { (var) = pfr_buf_next((buf), (var))) int pfr_get_fd(void); -int pfr_add_tables(struct pfr_table *, int, int *, int); +int pfr_add_table(struct pfr_table *, int *, int); int pfr_del_tables(struct pfr_table *, int, int *, int); int pfr_get_tables(struct pfr_table *, struct pfr_table *, int *, int); int pfr_get_tstats(struct pfr_table *, struct pfr_tstats *, int *, int); diff --git a/sbin/pfctl/pfctl_radix.c b/sbin/pfctl/pfctl_radix.c index 22552bcf1737..49a20d6c98f4 100644 --- a/sbin/pfctl/pfctl_radix.c +++ b/sbin/pfctl/pfctl_radix.c @@ -74,19 +74,15 @@ pfr_report_error(struct pfr_table *tbl, struct pfioc_table *io, } int -pfr_add_tables(struct pfr_table *tbl, int size, int *nadd, int flags) +pfr_add_table(struct pfr_table *tbl, int *nadd, int flags) { struct pfioc_table io; - if (size < 0 || (size && tbl == NULL)) { - errno = EINVAL; - return (-1); - } bzero(&io, sizeof io); io.pfrio_flags = flags; io.pfrio_buffer = tbl; io.pfrio_esize = sizeof(*tbl); - io.pfrio_size = size; + io.pfrio_size = 1; if (ioctl(dev, DIOCRADDTABLES, &io)) { pfr_report_error(tbl, &io, "add table"); return (-1); diff --git a/sbin/pfctl/pfctl_table.c b/sbin/pfctl/pfctl_table.c index 5e701be3c654..4ef4dd69309a 100644 --- a/sbin/pfctl/pfctl_table.c +++ b/sbin/pfctl/pfctl_table.c @@ -89,7 +89,7 @@ static const char *istats_text[2][2][2] = { table.pfrt_flags |= PFR_TFLAG_PERSIST; \ if ((!(opts & PF_OPT_NOACTION) || \ (opts & PF_OPT_DUMMYACTION)) && \ - (pfr_add_tables(&table, 1, &nadd, flags)) && \ + (pfr_add_table(&table, &nadd, flags)) && \ (errno != EPERM)) { \ radix_perror(); \ goto _error; \