From nobody Thu May 26 13:40:30 2022 X-Original-To: freebsd-questions@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 56BC01B3E116 for ; Thu, 26 May 2022 13:40:36 +0000 (UTC) (envelope-from stefan+freebsd@stha.de) Received: from deponia.stha.de (deponia.stha.de [IPv6:2001:8d8:1801:133::1]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4L88Fv4XZhz3LW3 for ; Thu, 26 May 2022 13:40:35 +0000 (UTC) (envelope-from stefan+freebsd@stha.de) Received: from mta2.stha.lan (unknown [IPv6:fd86:82d7:b2e1:10::11]) by deponia.stha.de (Postfix) with ESMTPS id A4B7E248A; Thu, 26 May 2022 13:40:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stha.de; s=rsa_20220207; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID :Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=CI+lm/M8k/dtuMcInOpyLWZFrXnU57Rdv92G3o85a0Q=; b=XQUDQQH783GgFQ4Hx0P6QwQIMp 2WQ2EMNm7iJpSs0Mg+JETG5Sz8UoDCYN19wlI8hX2VODvJ5ptBtAN/+sS7Bx5Bj3myP86ZXMewjtK uuXV0h9WFwykzwEgeiJFqR8fh9oM4ajtyaet20zGo1GJ+H3FFa86bQ0zZhZ3pjdUnYOxXfRJ53DbY 9fBkmeFCSq7t1xRCW+IExVIvgdmFxlFBZRTBoq9Bpf9YUbmYpWDxQkNf3SRKetGDhZrB0FJ5RUsUj jTVNcZ52z6+llJdEXPTGh9zhMtSfqYjSehyzKfyu4+wqrh55EC4lyJtpij3l0nuaC5yEgnBwsWJf8 uQ3LJbFA==; DKIM-Signature: v=1; a=ed25519-sha256; q=dns/txt; c=relaxed/relaxed; d=stha.de ; s=ed25519_20220207; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=CI+lm/M8k/dtuMcInOpyLWZFrXnU57Rdv92G3o85a0Q=; b=UvhYJcGZIbapSSAxAGKvQbcF5A 2K+F7CQ1/XG5txH+TSiWUiD5QVcPmQyKP1lRZQVRYdyqhNsF6kuPpQwdGlBQ==; Received: from [fd86:82d7:b2e1:100::16] (helo=smtp.stha.de) by mta2.stha.lan with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.95 (FreeBSD)) (envelope-from ) id 1nuDmF-000EBA-FR; Thu, 26 May 2022 13:40:30 +0000 Received: from localhost (localhost [::1]) by smtp.stha.de (Postfix) with ESMTPSA id 3E8B22655; Thu, 26 May 2022 13:40:29 +0000 (UTC) Date: Thu, 26 May 2022 15:40:30 +0200 From: Stefan Haller To: Odhiambo Washington Cc: User Questions Subject: Re: pf.conf macros not working - syntax error Message-ID: References: List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4L88Fv4XZhz3LW3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=stha.de header.s=rsa_20220207 header.b=XQUDQQH7; dkim=pass header.d=stha.de header.s=ed25519_20220207 header.b=UvhYJcGZ; dmarc=pass (policy=none) header.from=stha.de; spf=pass (mx1.freebsd.org: domain of stefan@stha.de designates 2001:8d8:1801:133::1 as permitted sender) smtp.mailfrom=stefan@stha.de X-Spamd-Result: default: False [-2.58 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[stha.de:s=rsa_20220207,stha.de:s=ed25519_20220207]; FREEFALL_USER(0.00)[stefan]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+mx:c]; MID_RHS_MATCH_FROM(0.00)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_SPAM_SHORT(0.42)[0.417]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[stha.de:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[stha.de,none]; NEURAL_HAM_MEDIUM(-1.00)[-0.999]; MLMMJ_DEST(0.00)[freebsd-questions]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8560, ipnet:2001:8d8::/32, country:DE]; TAGGED_FROM(0.00)[freebsd]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On Thu, May 26, 2022 at 04:32:01PM +0300, Odhiambo Washington wrote: > Why do you need so many " " ? Can you please remove the double quotes > inside the braces? > You already quoted the foo and bar so I see no need to re-quote them inside > the braces. > > [16:24 ~ ]$ pfctl -nvf file > foo = "10.0.0.0/24" > bar = "10.1.0.0/24" > baz = "{ $foo $bar }" Unfortunately, this does not work, because inside "..." macros are not expanded. The macro baz literally contains the string "{ $foo $bar }". If we later use the macro baz as in > baz = "$foo $bar" > block in from $baz to any We get the syntax error (rightfully) on the block line. This is also properly documented in pf.conf(5): > MACROS > Macros can be defined that will later be expanded in context. Macro > names must start with a letter, and may contain letters, digits and > underscores. Macro names may not be reserved words (for example pass, > in, out). Macros are not expanded inside quotes. > > For example, > > ext_if = "kue0" > all_ifs = "{" $ext_if lo0 "}" > pass out on $ext_if from any to any > pass in on $ext_if proto tcp from any to any port 25