git: d86cf4435021 - main - pfctl: fix recursive printing of rules
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 14 Apr 2022 15:26:09 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=d86cf4435021d0abf3f3d65039583ee8cfde1be1
commit d86cf4435021d0abf3f3d65039583ee8cfde1be1
Author: Matteo Riondato <matteo@FreeBSD.org>
AuthorDate: 2022-04-13 07:38:44 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-04-14 15:25:41 +0000
pfctl: fix recursive printing of rules
When asked to print rules recursively, correctly recurse for anchors
included in pf.conf with "anchorname/*".
PR: 262590
Reviewed by: kp
MFC after: 3 weeks
---
sbin/pfctl/pfctl.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index 13e8e825c1ab..150a375b316a 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1248,13 +1248,11 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format,
((void *)p == (void *)anchor_call ||
*(--p) == '/')) || (opts & PF_OPT_RECURSE))) {
brace++;
- if ((p = strrchr(anchor_call, '/')) !=
- NULL)
- p++;
- else
- p = &anchor_call[0];
- } else
- p = &anchor_call[0];
+ int aclen = strlen(anchor_call);
+ if (anchor_call[aclen - 1] == '*')
+ anchor_call[aclen - 2] = '\0';
+ }
+ p = &anchor_call[0];
print_rule(&rule, p, rule_numbers, numeric);
if (brace)