Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Feb 2025 11:10:13 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: 2c96c9b053c7 - main - pfctl: simplify pfr_del_tables() to pfr_del_table()
Message-ID:  <202502101110.51ABADD1005560@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=2c96c9b053c7db6c7c09fb1ba908c0026f58c864

commit 2c96c9b053c7db6c7c09fb1ba908c0026f58c864
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-02-07 17:22:44 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-02-10 11:09:47 +0000

    pfctl: simplify pfr_del_tables() to pfr_del_table()
    
    We only ever delete 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 36dcd73ce57d..ffd37cf023a6 100644
--- a/sbin/pfctl/pfctl.h
+++ b/sbin/pfctl/pfctl.h
@@ -57,7 +57,7 @@ struct pfr_buffer {
 
 int	 pfr_get_fd(void);
 int	 pfr_add_table(struct pfr_table *, int *, int);
-int	 pfr_del_tables(struct pfr_table *, int, int *, int);
+int	 pfr_del_table(struct pfr_table *, 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);
 int	 pfr_clr_tstats(struct pfr_table *, int, int *, int);
diff --git a/sbin/pfctl/pfctl_radix.c b/sbin/pfctl/pfctl_radix.c
index 7cb9b6faa0d9..451b83371d05 100644
--- a/sbin/pfctl/pfctl_radix.c
+++ b/sbin/pfctl/pfctl_radix.c
@@ -80,19 +80,15 @@ pfr_add_table(struct pfr_table *tbl, int *nadd, int flags)
 }
 
 int
-pfr_del_tables(struct pfr_table *tbl, int size, int *ndel, int flags)
+pfr_del_table(struct pfr_table *tbl, int *ndel, 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, DIOCRDELTABLES, &io)) {
 		pfr_report_error(tbl, &io, "delete table");
 		return (-1);
diff --git a/sbin/pfctl/pfctl_table.c b/sbin/pfctl/pfctl_table.c
index 4ef4dd69309a..7137f42b13e8 100644
--- a/sbin/pfctl/pfctl_table.c
+++ b/sbin/pfctl/pfctl_table.c
@@ -189,7 +189,7 @@ pfctl_table(int argc, char *argv[], char *tname, const char *command,
 	} else if (!strcmp(command, "kill")) {
 		if (argc || file != NULL)
 			usage();
-		RVTEST(pfr_del_tables(&table, 1, &ndel, flags));
+		RVTEST(pfr_del_table(&table, &ndel, flags));
 		xprintf(opts, "%d table deleted", ndel);
 	} else if (!strcmp(command, "flush")) {
 		if (argc || file != NULL)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502101110.51ABADD1005560>