Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 May 2022 12:50:29 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 407f7397d69e - stable/13 - pfctl: fix recursive printing of rules
Message-ID:  <202205041250.244CoTDr024349@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=407f7397d69e9c2fd103ee73538589d50216c7ac

commit 407f7397d69e9c2fd103ee73538589d50216c7ac
Author:     Matteo Riondato <matteo@FreeBSD.org>
AuthorDate: 2022-04-13 07:38:44 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-05-04 06:20:58 +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
    
    (cherry picked from commit d86cf4435021d0abf3f3d65039583ee8cfde1be1)
---
 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 eccfe319207e..165114781a1f 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1143,13 +1143,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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202205041250.244CoTDr024349>