From nobody Wed May 04 12:50:28 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 8C2CF1AAA236; Wed, 4 May 2022 12:50:28 +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 4KtcBD2ytvz55x1; Wed, 4 May 2022 12:50:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651668628; 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=7bqBjqhpxVBOtY4ioCn9e6K3noZDca4O1HveiwlWxVI=; b=IffX8hqqjBKswWjzt0+16WtcBY1JAqo1JGqUdy53pPjgr8X8tXdnb6A4Ho9QI/BqwDQ0wt J2bQpHApl3B3StWsGmbgpgmUFsh8wsCyW+OxEbD/0zOH76cpq2lT9OBbIIi006EaXsXK5l ka2qmwj87bTJmGbJ3m4lgIyUaGk4UXbtyn5S2vgn6sYoOAmEMoREM81iQSabNjPcVv3Hd0 +rVTpTTf+SBKDhhbw46MF75BU/R1P2PAbFDJJ6ZCKBoKGnhQwb2SVrzLdxRIspf5kea1M8 3LIFgqQK9dxKPkghWn2809MKrM7VO1Iaj8mI6ueP7e2QWOjyNcI13sQ6CBNzJw== 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 464CC1306E; Wed, 4 May 2022 12:50:28 +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 244CoSAV024242; Wed, 4 May 2022 12:50:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 244CoS4N024241; Wed, 4 May 2022 12:50:28 GMT (envelope-from git) Date: Wed, 4 May 2022 12:50:28 GMT Message-Id: <202205041250.244CoS4N024241@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: eed3a36c5475 - stable/12 - 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/12 X-Git-Reftype: branch X-Git-Commit: eed3a36c547530be0eaf3ff93ebec9b22cc7bfaa Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651668628; 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=7bqBjqhpxVBOtY4ioCn9e6K3noZDca4O1HveiwlWxVI=; b=bQOfW2Peq9hvXvqCrjDuowF+i9QKTAaQrvMTCvjSBxcIUxuimppDkKuEQNPm8tvCklPRBy LRh2b2/+s54joZeHRf3q1Y94fZ6YP1ncSn4k3xgpOkoUAB0d04r+iYPfy1A5jRLauX+WB2 nkUej5rHzdOXvBAEVlKHcMQX2XTzKAII16wh+F2WnmzivdAicRPbngTCYwE2gmGWPl+QuI 78G3wDUmXbagnErvGjvkb2oS+tr61UzMJYVBa8SaQkmxPsTRGoaGjsxoHqD1vkqUZ9N52P CDykpiCHrZn9ZdQenCWqiVPJLo4b/LvQai3xtvpA/oukppG2OG0LG0jopNyEWA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651668628; a=rsa-sha256; cv=none; b=jw5dcQQXVQJ2qQ6ekBRibx0lfTHBlBi/d1OemvT33YTL7xuGI8d0gV0tKCRpjM0jFdUASe p4a8KcSOfVnvG2+NWqA5uT+kjLyMCJvFBRI+XMVnOxxnAEciqMZMzlpg46MAtpYiKGkqET vZPnsIHAS8mnc3V6JZLnob46tH0Vdu0/kymEH6HjPtK0PX0ILwqQmHIXDmnVoYWBqxypxm z8S/GlKuiBQcOt+HaieyTaBZGDgGyVPpm7ySzVtTnOD9McGFh1rsRCadh7nYArStyAYck9 QTFoOue1ClTwZqvIUcEvoVSK9MOBR4f1fGsWbn4dRyTCoZ4fIWDgWBrisf73zw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=eed3a36c547530be0eaf3ff93ebec9b22cc7bfaa commit eed3a36c547530be0eaf3ff93ebec9b22cc7bfaa Author: Matteo Riondato AuthorDate: 2022-04-13 07:38:44 +0000 Commit: Kristof Provost CommitDate: 2022-05-04 12:49:50 +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)