Date: Mon, 10 Feb 2025 11:10:11 GMT From: Kristof Provost <kp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: b452e72bda5e - main - pfctl: simplify pfr_add_tables() to pfr_add_table() Message-ID: <202502101110.51ABABGH004250@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b452e72bda5eaa09d6fad94d3b538f21754c5313 commit b452e72bda5eaa09d6fad94d3b538f21754c5313 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2024-12-04 09:48:13 +0000 Commit: Kristof Provost <kp@FreeBSD.org> 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; \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502101110.51ABABGH004250>