From: Florian Westphal <fw@strlen.de>
To: pgnd <pgnd@dev-mail.net>
Cc: netfilter@vger.kernel.org
Subject: Re: syntax issues when reducing rules through grouping ?
Date: Thu, 18 Jul 2024 23:00:19 +0200 [thread overview]
Message-ID: <20240718210019.GA15052@breakpoint.cc> (raw)
In-Reply-To: <374dc2fb-f3e1-4599-a46f-524fd894ee32@dev-mail.net>
pgnd <pgnd@dev-mail.net> wrote:
> table nat {
> chain prerouting {
> type nat hook prerouting priority -150; policy accept;
>
> # SET1
> meta mark set 0x02 meta iifname "$VPN" meta oifname "$LAN" ip daddr $SVR1 udp dport 53
> meta mark set 0x02 meta iifname "$VPN" meta oifname "$LAN" ip daddr $SVR1 tcp dport 53
> meta mark set 0x02 meta iifname "$VPN" meta oifname "$LAN" ip daddr $SVR2 udp dport 25
> meta mark set 0x02 meta iifname "$VPN" meta oifname "$LAN" ip daddr $SVR2 tcp dport 465
>
> # SET2 (This seem a bit tortured, but it's fewer lines ...)
> meta mark set 0x02 meta iifname "$VPN" meta oifname "$LAN" ip daddr $SVR1 meta l4proto {tcp, udp} th dport 53
> meta mark set 0x02 meta iifname "$VPN" meta oifname "$LAN" ip daddr $SVR2 tcp dport { 25, 465 }
>
> # SET3
> meta mark set 0x02 {
> 24 meta iifname "$VPN" meta oifname "$LAN" ip daddr $SVR1 meta l4proto {tcp, udp} th dport 53
> 25 meta iifname "$VPN" meta oifname "$LAN" ip daddr $SVR2 tcp dport { 25, 465 }
> 26 }
> 27
> 28 }
> 29 }
>
>
> rule group "SETs" 1, 2 & 3 are _intended_ to be functionally equivalent, but simply increasingly "grouped" for convenience/readability (yes, arguable!)
>
> testing, SET1 & SET2 seem OK, but SET3 is clearly unhappy,
>
> nft -c -f tmp.nft
> tmp.nft:24:4-7: Error: syntax error, unexpected meta
> meta iifname "$VPN" meta oifname "$LAN" ip daddr $SVR1 meta l4proto {tcp, udp} th dport 53
> ^^^^
> tmp.nft:29:1-1: Error: syntax error, unexpected '}'
> }
> ^
>
> what's specifically DISallowed in my SET3 syntax usage?
Missing 'jump' or 'goto' keyword: meta mark set 2 jump { meta ...
prev parent reply other threads:[~2024-07-18 21:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-18 19:44 syntax issues when reducing rules through grouping ? pgnd
2024-07-18 21:00 ` Florian Westphal [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240718210019.GA15052@breakpoint.cc \
--to=fw@strlen.de \
--cc=netfilter@vger.kernel.org \
--cc=pgnd@dev-mail.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.