Timeout extension is not allocated in case that the default set timeout value is the same. However, with set element updates, this can be updated too so, allocate it but do not include it in netlink messages so users do not observe any change in the existing listings / events. This updates c3e1b005ed1c ("netfilter: nf_tables: add set element timeout support"). Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> --- Need rebase and extend tests. net/netfilter/nf_tables_api.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index ec616bbe75de..b7ede2aba06d 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -5642,6 +5642,7 @@ static int nf_tables_fill_setelem(struct sk_buff *skb, goto nla_put_failure; if (nft_set_ext_exists(ext, NFT_SET_EXT_TIMEOUT) && + *nft_set_ext_timeout(ext) != READ_ONCE(set->timeout) && nla_put_be64(skb, NFTA_SET_ELEM_TIMEOUT, nf_jiffies64_to_msecs(*nft_set_ext_timeout(ext)), NFTA_SET_ELEM_PAD)) @@ -6752,11 +6753,9 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set, if (err < 0) goto err_parse_key_end; - if (timeout != READ_ONCE(set->timeout)) { - err = nft_set_ext_add(&tmpl, NFT_SET_EXT_TIMEOUT); - if (err < 0) - goto err_parse_key_end; - } + err = nft_set_ext_add(&tmpl, NFT_SET_EXT_TIMEOUT); + if (err < 0) + goto err_parse_key_end; } if (num_exprs) { -- 2.30.2 --9isL2rVfE/aIL8hq Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="0002-netfilter-nf_tables-set-element-timeout-update-suppo.patch"