From: "William N." <netfilter@riseup.net>
To: netfilter@vger.kernel.org
Subject: Re: [Thread split] nftables rule optimization - dropping invalid in ingress?
Date: Sat, 20 Apr 2024 18:37:50 -0000 [thread overview]
Message-ID: <20240420183750.332ffbad@localhost> (raw)
In-Reply-To: <20240420084802.6ff973cf@localhost>
After spending some time looking for more info and based on this:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/netfilter/nf_conntrack_proto_tcp.c?h=v5.8#n700
I think I figured it out:
tcp flags & (fin|syn|rst|ack|urg) != {
syn,
syn|urg,
syn|ack,
rst,
rst|ack,
fin|ack,
fin|ack|urg,
ack,
ack|urg
} drop comment "TCP invalid"
This checks the listed values against the mask "fin|syn|rst|ack|urg".
The same values and mask are used in the conntrack code, i.e. it drops
invalid TCP packets.
According to my own tests, this works in the ingress hook, i.e. early
drop.
The only question that remains is performance measurement and
comparison, as mentioned.
Please let me know what you think.
next prev parent reply other threads:[~2024-04-20 18:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-20 8:48 [Thread split] nftables rule optimization - dropping invalid in ingress? William N.
2024-04-20 18:37 ` William N. [this message]
2024-04-20 19:16 ` Kerin Millar
2024-04-21 17:47 ` William N.
2024-04-27 19:23 ` William N.
2024-04-21 3:45 ` Eric
2024-04-21 5:47 ` Slavko
2024-04-21 17:50 ` William N.
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=20240420183750.332ffbad@localhost \
--to=netfilter@riseup.net \
--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 NNTP newsgroup(s).