git: 0187875a6c0b - main - pfctl: Fix recursive printing of anchor labels
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 27 Nov 2023 20:38:05 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=0187875a6c0b68a8026be174f8a0f968fc8ab6ed
commit 0187875a6c0b68a8026be174f8a0f968fc8ab6ed
Author: Luiz Amaral <email@luiz.eng.br>
AuthorDate: 2023-11-27 15:53:27 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2023-11-27 20:37:33 +0000
pfctl: Fix recursive printing of anchor labels
We recently noticed that the recursive printing of labels wasn't working
like the recursive printing of rules.
When running pfctl -sr -a* we get a listing of all rules, including the
ones inside anchors. On the other hand, when running pfctl -sl -a*, it
would only print the labels in the root level, just like without the
-a* argument.
As in our use-case we are interested on labels only and our labels are
unique even between anchors, we didn't add indentation or hierarchy to
the printing.
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D42728
---
sbin/pfctl/pfctl.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index b752d87e63c6..2702c701f9cc 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1367,6 +1367,14 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format,
(unsigned long long)rule.bytes[1],
(uintmax_t)rule.states_tot);
}
+
+ if (anchor_call[0] &&
+ (((p = strrchr(anchor_call, '/')) ?
+ p[1] == '_' : anchor_call[0] == '_') ||
+ opts & PF_OPT_RECURSE)) {
+ pfctl_show_rules(dev, npath, opts, format,
+ anchor_call, depth, rule.anchor_wildcard);
+ }
break;
}
case PFCTL_SHOW_RULES: