From: "Mikołaj Pisula" <mik.pisula@gmail.com>
To: netfilter@vger.kernel.org
Subject: Nftables conntrack state matching JSON syntax
Date: Thu, 22 Feb 2024 16:34:41 +0100 [thread overview]
Message-ID: <CADnfWnwPjtxx3pynh7DnozHA2hwFTvFmPvD_4kOKfopPGqTR-A@mail.gmail.com> (raw)
I have these two rules in my firewall:
ct state invalid drop
ct state { established, related } accept
When I use this command to get their JSON representations, i get the
following result:
# nft -j list ruleset | jq '.nftables[] | select(.rule.expr[]? and
.rule.expr[].match.left.ct?) | .rule.expr[0].match'
{
"op": "in",
"left": {
"ct": {
"key": "state"
}
},
"right": "invalid"
}
{
"op": "==",
"left": {
"ct": {
"key": "state"
}
},
"right": {
"set": [
"established",
"related"
]
}
}
Matching the "state" key with "invalid" uses the "in" operator, while
matching that same key with a set of "{ established, related }" uses
the "==" operator. Why is this the case? According to
libnftables-json(5) the "in" operator is used to "Perform a lookup,
i.e. test if bits on RHS are contained in LHS value." Is this the
case? If so, could I ask what the bitmasks for these states are?
Thank you for your time.
reply other threads:[~2024-02-22 15:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=CADnfWnwPjtxx3pynh7DnozHA2hwFTvFmPvD_4kOKfopPGqTR-A@mail.gmail.com \
--to=mik.pisula@gmail.com \
--cc=netfilter@vger.kernel.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).