git: f01c509568f2 - main - pf: revert netlink commands back to enum
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 06 Jul 2026 19:44:14 UTC
The branch main has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=f01c509568f25c8003bf2b0c5f6fa008e5f8f810
commit f01c509568f25c8003bf2b0c5f6fa008e5f8f810
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2026-07-06 19:41:25 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-07-06 19:41:25 +0000
pf: revert netlink commands back to enum
Revert pf_nl.h part of 017690e50913 and use new libsysdecode build glue
that parses enums.
Reviewed by: kp, glebius
Differential Revision: https://reviews.freebsd.org/D57866
---
lib/libsysdecode/mktables | 2 +-
sys/netpfil/pf/pf_nl.h | 103 +++++++++++++++++++++++-----------------------
2 files changed, 53 insertions(+), 52 deletions(-)
diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables
index df742ff62f39..9e08246d50cc 100644
--- a/lib/libsysdecode/mktables
+++ b/lib/libsysdecode/mktables
@@ -189,7 +189,7 @@ else
fi
gen_table "shmflags" "SHM_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/mman.h" "SHM_ANON"
gen_table "itimerwhich" "ITIMER_[A-Z]+[[:space:]]+[0-9]+" "sys/time.h"
-gen_table "pfnl_cmd" "PFNL_CMD_[A-Z_]+[[:space:]]+[0-9]+" "netpfil/pf/pf_nl.h"
+gen_table_enum "pfnl_cmd" "PFNL_CMD_[A-Z_]+" "netpfil/pf/pf_nl.h"
gen_table "nlm_flag" "NLM_F_[A-Z]+[[:space:]]+0x[0-9]+" "netlink/netlink.h"
# Generate a .depend file for our output file
diff --git a/sys/netpfil/pf/pf_nl.h b/sys/netpfil/pf/pf_nl.h
index 34ad5be75917..4d0186ea86a5 100644
--- a/sys/netpfil/pf/pf_nl.h
+++ b/sys/netpfil/pf/pf_nl.h
@@ -34,57 +34,58 @@
#define PFNL_FAMILY_NAME "pfctl"
/* available commands */
-#define PFNL_CMD_UNSPEC 0
-#define PFNL_CMD_GETSTATES 1
-#define PFNL_CMD_GETCREATORS 2
-#define PFNL_CMD_START 3
-#define PFNL_CMD_STOP 4
-#define PFNL_CMD_ADDRULE 5
-#define PFNL_CMD_GETRULES 6
-#define PFNL_CMD_GETRULE 7
-#define PFNL_CMD_CLRSTATES 8
-#define PFNL_CMD_KILLSTATES 9
-#define PFNL_CMD_SET_STATUSIF 10
-#define PFNL_CMD_GET_STATUS 11
-#define PFNL_CMD_CLEAR_STATUS 12
-#define PFNL_CMD_NATLOOK 13
-#define PFNL_CMD_SET_DEBUG 14
-#define PFNL_CMD_SET_TIMEOUT 15
-#define PFNL_CMD_GET_TIMEOUT 16
-#define PFNL_CMD_SET_LIMIT 17
-#define PFNL_CMD_GET_LIMIT 18
-#define PFNL_CMD_BEGIN_ADDRS 19
-#define PFNL_CMD_ADD_ADDR 20
-#define PFNL_CMD_GET_ADDRS 21
-#define PFNL_CMD_GET_ADDR 22
-#define PFNL_CMD_GET_RULESETS 23
-#define PFNL_CMD_GET_RULESET 24
-#define PFNL_CMD_GET_SRCNODES 25
-#define PFNL_CMD_CLEAR_TABLES 26
-#define PFNL_CMD_ADD_TABLE 27
-#define PFNL_CMD_DEL_TABLE 28
-#define PFNL_CMD_GET_TSTATS 29
-#define PFNL_CMD_CLR_TSTATS 30
-#define PFNL_CMD_CLR_ADDRS 31
-#define PFNL_CMD_TABLE_ADD_ADDR 32
-#define PFNL_CMD_TABLE_DEL_ADDR 33
-#define PFNL_CMD_TABLE_SET_ADDR 34
-#define PFNL_CMD_TABLE_GET_ADDR 35
-#define PFNL_CMD_TABLE_GET_ASTATS 36
-#define PFNL_CMD_TABLE_CLEAR_ASTATS 37
-#define PFNL_CMD_STATE_LIMITER_ADD 38
-#define PFNL_CMD_STATE_LIMITER_GET 39
-#define PFNL_CMD_STATE_LIMITER_NGET 40
-#define PFNL_CMD_SOURCE_LIMITER_ADD 41
-#define PFNL_CMD_SOURCE_LIMITER_GET 42
-#define PFNL_CMD_SOURCE_LIMITER_NGET 43
-#define PFNL_CMD_SOURCE_GET 44
-#define PFNL_CMD_SOURCE_NGET 45
-#define PFNL_CMD_SOURCE_CLEAR 46
-#define PFNL_CMD_TABLE_TEST_ADDRS 47
-
-#define __PFNL_CMD_MAX 48
-#define PFNL_CMD_MAX (__PFNL_CMD_MAX - 1)
+enum {
+ PFNL_CMD_UNSPEC = 0,
+ PFNL_CMD_GETSTATES = 1,
+ PFNL_CMD_GETCREATORS = 2,
+ PFNL_CMD_START = 3,
+ PFNL_CMD_STOP = 4,
+ PFNL_CMD_ADDRULE = 5,
+ PFNL_CMD_GETRULES = 6,
+ PFNL_CMD_GETRULE = 7,
+ PFNL_CMD_CLRSTATES = 8,
+ PFNL_CMD_KILLSTATES = 9,
+ PFNL_CMD_SET_STATUSIF = 10,
+ PFNL_CMD_GET_STATUS = 11,
+ PFNL_CMD_CLEAR_STATUS = 12,
+ PFNL_CMD_NATLOOK = 13,
+ PFNL_CMD_SET_DEBUG = 14,
+ PFNL_CMD_SET_TIMEOUT = 15,
+ PFNL_CMD_GET_TIMEOUT = 16,
+ PFNL_CMD_SET_LIMIT = 17,
+ PFNL_CMD_GET_LIMIT = 18,
+ PFNL_CMD_BEGIN_ADDRS = 19,
+ PFNL_CMD_ADD_ADDR = 20,
+ PFNL_CMD_GET_ADDRS = 21,
+ PFNL_CMD_GET_ADDR = 22,
+ PFNL_CMD_GET_RULESETS = 23,
+ PFNL_CMD_GET_RULESET = 24,
+ PFNL_CMD_GET_SRCNODES = 25,
+ PFNL_CMD_CLEAR_TABLES = 26,
+ PFNL_CMD_ADD_TABLE = 27,
+ PFNL_CMD_DEL_TABLE = 28,
+ PFNL_CMD_GET_TSTATS = 29,
+ PFNL_CMD_CLR_TSTATS = 30,
+ PFNL_CMD_CLR_ADDRS = 31,
+ PFNL_CMD_TABLE_ADD_ADDR = 32,
+ PFNL_CMD_TABLE_DEL_ADDR = 33,
+ PFNL_CMD_TABLE_SET_ADDR = 34,
+ PFNL_CMD_TABLE_GET_ADDR = 35,
+ PFNL_CMD_TABLE_GET_ASTATS = 36,
+ PFNL_CMD_TABLE_CLEAR_ASTATS = 37,
+ PFNL_CMD_STATE_LIMITER_ADD = 38,
+ PFNL_CMD_STATE_LIMITER_GET = 39,
+ PFNL_CMD_STATE_LIMITER_NGET = 40,
+ PFNL_CMD_SOURCE_LIMITER_ADD = 41,
+ PFNL_CMD_SOURCE_LIMITER_GET = 42,
+ PFNL_CMD_SOURCE_LIMITER_NGET = 43,
+ PFNL_CMD_SOURCE_GET = 44,
+ PFNL_CMD_SOURCE_NGET = 45,
+ PFNL_CMD_SOURCE_CLEAR = 46,
+ PFNL_CMD_TABLE_TEST_ADDRS = 47,
+ __PFNL_CMD_MAX,
+};
+#define PFNL_CMD_MAX (__PFNL_CMD_MAX -1)
enum pfstate_key_type_t {
PF_STK_UNSPEC,