From nobody Thu Mar 17 18:02:46 2022 X-Original-To: bugs@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 4A44B1A35040 for ; Thu, 17 Mar 2022 18:02:47 +0000 (UTC) (envelope-from bugzilla-noreply@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 4KKFNk3qqXz4hj0 for ; Thu, 17 Mar 2022 18:02:46 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 64A897800 for ; Thu, 17 Mar 2022 18:02:46 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 22HI2kLE033595 for ; Thu, 17 Mar 2022 18:02:46 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 22HI2kj2033594 for bugs@FreeBSD.org; Thu, 17 Mar 2022 18:02:46 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 262622] [pf][patch] fix showing rules in (some) nested anchors Date: Thu, 17 Mar 2022 18:02:46 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: misc X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: matteo@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647540166; 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: in-reply-to:in-reply-to:references:references; bh=nhOQby4EF/0v2rTQaqXsUBzqUqWOa+Bo6CL7i24vyVA=; b=h812vwxQAWsmNM+POHzjnnmeuFLbk2E33uY8/xo2TExUaiPFEy1mcQ1Z9BHVEZE0ulNb5j F4VXVEz/jIVUO5anqaCPrsAd8wHSTVQ1IyjqTTis/dCrVlcg2sx056slOdY623dFcLmHND cZvnfl2FSYpCmeZS8RQrkm/fSm18CPHI53UzDB/YmVlK587x1CsR9MTuTnjw/uFYB7YbBA 6TkbPDbFYOkr7RM8z7ck7n1HaC9mBNf6FiC6gJ5cL/Fk2CRzWMGPIYFGucZ1K7rpfbDOcD sUVT9oDS0IKEGZzxUv32AAS1CtPBpp+ET7x/6O5+wn7ECN3VbraMzxDOKg6l6g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647540166; a=rsa-sha256; cv=none; b=IDNe7hV1s9Y0Vvo8EhlLIHvWXwfT+dclAyHkGf1mOtZL6DoXDujnv7YFsBszw2onIq+Fmf rfLFJ/C7EJtPTafH3xq1SHpGOnKpGB2ctaFqksrU2xB7qekK8F3fzkHhH67QKZQC64yumB jkwNk62IkNQm0hIPXM4HD3P+LXuAN9lNG7L2P9BjiVEfFFY5dMHdfKU87FMNgqGNkViaxH iNEhPrgS6Uz+tOPC59d8xd7uIFDDhzj+Z42LWjNl2U1qz9cdOLutU42N0biOABi5OQifbQ DoLGXlJFD3wwrHRCYzyE8cnjOQ/pe5y5nNTehdSEVBr7Ri20xPd/OJiMj/pRsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D262622 --- Comment #8 from Matteo Riondato --- To give you an idea of what would be necessary, but not sufficient, to solve the issue in bug #262590, you need something like the following patch (to be applied on top of the patch you posted in #5 This patch solves a subset of the issue outlined in bug #262590, in that at least now rules directly inside an anchor included in pf.conf with "anchor myanchor/*" are printed (but nested anchors are still not printed). To solve the real issue there, one likely needs to get the DIOCGETRULESETS ioctl involved, IMHO. diff -u pfctl.c pfctl.c.mine --- pfctl.c 2022-03-17 13:57:58.290678000 -0400 +++ pfctl.c.mine 2022-03-17 13:57:11.836505000 -0400 @@ -1251,10 +1251,20 @@ *(--p) =3D=3D '/')) || (opts & PF_OPT_RECURSE)))= { brace++; if ((p =3D strrchr(anchor_call, '/')) !=3D - NULL) + NULL && path[0] && + strnstr(anchor_call, path, p - anchor_call)) p++; - else + else { + int aclen =3D strlen(anchor_call); + if (anchor_call[aclen - 1] =3D=3D '= *') { + int idx =3D aclen - 2; + if (! (idx >=3D 0 && + anchor_call[idx] =3D=3D = '/')) + idx =3D 0; + anchor_call[idx] =3D '\0'; + } p =3D &anchor_call[0]; + } } else p =3D &anchor_call[0]; --=20 You are receiving this mail because: You are the assignee for the bug.=