diff options
author | Kristof Provost <kp@FreeBSD.org> | 2024-12-04 09:48:13 +0000 |
---|---|---|
committer | Kristof Provost <kp@FreeBSD.org> | 2025-02-10 11:09:47 +0000 |
commit | b452e72bda5eaa09d6fad94d3b538f21754c5313 (patch) | |
tree | 2d64d33a436cfe0fadd18d8351fbaa8c24eec68a /sbin | |
parent | 95ab7b3223c08cf48ccf764815523ea995a7ea0e (diff) |
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")
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/pfctl/pfctl.h | 2 | ||||
-rw-r--r-- | sbin/pfctl/pfctl_radix.c | 8 | ||||
-rw-r--r-- | 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; \ |