pf: add a way to list creator ids

Allow userspace to retrieve a list of distinct creator ids for the
current states.

This is used by pfSense, and used to require dumping all states to
userspace. It's rather inefficient to export a (potentially extremely
large) state table to obtain a handful (typically 2) of 32-bit integers.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D42092
This commit is contained in:
Kristof Provost
2023-10-04 12:27:54 +02:00
parent f218b851da
commit a7191e5d7b
7 changed files with 178 additions and 2 deletions
+8
View File
@@ -78,6 +78,8 @@ common_body()
"set skip on ${epair_sync}b" \
"pass out keep state"
hostid_one=$(jexec one pfctl -si -v | awk '/Hostid:/ { gsub(/0x/, "", $2); printf($2); }')
ifconfig ${epair_one}b 198.51.100.254/24 up
ping -c 1 -S 198.51.100.254 198.51.100.1
@@ -89,6 +91,12 @@ common_body()
grep 198.51.100.254 ; then
atf_fail "state not found on synced host"
fi
if ! jexec two pfctl -sc | grep ""${hostid_one}"";
then
jexec two pfctl -sc
atf_fail "HostID for host one not found on two"
fi
}
basic_cleanup()