The branch main has been updated by kp:

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

commit ed5eb77e187286028e839dc4f03b12c99e586a00
Author:     Kristof Provost <k...@freebsd.org>
AuthorDate: 2022-08-30 14:32:30 +0000
Commit:     Kristof Provost <k...@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;

Reply via email to