From: "Kerin Millar" <kfm@plushkava.net>
To: Slavko <linux@slavino.sk>, "Netfilter list" <netfilter@vger.kernel.org>
Subject: Re: Combine ipv4 and ipv6 in a set
Date: Thu, 01 Feb 2024 12:48:31 +0000 [thread overview]
Message-ID: <327e8447-e995-465b-9569-1a00fbc9ad68@app.fastmail.com> (raw)
In-Reply-To: <75cb1437-0fdb-4599-aa8e-9f12fdf6057b@slavino.sk>
Hi Slavko,
On Thu, 1 Feb 2024, at 10:50 AM, Slavko wrote:
> Dňa 31. 1. o 23:10 Kerin Millar napísal(a):
>
>> This has also annoyed me on several occasions. Though I have been using nftables for a fairly long time, I still find it more natural to organise rulesets based on the conventions of iptables. Old habits die hard, as the saying goes. Incidentally, there is an open bug concerning this.
>
> Perhaps you know that, but IMO it can be useful for some...
>
> IMO the root of confusion comes from fact, that both (iptables/nft) uses
> the same name -- "table". I don't want to discuss if it was or wasn't
> good decision, as it doesn't matter, it is only name.
>
> In iptables table more or less defines chain's hook priority:
>
> CHAIN => hook type
> TABLE => hook priority
>
> In nftables one have (can) to define hook type and its priority by self,
> thus that purpose of ipt TABLEs is gone and main purpose of table
> changed to define family (and group objects) and name it.
Quite. It's nothing more than an "object" namespace with an associated address family. In what way it resembles a table, I do not know.
>
> I fight with that hook's priorities for long time, i was not able to get
> it, until symbolic names for priorities was introduced. And after math
> can be used in its definition (eg. filter + 5) it is really simple now.
> Great job.
>
>>> BTW, i am curious, how big difference (in performance/time) is to
>>> search IPv4 vs. IPv6 address in set? Is it worth to consider?
>>
>> I do not know but I would expect a lookup to be very efficient in both cases.
>
> I know only very little how ipsets stores items internally, mostly only
> that it uses hashes and tries, and i know nothing about sets. I know,
> that these tries are efficient way to search in large datasets, with
> near to constant search time. But if someone complains about performance
> (IP vs. IPv6) of ipsets/sets, there must be difference. The question is,
> if it is important/significant.
>
>> I haven't paid much attention to memory usage. Benchmarking performance is fairly straightforward with the use of the shell, especially bash because it offers some useful features such as:
>
> I mean performance in packet flow, how long it tooks to find (or not
> find) match or update/add from FW rule with ipset and with set, if both
> uses the same dataset size. If size of ipset/set matter, etc. Will be
> measured command time the same for particular action as from packet
> flow? That comparison will reveal, if sets are real replacement of
> ipsets in all (or most) cases or not. Or will be adding/removing item(s)
> from command line time the same as from packet flow? (IMO not, as
> command invocation plays role too)
I don't think that there is an abundance of material on this topic but I recall seeing one or two articles on the web concerning this sort of performance measurement (by well known Netfilter developers/contributors).
>
> BTW i recently realized how important can be command time, first some
> attack (which fills ipsets with thousands IPs), then kernel update, thus
> restart was needed, and it reveals how inefficient way fail2ban uses to
> restore ipset bans :-D But that is not nft related (and it was short
> time shock)...
>
>> You might find it interesting to look at existing issues concerning the use of sets by visiting the following link.
>
> thanks, i will check them from time to time...
>
>> Of those, #1584 concerns "high memory requirements", where Pablo appears to be using https://valgrind.org/docs/manual/ms-manual.html to profile memory usage.
>
> I meet valgrind only two or three times, related to some bug finding,
> but i got full guide from devs (do that, run that and post that or so),
> without understanding what i am doing...
>
> Ipset shows in output (list) how much memory particular set uses, can i
> get that info from set listing (to compare)?
Try:
nft -t list sets
Alternatively:
nft -jt list sets | jq -r '.nftables[1:] | .[].set | [ .table, .family, .name, .size ] | @csv'
The problem is that the size isn't always shown. I complained about it here:
https://bugzilla.netfilter.org/show_bug.cgi?id=1717.
--
Kerin Millar
next prev parent reply other threads:[~2024-02-01 12:50 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-30 10:17 Combine ipv4 and ipv6 in a set Daniel
2024-01-30 10:39 ` Kerin Millar
2024-01-30 12:13 ` Daniel
2024-01-30 12:59 ` Daniel
2024-01-30 13:08 ` Marc Haber
2024-01-30 13:22 ` Kim B. Heino
2024-01-31 10:21 ` Marc Haber
2024-01-31 11:22 ` Kim B. Heino
2024-01-30 15:17 ` Kerin Millar
2024-01-30 17:00 ` Slavko
2024-01-30 17:57 ` Kerin Millar
2024-01-30 19:34 ` Slavko
2024-01-30 22:05 ` Kerin Millar
2024-02-01 12:13 ` Marc Haber
2024-01-31 11:27 ` Marc Haber
2024-01-31 11:13 ` Marc Haber
2024-01-31 11:00 ` Marc Haber
2024-01-31 10:54 ` Marc Haber
2024-01-31 11:55 ` Daniel
2024-02-01 11:39 ` Marc Haber
2024-01-31 13:02 ` Kerin Millar
2024-01-31 20:23 ` Slavko
2024-01-31 22:10 ` Kerin Millar
2024-02-01 6:06 ` Kevin P. Fleming
2024-02-01 17:09 ` Kerin Millar
2024-02-01 10:50 ` Slavko
2024-02-01 12:48 ` Kerin Millar [this message]
2024-02-01 13:42 ` Slavko
2024-02-01 14:03 ` Kerin Millar
2024-01-31 22:36 ` Pablo Neira Ayuso
2024-02-01 8:22 ` Slavko
2024-02-02 1:38 ` Eric
2024-02-02 9:23 ` Pablo Neira Ayuso
2024-02-03 9:24 ` Slavko
2024-02-03 15:49 ` Eric
2024-02-05 9:47 ` Pablo Neira Ayuso
2024-02-05 17:02 ` Eric
2024-02-05 17:08 ` Pablo Neira Ayuso
2024-02-05 17:16 ` Eric
2024-02-01 11:33 ` Marc Haber
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=327e8447-e995-465b-9569-1a00fbc9ad68@app.fastmail.com \
--to=kfm@plushkava.net \
--cc=linux@slavino.sk \
--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