git: d56abf1d1623 - stable/12 - pfctl: fix retrieving nested anchors

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Thu, 24 Mar 2022 13:14:38 UTC
The branch stable/12 has been updated by kp:

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

commit d56abf1d16238eeaab74509999a8f9303534f918
Author:     Matteo Riondato <matteo@FreeBSD.org>
AuthorDate: 2022-03-17 18:48:28 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-03-24 09:44:40 +0000

    pfctl: fix retrieving nested anchors
    
    PR:             262622
    MFC after:      1 week
    Reviewed by:    kp
    
    (cherry picked from commit cd8438e5a3a425ea44b261758e17fe62ebb45fce)
---
 sbin/pfctl/pfctl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index 676d3eb1ce8d..17bd61fbccb2 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1046,14 +1046,14 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format,
 		snprintf(&path[len], MAXPATHLEN - len, "%s", anchorname);
 
 	if (opts & PF_OPT_SHOWALL) {
-		ret = pfctl_get_rules_info(dev, &ri, PF_PASS, anchorname);
+		ret = pfctl_get_rules_info(dev, &ri, PF_PASS, path);
 		if (ret != 0) {
 			warn("DIOCGETRULES");
 			goto error;
 		}
 		header++;
 	}
-	ret = pfctl_get_rules_info(dev, &ri, PF_SCRUB, anchorname);
+	ret = pfctl_get_rules_info(dev, &ri, PF_SCRUB, path);
 	if (ret != 0) {
 		warn("DIOCGETRULES");
 		goto error;
@@ -1091,7 +1091,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format,
 		}
 		pfctl_clear_pool(&rule.rpool);
 	}
-	ret = pfctl_get_rules_info(dev, &ri, PF_PASS, anchorname);
+	ret = pfctl_get_rules_info(dev, &ri, PF_PASS, path);
 	if (ret != 0) {
 		warn("DIOCGETRULES");
 		goto error;