Named sets with timeout
Dear nft Forum,
I’m a big friend of named sets, specially the timeout function is very great. But one thing is confusing me, assume the following named:
table ip filter_v4 {
set my_drop {
type ipv4_addr
flags timeout
}
...
...
}
Then i add the following sample element to it:
/usr/sbin/nft add set ip filter_v4 my_drop \{type ipv4_addr \; flags
timeout \; elements=\{a.b.c.d timeout 600s \} \;\}
All good so far, a.b.c.d is counting down as expected, begiing with 10min.
But when i wait - say 1 minute and repeat the 'nft add set ... 600s' command from above then the timer remains unchanged (?) It looks as the timer cannot get changed anymore once it has been initialized
Is this behavior by purpose?
And if, am I right to delete the element and re-assign it if I want to get the timer updated?
Many thanks
Matt
Quoted 10 lines · Matt
Then i add the following sample element to it:
/usr/sbin/nftadd set ipfilter_v4my_drop\{typeipv4_addr\; flags
timeout \; elements=\{a.b.c.d timeout 600s \} \;\}All good so far, a.b.c.d is counting down as expected, beginning with 10min.
But when I wait - say 1 minute and repeat the 'nft add set ... 600s' command from above then the timer remains unchanged (?) It looks as the timer cannot get changed anymore once it has been initialized.
I think you are right, but see this recent commit (in 0.9.2+):
24f33c7 2019-06-17 18:15 +0200 LGL
src: enable set expiration date for set elements
https://git.netfilter.org/nftables/commit/?id=24f33c7...which sounds like there is a new (as-yet-undocumented?) keyword for changing (as opposed to initializing) the timeout of a set element.
Quoted 15 lines · Trent W. Buck
Quoted 10 lines · Matt
Then i add the following sample element to it:
/usr/sbin/nftadd set ipfilter_v4my_drop\{typeipv4_addr\; flags
timeout \; elements=\{a.b.c.d timeout 600s \} \;\}All good so far, a.b.c.d is counting down as expected, beginning with 10min.
But when I wait - say 1 minute and repeat the 'nft add set ... 600s' command from above then the timer remains unchanged (?) It looks as the timer cannot get changed anymore once it has been initialized.I think you are right, but see this recent commit (in 0.9.2+):
Quoted 8 lines
24f33c7 2019-06-17 18:15 +0200 LGL src: enable set expiration date for set elements https://git.netfilter.org/nftables/commit/?id=24f33c7...which sounds like there is a new (as-yet-undocumented?) keyword for changing (as opposed to initializing) the timeout of a set element.
It's "update"
I.e. use update instead of add got get timeout to reset.
Needs kernel 5.3 IIRC
Cheers ... Duncan.
Quoted 1 line · Trent W. Buck
[...]
Quoted 11 lines
I think you are right, but see this recent commit (in 0.9.2+):
24f33c7 2019-06-17 18:15 +0200 LGL src: enable set expiration date for set elements https://git.netfilter.org/nftables/commit/?id=24f33c7...which sounds like there is a new (as-yet-undocumented?) keyword for changing (as opposed to initializing) the timeout of a set element.
Hi,
No new or undocumented keyword, it uses the already created syntax to dump expiration values in order to modify it. Please refer to [1] and [2].
As Duncan states, "update" is what you're looking for. Please check the first example of [2].
[1] https://wiki.nftables.org/wiki-nftables/index.php/Element_timeouts
[2] https://wiki.nftables.org/wiki-nftables/index.php/Updating_sets_from_the_packet_path
Cheers.
Quoted 9 lines · Laura Garcia
Quoted 4 lines · Trent W. Buck
I think you are right, but see [...]
https://git.netfilter.org/nftables/commit/?id=24f33c7
...which sounds like there is a new (as-yet-undocumented?) keyword for changing (as opposed to initializing) the timeout of a set element.No new or undocumented keyword, [...]
"update" is what you're looking for. [....]
[2] https://wiki.nftables.org/wiki-nftables/index.php/Updating_sets_from_the_packet_path
Thanks!
I apologize for my wrong & misleading answer. :-{
Quoted 9 lines · Trent W. Buck
Quoted 6 lines · Laura Garcia
Quoted 4 lines · Trent W. Buck
I think you are right, but see [...]
https://git.netfilter.org/nftables/commit/?id=24f33c7
...which sounds like there is a new (as-yet-undocumented?) keyword for changing (as opposed to initializing) the timeout of a set element.
Quoted 8 lines
Quoted 3 lines
No new or undocumented keyword, [...]
"update" is what you're looking for. [....]
[2] https://wiki.nftables.org/wiki-nftables/index.php/Updating_sets_from_the_packet_pathThanks!
I apologize for my wrong & misleading answer. :-{
No problem :)