Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Sep 2022 11:19:46 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: ed5eb77e1872 - main - pfctl: fix printing anchors
Message-ID:  <202209061119.286BJkKq024911@gitrepo.freebsd.org>

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

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

commit ed5eb77e187286028e839dc4f03b12c99e586a00
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-08-30 14:32:30 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-09-06 08:42:09 +0000

    pfctl: fix printing anchors
    
    Ensure that we pass the (base) anchorname to the kernel, not the '/*'
    suffix.
    
    MFC after:      3 weeks
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D36415
---
 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 93d26e53d71d..31499a9a86b0 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1123,13 +1123,11 @@ pfctl_show_eth_rules(int dev, char *path, int opts, enum pfctl_show format,
 		   (p == 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];
 		if (dotitle) {
 			pfctl_print_title("ETH RULES:");
 			dotitle = 0;



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