git: ddbf89234312 - main - pfctl: fix CREATE_TABLE error handling
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 15 Jul 2026 13:50:35 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=ddbf89234312791e65991efff39a18a9e8e4d077
commit ddbf89234312791e65991efff39a18a9e8e4d077
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2026-07-13 13:14:10 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2026-07-15 11:44:59 +0000
pfctl: fix CREATE_TABLE error handling
pfr_add_table() does not set errno, it returns an error (now).
Read the error code from the return value so we display the correct
error message to the user.
Sponsored by: Rubicon Communications, LLC ("Netgate")
---
sbin/pfctl/pfctl_table.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/sbin/pfctl/pfctl_table.c b/sbin/pfctl/pfctl_table.c
index aae347712547..aec02c493f1b 100644
--- a/sbin/pfctl/pfctl_table.c
+++ b/sbin/pfctl/pfctl_table.c
@@ -85,14 +85,15 @@ static const char *istats_text[2][2][2] = {
} while (0)
#define CREATE_TABLE do { \
+ int _ret; \
warn_duplicate_tables(table.pfrt_name, \
table.pfrt_anchor); \
table.pfrt_flags |= PFR_TFLAG_PERSIST; \
if ((!(opts & PF_OPT_NOACTION) || \
(opts & PF_OPT_DUMMYACTION)) && \
- (pfr_add_table(&table, &nadd, flags)) && \
- (errno != EPERM)) { \
- warnx("%s", pf_strerror(errno)); \
+ (_ret = pfr_add_table(&table, &nadd, flags)) && \
+ (_ret != EPERM)) { \
+ warnx("%s", pf_strerror(_ret)); \
goto _error; \
} \
if (nadd) { \