Re: nftables expressions and operators

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you for the quick answer. That explains part of it. Still,

`tcp flags & (fin|syn|rst|ack) != syn` becomes
`tcp != syn / fin,syn,rst,ack`

and both expressions are interpreted as equal after parsing. Can you please point me to any documentation of operator expression syntax/precedence ?

On Mon, Nov 6, 2023, at 08:28, Pablo Neira Ayuso wrote:
> On Mon, Nov 06, 2023 at 08:11:09AM -0500, Aurel Wisse wrote:
> > Hi,
> > 
> > I am starting to learn nftables (only superficial previous experience with iptables) and I can't find certain syntax rules for expressions and operators in the wiki or the man page.
> > 
> > I am learning by listing the rulesets of certain predefined firewalls (fw4/OpenWRT, UFW) and I notice that certain listed rules contain operators which I can guess (hopefully correctly) from context and the original syntax in the imported file, but I would like to be sure in order not to make mistakes while building my own firewall.
> > 
> > Examples:
> > 
> > tcp flags & (fin|syn|rst|ack) != syn jump syn_flood
> > 
> > becomes
> > 
> > tcp flags syn / fin,syn,rst,ack jump syn_flood 
> 
> That is a bug in nftables v1.0.2, here with recent version it shows:
> 
> tcp flags != syn / fin,syn,rst,ack
> 
> > So, from context, commas without spaces around them are equivalent to logical or with precedence over "/", and "/" is somehow "!=" ?? . Where did the & (logical AND?) operator go?
> > 
> > This is just one example. I would like to learn the full operator syntax rules in nftables. Any ideas where I should look ? Do I have to dig into the source code ?
> > 
> > Thanks
> > 
> > Aurel
> > 
> > nftables v1.0.2 (Lester Gooch)
> > Pop-OS (6.5.6-76060506-generic)
> 



[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux