From: Florian Westphal <fw@strlen.de>
To: "Thomas Köller" <thomas@koeller.dyndns.org>
Cc: netfilter@vger.kernel.org
Subject: Re: connection tracking state in rules
Date: Tue, 12 Nov 2024 19:21:33 +0100 [thread overview]
Message-ID: <20241112182133.GB28817@breakpoint.cc> (raw)
In-Reply-To: <c7d037d9-2261-4627-8e46-bd960f1ab6d3@koeller.dyndns.org>
Thomas Köller <thomas@koeller.dyndns.org> wrote:
> tried to create a rule using the conntrack state of a packet:
>
> [root@sarkovy nftables]# cat ruleset-own.txt
> create table netdev world
> add set netdev world blacklist { type ipv4_addr; flags dynamic,timeout;
> timeout 1h; gc-interval 6h; size 256; }
> create chain netdev world ingress { type filter hook ingress device
> "eth_cable" priority filter; policy drop; }
> add rule netdev world ingress ip protocol tcp ip saddr @blacklist counter
> drop
> add rule netdev world ingress ct state established,related counter accept
> [root@sarkovy nftables]# nft -cf ruleset-own.txt
> ruleset-own.txt:5:31-38: Error: Could not process rule: Protocol error
> add rule netdev world ingress ct state established,related counter accept
> ^^^^^^^^
> This is rejected, but why?
Conntrack state isn't available in ingress hook.
> And, btw., which one is correct, 'ct state established,related' or 'ct state
> { established,related }'?
Both work: related and established state are mutually exclusive.
established,related is a bit more compact and doesn't need the anonymous
set.
next prev parent reply other threads:[~2024-11-12 18:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-12 17:56 connection tracking state in rules Thomas Köller
2024-11-12 18:21 ` Florian Westphal [this message]
2024-11-12 18:24 ` Pablo Neira Ayuso
2024-11-12 19:04 ` Thomas Köller
2024-11-12 20:10 ` Kerin Millar
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=20241112182133.GB28817@breakpoint.cc \
--to=fw@strlen.de \
--cc=netfilter@vger.kernel.org \
--cc=thomas@koeller.dyndns.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox