From nobody Wed May 4 12:50:29 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 68E761AAA2DB; Wed, 4 May 2022 12:50:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KtcBG0y8cz563P; Wed, 4 May 2022 12:50:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651668630; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XqD974/X0FvMDJbMb5umsdrwrLq5Ahy0HdNFZzzxHg8=; b=jd6dwHyDE31xbqQ+9pPvDMo2XTviZOTGlzQne3ljIdrk5aIHNdzCMDFBZIGAJ+YSSj3h8H zjQzhyA7H7uT095QYkwvwitpsq+Z9LpyG9rXPBG4RvklCgZEZRbeW8hiSl4wH99/oj2Ifh wieS6vjnm5bzCJNeYHqcYVzFr5nwmx+WXfKkxj7mh2cLzg3O3dqOr1lZZWH8GWg/FbrDVc jTf2Eb0C+E89Uy/7EQcOg3OK3z08XKi4W7vHApEc/05HJLWEcs17jCUCFSAU2tCKRlj1mw Dgl66tGBSYuSDrruAg+WI9tZ0esxZnFEN1RG+T0FKmfzDkqYp5oLfVv8907QUg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB48D12B7F; Wed, 4 May 2022 12:50:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 244CoTPY024350; Wed, 4 May 2022 12:50:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 244CoTDr024349; Wed, 4 May 2022 12:50:29 GMT (envelope-from git) Date: Wed, 4 May 2022 12:50:29 GMT Message-Id: <202205041250.244CoTDr024349@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 407f7397d69e - stable/13 - pfctl: fix recursive printing of rules List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 407f7397d69e9c2fd103ee73538589d50216c7ac Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651668630; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XqD974/X0FvMDJbMb5umsdrwrLq5Ahy0HdNFZzzxHg8=; b=s+mA/Atm60jLhmUFVIsp4IheiAwNODLwpkdsURNSaOMcv2/bUkDi97eOabrYPLrIhmE8J9 6y9gstKhGryjncaRlF33bRm5245t+lU6ss4ij8nPEPYvWxGPMO5WBfZaPVkY5OT3uKUr4N nbzXPQx5jslKhXTZhFuxTp+/yOi7fE9dEGgMWYysg0rjo6GiFs2V4R5n5bPrV9ESg073oT yvsOCBdfhuTZTjArramhbMUiVsXn2k/ZxPlTteOm1v61JGWzcF16tfHmX7v/0v5OcWqhpA v+WGSQITSTLkiVVIBri/yygSWpYE8CfhhDGHNlqijBp8SKrtqmpt0ZLKpHiHRQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651668630; a=rsa-sha256; cv=none; b=s6h7H+SODee5t3TStua9jBNLXz3cHuNaNW+mOwdSiV2BA3+tdTRSERy+eoQG619swjvRED fjCAAXPND4p1s2TGZhIzIuBJCi6uPzf55qOMwI7FLRWPixzFUleKKy/XSyfE2N7xm5Uqlx h9aPWG//Umg5rGkPwWPOZixd0HDpAD/9N5Ls+oUsrA3aKqDoiywAZDFHnT4Ez20r13GMkd AgusOFMwv9PRpvFT4HwkZYjkHBUIINquD5zvKFUOEkds31yB6tlCB7TSjjOGxCv1yUP3iP viWqL1r/gDDUwHSzArEENyDWXSvaACunXkh/OpZW450dCwfrr8LFSoVUo3zbfg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=407f7397d69e9c2fd103ee73538589d50216c7ac commit 407f7397d69e9c2fd103ee73538589d50216c7ac Author: Matteo Riondato AuthorDate: 2022-04-13 07:38:44 +0000 Commit: Kristof Provost 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)