From nobody Thu Apr 14 15:26:09 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 0B2CC1B43498; Thu, 14 Apr 2022 15:26:10 +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 4KfNb56rfVz3J5s; Thu, 14 Apr 2022 15:26:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649949970; 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=kNnyR0o6uPlLptLit8mdpFmlzx4/Hc3tNodz9IBdHlw=; b=IKEOAxX4KSAGJzlZX7BVMrPlNmtfKiNfZh2YCTk0B2KUhArdUMcrYDRjnIaRKihLMQT5aj edC3zhX7MHqj9Y9Ol0Gfy+vmXoYkRJwZGdfIfqSslS8zECGsrCw9MPDlYXYtd9TGxf/0fX TuNP38ueA0i8oynONdLMv9HHfsErnibUBR6uFzcuWMJcjZqRscJWUmkWrw7zpYeF8YCnN9 lhbymDtUZP9/xR+bWBLvGv2YAp8u3ir+C1IVHH6kmZpSf5ZJZUQJmn/VqC6m7l/D7tEyPs BQrts3Y/zgli/IOUA9Ts51bxSIXU29IdFOFufjfGfM54h+KlmHImx8qPj2e21w== 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 CB28922DD5; Thu, 14 Apr 2022 15:26:09 +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 23EFQ9UA003358; Thu, 14 Apr 2022 15:26:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23EFQ9bO003357; Thu, 14 Apr 2022 15:26:09 GMT (envelope-from git) Date: Thu, 14 Apr 2022 15:26:09 GMT Message-Id: <202204141526.23EFQ9bO003357@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: d86cf4435021 - main - 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/main X-Git-Reftype: branch X-Git-Commit: d86cf4435021d0abf3f3d65039583ee8cfde1be1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649949970; 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=kNnyR0o6uPlLptLit8mdpFmlzx4/Hc3tNodz9IBdHlw=; b=Jor5veSeNe/KSGdof9f1LzHKnVM0hAbkJ23w1No7CpIfIpyjjwuUU90VXwMW1j3l90t12a wXW8Xj/nFyJTN6uws+Ez2umVIu4YA0od28NQTuBPbZor/37llIXnojb5MyoivUKmUarSNy xR3ohBbNUKgz2Mt1pg5e6lgj1Xyu74Cnc21JIWTV6B3zh/QotNTbroPrJjFzx0I/+YpuHv PpaZLtljzK3/vfAlw+ZWPuyvdfLQP8OOQ/D1pCr2Vm0/FSpJIM3UwSVcQEvMIxAPTfxjG4 a0WPd5PfdTkbLrCD8rHqSkBP0JawDcc1UAgh2uBUrN5lojcmgIY3jX53Pv45Lw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649949970; a=rsa-sha256; cv=none; b=k3A4qW5vk9N6Y9d51AAsFmBkwHm2j2VhZkpXLCz62wnz1OApKxO3oVmnJ71GTCg+dyUcrJ Kw72f9R6OCIaZNFQVVVNSIlBjoU0gRHx63VQGHAOZ3Obpr0Nz3TB3wSPDwhXElmwiSKuqs CgohFX24FNrlhhvn3xkzA3w8OINANjHnIym9aLgI9jWaKrDnyEMF+Ai9L34hfRmHUySHT1 VPU6/apTeqhcVpr+4qpjVlCMtj9iTt26IjU36JnpjN7MRK9F80i42jT8FR4eLmpxSzOrJ5 YjgGKzjV3BDhpUfbA6mHpT7c96O+ZlziOUdOx6aKcakj+DNIRbVHM5q0fq9gAQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d86cf4435021d0abf3f3d65039583ee8cfde1be1 commit d86cf4435021d0abf3f3d65039583ee8cfde1be1 Author: Matteo Riondato AuthorDate: 2022-04-13 07:38:44 +0000 Commit: Kristof Provost CommitDate: 2022-04-14 15:25:41 +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 --- 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 13e8e825c1ab..150a375b316a 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1248,13 +1248,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)