Skip to contentSkip to conversation

netfilter: nf_tables: do not refresh timeout when resetting element

PATCH Superseded Pablo Neira Ayuso 3 participants 21 messages Oct 2, 2023 – Oct 10, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nf_tables: do not refresh timeout when resetting element

The dump and reset command should not refresh the timeout, this command is intended to allow users to list existing stateful objects and reset them, element expiration should be refresh via transaction instead with a specific command to achieve this, otherwise this is entering combo semantics that will be hard to be undone later (eg. a user asking to retrieve counters but _not_ requiring to refresh expiration).

Fixes 079cd633219d ("netfilter: nf_tables: Introduce NFT_MSG_GETSETELEM_RESET")
---
 net/netfilter/nf_tables_api.c | 3 ---
 1 file changed, 3 deletions(-)
net/netfilter/nf_tables_api.c +0 -3
index 3bb5ea5d4eed..0e375b7a7cad 100644
@@ -5615,9 +5615,6 @@ static int nf_tables_fill_setelem(struct sk_buff *skb,
 				 nf_jiffies64_to_msecs(expires),
 				 NFTA_SET_ELEM_PAD))
 			goto nla_put_failure;
-
-		if (reset)
-			*nft_set_ext_expiration(ext) = now + timeout;
 	}
 
 	if (nft_set_ext_exists(ext, NFT_SET_EXT_USERDATA)) {
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 6 lines · Pablo Neira Ayuso

The dump and reset command should not refresh the timeout, this command is intended to allow users to list existing stateful objects and reset them, element expiration should be refresh via transaction instead with a specific command to achieve this, otherwise this is entering combo semantics that will be hard to be undone later (eg. a user asking to retrieve counters but _not_ requiring to refresh expiration).

Agreed.

reviewer
#2 lore raw
In reply to Pablo Neira Ayuso
Quoted 6 lines · Pablo Neira Ayuso

The dump and reset command should not refresh the timeout, this command is intended to allow users to list existing stateful objects and reset them, element expiration should be refresh via transaction instead with a specific command to achieve this, otherwise this is entering combo semantics that will be hard to be undone later (eg. a user asking to retrieve counters but _not_ requiring to refresh expiration).

From a users' perspective, what is special about the element expires value disqualifying it from being reset along with any counter/quota values?

Do you have a PoC for set element reset via transaction yet? Can we integrate non-timeout resets with it, too? Because IIUC, that's an alternative to the pending reset locking.

What we have now is a broad 'reset element', not specifying what to reset. If the above is a feature being asked for, I'd rather implement 'reset element counter', 'reset element timeout', 'reset element quota', etc. commands.

Cheers, Phil

author maintainer
#3 lore raw
Quoted 8 lines · Phil Sutter
Quoted 6 lines · Pablo Neira Ayuso

The dump and reset command should not refresh the timeout, this command is intended to allow users to list existing stateful objects and reset them, element expiration should be refresh via transaction instead with a specific command to achieve this, otherwise this is entering combo semantics that will be hard to be undone later (eg. a user asking to retrieve counters but _not_ requiring to refresh expiration).

Quoted 7 lines

From a users' perspective, what is special about the element expires value disqualifying it from being reset along with any counter/quota values?

Do you have a PoC for set element reset via transaction yet? Can we integrate non-timeout resets with it, too? Because IIUC, that's an alternative to the pending reset locking.

Problem is listing is not supported from transaction path, this is using existing netlink dump infrastructure which runs lockless via rcu. So we could support reset, but we could not use netlink dump semantics to fetch the values, and user likely wants this to fetch-and-reset as in ctnetlink.

Quoted 4 lines

What we have now is a broad 'reset element', not specifying what to reset. If the above is a feature being asked for, I'd rather implement 'reset element counter', 'reset element timeout', 'reset element quota', etc. commands.

We are currently discussing how to implement refresh timeout into the transaction model.

I would suggest we keep this chunk away by now for the _RESET command, until we agree on next steps.

author maintainer
#4 lore raw
Quoted 17 lines · Pablo Neira Ayuso
Quoted 8 lines · Phil Sutter
Quoted 6 lines · Pablo Neira Ayuso

The dump and reset command should not refresh the timeout, this command is intended to allow users to list existing stateful objects and reset them, element expiration should be refresh via transaction instead with a specific command to achieve this, otherwise this is entering combo semantics that will be hard to be undone later (eg. a user asking to retrieve counters but _not_ requiring to refresh expiration).

Quoted 7 lines

From a users' perspective, what is special about the element expires value disqualifying it from being reset along with any counter/quota values?

Do you have a PoC for set element reset via transaction yet? Can we integrate non-timeout resets with it, too? Because IIUC, that's an alternative to the pending reset locking.

Quoted 5 lines

Problem is listing is not supported from transaction path, this is using existing netlink dump infrastructure which runs lockless via rcu. So we could support reset, but we could not use netlink dump semantics to fetch the values, and user likely wants this to fetch-and-reset as in ctnetlink.

Well, with NLM_F_ECHO, it should be possible to explore reset under commit_mutex, but is it really worth the effort?

With two concurrent threads, we just want to ensure that no invalid state shows in the listing (you mentioned it is possible to list negative values with two threads listing-and-resetting at the same time).

I think we should just make sure something valid is included in the listing, but as for the two threads performing list-and-reset, why ensure strict serialization?

This is a rare operation to fetch statistics, most likely having a single process performing this in place? So we are currently discussing how to fix the (negative) non-sense in the listing.

Quoted 10 lines
Quoted 4 lines

What we have now is a broad 'reset element', not specifying what to reset. If the above is a feature being asked for, I'd rather implement 'reset element counter', 'reset element timeout', 'reset element quota', etc. commands.

We are currently discussing how to implement refresh timeout into the transaction model.

I would suggest we keep this chunk away by now for the _RESET command, until we agree on next steps.

reviewer
#5 lore raw
Quoted 18 lines · Pablo Neira Ayuso
Quoted 17 lines · Pablo Neira Ayuso
Quoted 15 lines · Phil Sutter
Quoted 6 lines · Pablo Neira Ayuso

The dump and reset command should not refresh the timeout, this command is intended to allow users to list existing stateful objects and reset them, element expiration should be refresh via transaction instead with a specific command to achieve this, otherwise this is entering combo semantics that will be hard to be undone later (eg. a user asking to retrieve counters but _not_ requiring to refresh expiration).

From a users' perspective, what is special about the element expires value disqualifying it from being reset along with any counter/quota values?

Do you have a PoC for set element reset via transaction yet? Can we integrate non-timeout resets with it, too? Because IIUC, that's an alternative to the pending reset locking.

Quoted 8 lines
Quoted 5 lines

Problem is listing is not supported from transaction path, this is using existing netlink dump infrastructure which runs lockless via rcu. So we could support reset, but we could not use netlink dump semantics to fetch the values, and user likely wants this to fetch-and-reset as in ctnetlink.

Well, with NLM_F_ECHO, it should be possible to explore reset under commit_mutex, but is it really worth the effort?

I don't understand. Wasn't it your proposal to move things into the transaction? Above you write: "element expiration should be refresh via transaction instead". I asked what is special about timeout, why not handle all element state reset the same way?

Quoted 4 lines

With two concurrent threads, we just want to ensure that no invalid state shows in the listing (you mentioned it is possible to list negative values with two threads listing-and-resetting at the same time).

It's not just in the listing, the actual values underrun. A quota e.g. will immediately deny.

Quoted 3 lines

I think we should just make sure something valid is included in the listing, but as for the two threads performing list-and-reset, why ensure strict serialization?

I seem to lack context here. Is there an alternative to "strict" serializing? Expressions' dump+reset callbacks must not run multiple times at the same time for the same expression. At least not how they are currently implemented.

Quoted 14 lines

This is a rare operation to fetch statistics, most likely having a single process performing this in place? So we are currently discussing how to fix the (negative) non-sense in the listing.

Quoted 10 lines
Quoted 4 lines

What we have now is a broad 'reset element', not specifying what to reset. If the above is a feature being asked for, I'd rather implement 'reset element counter', 'reset element timeout', 'reset element quota', etc. commands.

We are currently discussing how to implement refresh timeout into the transaction model.

I would suggest we keep this chunk away by now for the _RESET command, until we agree on next steps.

I would suggest to leave things as-is until there's hard evidence why it has to change now or there is a viable alternative implementation.

It's your call to make since you're the maintainer of the project, but please stick to the standards you demand from other contributors.

Cheers, Phil

author maintainer
#6 lore raw
Quoted 59 lines · Phil Sutter
Quoted 18 lines · Pablo Neira Ayuso
Quoted 17 lines · Pablo Neira Ayuso
Quoted 15 lines · Phil Sutter
Quoted 6 lines · Pablo Neira Ayuso

The dump and reset command should not refresh the timeout, this command is intended to allow users to list existing stateful objects and reset them, element expiration should be refresh via transaction instead with a specific command to achieve this, otherwise this is entering combo semantics that will be hard to be undone later (eg. a user asking to retrieve counters but _not_ requiring to refresh expiration).

From a users' perspective, what is special about the element expires value disqualifying it from being reset along with any counter/quota values?

Do you have a PoC for set element reset via transaction yet? Can we integrate non-timeout resets with it, too? Because IIUC, that's an alternative to the pending reset locking.

Quoted 8 lines
Quoted 5 lines

Problem is listing is not supported from transaction path, this is using existing netlink dump infrastructure which runs lockless via rcu. So we could support reset, but we could not use netlink dump semantics to fetch the values, and user likely wants this to fetch-and-reset as in ctnetlink.

Well, with NLM_F_ECHO, it should be possible to explore reset under commit_mutex, but is it really worth the effort?

I don't understand. Wasn't it your proposal to move things into the transaction? Above you write: "element expiration should be refresh via transaction instead". I asked what is special about timeout, why not handle all element state reset the same way?

Quoted 4 lines

With two concurrent threads, we just want to ensure that no invalid state shows in the listing (you mentioned it is possible to list negative values with two threads listing-and-resetting at the same time).

It's not just in the listing, the actual values underrun. A quota e.g. will immediately deny.

Quoted 3 lines

I think we should just make sure something valid is included in the listing, but as for the two threads performing list-and-reset, why ensure strict serialization?

I seem to lack context here. Is there an alternative to "strict" serializing? Expressions' dump+reset callbacks must not run multiple times at the same time for the same expression. At least not how they are currently implemented.

Quoted 9 lines

This is a rare operation to fetch statistics, most likely having a single process performing this in place? So we are currently discussing how to fix the (negative) non-sense in the listing.

Quoted 5 lines
Quoted 4 lines

What we have now is a broad 'reset element', not specifying what to reset. If the above is a feature being asked for, I'd rather implement 'reset element counter', 'reset element timeout', 'reset element quota', etc. commands.

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

We are currently discussing how to implement refresh timeout into the transaction model.

I would suggest we keep this chunk away by now for the _RESET command, until we agree on next steps.

I would suggest to leave things as-is until there's hard evidence why it has to change now or there is a viable alternative implementation.

Leave things as is means we will have this implicit refresh in the element refresh. We have no such semantics in conntrack, for example, and conntrack can be seen as a hardcoded set with a fixed number of tuples.

Quoted 2 lines

It's your call to make since you're the maintainer of the project, but please stick to the standards you demand from other contributors.

We are discussing a very specific topic here and I am expecting to get some kind of acknowledgement from you that this revert of this specific chunk is good to have.

reviewer
#7 lore raw
Quoted 66 lines · Pablo Neira Ayuso
Quoted 65 lines · Phil Sutter
Quoted 18 lines · Pablo Neira Ayuso
Quoted 17 lines · Pablo Neira Ayuso
Quoted 15 lines · Phil Sutter
Quoted 6 lines · Pablo Neira Ayuso

The dump and reset command should not refresh the timeout, this command is intended to allow users to list existing stateful objects and reset them, element expiration should be refresh via transaction instead with a specific command to achieve this, otherwise this is entering combo semantics that will be hard to be undone later (eg. a user asking to retrieve counters but _not_ requiring to refresh expiration).

From a users' perspective, what is special about the element expires value disqualifying it from being reset along with any counter/quota values?

Do you have a PoC for set element reset via transaction yet? Can we integrate non-timeout resets with it, too? Because IIUC, that's an alternative to the pending reset locking.

Quoted 8 lines
Quoted 5 lines

Problem is listing is not supported from transaction path, this is using existing netlink dump infrastructure which runs lockless via rcu. So we could support reset, but we could not use netlink dump semantics to fetch the values, and user likely wants this to fetch-and-reset as in ctnetlink.

Well, with NLM_F_ECHO, it should be possible to explore reset under commit_mutex, but is it really worth the effort?

I don't understand. Wasn't it your proposal to move things into the transaction? Above you write: "element expiration should be refresh via transaction instead". I asked what is special about timeout, why not handle all element state reset the same way?

Quoted 4 lines

With two concurrent threads, we just want to ensure that no invalid state shows in the listing (you mentioned it is possible to list negative values with two threads listing-and-resetting at the same time).

It's not just in the listing, the actual values underrun. A quota e.g. will immediately deny.

Quoted 3 lines

I think we should just make sure something valid is included in the listing, but as for the two threads performing list-and-reset, why ensure strict serialization?

I seem to lack context here. Is there an alternative to "strict" serializing? Expressions' dump+reset callbacks must not run multiple times at the same time for the same expression. At least not how they are currently implemented.

Quoted 14 lines

This is a rare operation to fetch statistics, most likely having a single process performing this in place? So we are currently discussing how to fix the (negative) non-sense in the listing.

Quoted 10 lines
Quoted 4 lines

What we have now is a broad 'reset element', not specifying what to reset. If the above is a feature being asked for, I'd rather implement 'reset element counter', 'reset element timeout', 'reset element quota', etc. commands.

We are currently discussing how to implement refresh timeout into the transaction model.

I would suggest we keep this chunk away by now for the _RESET command, until we agree on next steps.

Quoted 7 lines
Quoted 2 lines

I would suggest to leave things as-is until there's hard evidence why it has to change now or there is a viable alternative implementation.

Leave things as is means we will have this implicit refresh in the element refresh. We have no such semantics in conntrack, for example, and conntrack can be seen as a hardcoded set with a fixed number of tuples.

It's just as implicit as counter or quota reset. I define "reset element" command as "reset any state in given element", so from my perspective it makes perfectly sense to reset the timeout as well.

Quoted 6 lines
Quoted 2 lines

It's your call to make since you're the maintainer of the project, but please stick to the standards you demand from other contributors.

We are discussing a very specific topic here and I am expecting to get some kind of acknowledgement from you that this revert of this specific chunk is good to have.

Given the data you provided: No, I don't see any sense in this change.

Cheers, Phil

author maintainer
#8 lore raw
Quoted 70 lines · Phil Sutter
Quoted 69 lines · Pablo Neira Ayuso
Quoted 67 lines · Phil Sutter
Quoted 18 lines · Pablo Neira Ayuso
Quoted 17 lines · Pablo Neira Ayuso
Quoted 15 lines · Phil Sutter
Quoted 6 lines · Pablo Neira Ayuso

The dump and reset command should not refresh the timeout, this command is intended to allow users to list existing stateful objects and reset them, element expiration should be refresh via transaction instead with a specific command to achieve this, otherwise this is entering combo semantics that will be hard to be undone later (eg. a user asking to retrieve counters but _not_ requiring to refresh expiration).

From a users' perspective, what is special about the element expires value disqualifying it from being reset along with any counter/quota values?

Do you have a PoC for set element reset via transaction yet? Can we integrate non-timeout resets with it, too? Because IIUC, that's an alternative to the pending reset locking.

Quoted 8 lines
Quoted 5 lines

Problem is listing is not supported from transaction path, this is using existing netlink dump infrastructure which runs lockless via rcu. So we could support reset, but we could not use netlink dump semantics to fetch the values, and user likely wants this to fetch-and-reset as in ctnetlink.

Well, with NLM_F_ECHO, it should be possible to explore reset under commit_mutex, but is it really worth the effort?

I don't understand. Wasn't it your proposal to move things into the transaction? Above you write: "element expiration should be refresh via transaction instead". I asked what is special about timeout, why not handle all element state reset the same way?

Quoted 4 lines

With two concurrent threads, we just want to ensure that no invalid state shows in the listing (you mentioned it is possible to list negative values with two threads listing-and-resetting at the same time).

It's not just in the listing, the actual values underrun. A quota e.g. will immediately deny.

Quoted 3 lines

I think we should just make sure something valid is included in the listing, but as for the two threads performing list-and-reset, why ensure strict serialization?

I seem to lack context here. Is there an alternative to "strict" serializing? Expressions' dump+reset callbacks must not run multiple times at the same time for the same expression. At least not how they are currently implemented.

Quoted 14 lines

This is a rare operation to fetch statistics, most likely having a single process performing this in place? So we are currently discussing how to fix the (negative) non-sense in the listing.

Quoted 10 lines
Quoted 4 lines

What we have now is a broad 'reset element', not specifying what to reset. If the above is a feature being asked for, I'd rather implement 'reset element counter', 'reset element timeout', 'reset element quota', etc. commands.

We are currently discussing how to implement refresh timeout into the transaction model.

I would suggest we keep this chunk away by now for the _RESET command, until we agree on next steps.

I would suggest to leave things as-is until there's hard evidence why it has to change now or there is a viable alternative implementation.

Quoted 8 lines
Quoted 4 lines

Leave things as is means we will have this implicit refresh in the element refresh. We have no such semantics in conntrack, for example, and conntrack can be seen as a hardcoded set with a fixed number of tuples.

It's just as implicit as counter or quota reset. I define "reset element" command as "reset any state in given element", so from my perspective it makes perfectly sense to reset the timeout as well.

The timer is usually updated from the packet path. We are now planning to support for refreshing the timer from control plane which is not supported.

Note it is possible to set custom timeouts in elements too, for example:

        # nft add element x y { 1.2.3.4 expires 50s }

while default set policy might be different 3m. In this case, you assume resetting to the default set timeout policy (3m) is fine.

I can keep searching for more scenarios where this timeout refresh does not make sense in this reset path.

reviewer
#9 lore raw
Quoted 76 lines · Pablo Neira Ayuso
Quoted 75 lines · Phil Sutter
Quoted 73 lines · Pablo Neira Ayuso
Quoted 59 lines · Phil Sutter
Quoted 18 lines · Pablo Neira Ayuso
Quoted 17 lines · Pablo Neira Ayuso
Quoted 15 lines · Phil Sutter
Quoted 6 lines · Pablo Neira Ayuso

The dump and reset command should not refresh the timeout, this command is intended to allow users to list existing stateful objects and reset them, element expiration should be refresh via transaction instead with a specific command to achieve this, otherwise this is entering combo semantics that will be hard to be undone later (eg. a user asking to retrieve counters but _not_ requiring to refresh expiration).

From a users' perspective, what is special about the element expires value disqualifying it from being reset along with any counter/quota values?

Do you have a PoC for set element reset via transaction yet? Can we integrate non-timeout resets with it, too? Because IIUC, that's an alternative to the pending reset locking.

Quoted 8 lines
Quoted 5 lines

Problem is listing is not supported from transaction path, this is using existing netlink dump infrastructure which runs lockless via rcu. So we could support reset, but we could not use netlink dump semantics to fetch the values, and user likely wants this to fetch-and-reset as in ctnetlink.

Well, with NLM_F_ECHO, it should be possible to explore reset under commit_mutex, but is it really worth the effort?

I don't understand. Wasn't it your proposal to move things into the transaction? Above you write: "element expiration should be refresh via transaction instead". I asked what is special about timeout, why not handle all element state reset the same way?

Quoted 4 lines

With two concurrent threads, we just want to ensure that no invalid state shows in the listing (you mentioned it is possible to list negative values with two threads listing-and-resetting at the same time).

It's not just in the listing, the actual values underrun. A quota e.g. will immediately deny.

Quoted 3 lines

I think we should just make sure something valid is included in the listing, but as for the two threads performing list-and-reset, why ensure strict serialization?

I seem to lack context here. Is there an alternative to "strict" serializing? Expressions' dump+reset callbacks must not run multiple times at the same time for the same expression. At least not how they are currently implemented.

Quoted 9 lines

This is a rare operation to fetch statistics, most likely having a single process performing this in place? So we are currently discussing how to fix the (negative) non-sense in the listing.

Quoted 5 lines
Quoted 4 lines

What we have now is a broad 'reset element', not specifying what to reset. If the above is a feature being asked for, I'd rather implement 'reset element counter', 'reset element timeout', 'reset element quota', etc. commands.

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

We are currently discussing how to implement refresh timeout into the transaction model.

I would suggest we keep this chunk away by now for the _RESET command, until we agree on next steps.

I would suggest to leave things as-is until there's hard evidence why it has to change now or there is a viable alternative implementation.

Leave things as is means we will have this implicit refresh in the element refresh. We have no such semantics in conntrack, for example, and conntrack can be seen as a hardcoded set with a fixed number of tuples.

Quoted 7 lines
Quoted 3 lines

It's just as implicit as counter or quota reset. I define "reset element" command as "reset any state in given element", so from my perspective it makes perfectly sense to reset the timeout as well.

The timer is usually updated from the packet path. We are now planning to support for refreshing the timer from control plane which is not supported.

This implies that people create dynamic sets and then use reset command on the temporary elements. I would assume one either lets packet path "maintain" elements or control path but not both.

Quoted 4 lines

Note it is possible to set custom timeouts in elements too, for example:

        # nft add element x y { 1.2.3.4 expires 50s }

I assumed this is for dump'n'restore purposes. If you set a custom *timeout* when adding a set, the current reset code respects that.

Quoted 5 lines

while default set policy might be different 3m. In this case, you assume resetting to the default set timeout policy (3m) is fine.

I can keep searching for more scenarios where this timeout refresh does not make sense in this reset path.

Cheers, Phil

author maintainer
#10 lore raw
Quoted 89 lines · Phil Sutter
Quoted 76 lines · Pablo Neira Ayuso
Quoted 75 lines · Phil Sutter
Quoted 73 lines · Pablo Neira Ayuso
Quoted 59 lines · Phil Sutter
Quoted 18 lines · Pablo Neira Ayuso
Quoted 17 lines · Pablo Neira Ayuso
Quoted 15 lines · Phil Sutter
Quoted 6 lines · Pablo Neira Ayuso

The dump and reset command should not refresh the timeout, this command is intended to allow users to list existing stateful objects and reset them, element expiration should be refresh via transaction instead with a specific command to achieve this, otherwise this is entering combo semantics that will be hard to be undone later (eg. a user asking to retrieve counters but _not_ requiring to refresh expiration).

From a users' perspective, what is special about the element expires value disqualifying it from being reset along with any counter/quota values?

Do you have a PoC for set element reset via transaction yet? Can we integrate non-timeout resets with it, too? Because IIUC, that's an alternative to the pending reset locking.

Quoted 8 lines
Quoted 5 lines

Problem is listing is not supported from transaction path, this is using existing netlink dump infrastructure which runs lockless via rcu. So we could support reset, but we could not use netlink dump semantics to fetch the values, and user likely wants this to fetch-and-reset as in ctnetlink.

Well, with NLM_F_ECHO, it should be possible to explore reset under commit_mutex, but is it really worth the effort?

I don't understand. Wasn't it your proposal to move things into the transaction? Above you write: "element expiration should be refresh via transaction instead". I asked what is special about timeout, why not handle all element state reset the same way?

Quoted 4 lines

With two concurrent threads, we just want to ensure that no invalid state shows in the listing (you mentioned it is possible to list negative values with two threads listing-and-resetting at the same time).

It's not just in the listing, the actual values underrun. A quota e.g. will immediately deny.

Quoted 3 lines

I think we should just make sure something valid is included in the listing, but as for the two threads performing list-and-reset, why ensure strict serialization?

I seem to lack context here. Is there an alternative to "strict" serializing? Expressions' dump+reset callbacks must not run multiple times at the same time for the same expression. At least not how they are currently implemented.

Quoted 9 lines

This is a rare operation to fetch statistics, most likely having a single process performing this in place? So we are currently discussing how to fix the (negative) non-sense in the listing.

Quoted 5 lines
Quoted 4 lines

What we have now is a broad 'reset element', not specifying what to reset. If the above is a feature being asked for, I'd rather implement 'reset element counter', 'reset element timeout', 'reset element quota', etc. commands.

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

We are currently discussing how to implement refresh timeout into the transaction model.

I would suggest we keep this chunk away by now for the _RESET command, until we agree on next steps.

I would suggest to leave things as-is until there's hard evidence why it has to change now or there is a viable alternative implementation.

Leave things as is means we will have this implicit refresh in the element refresh. We have no such semantics in conntrack, for example, and conntrack can be seen as a hardcoded set with a fixed number of tuples.

Quoted 7 lines
Quoted 3 lines

It's just as implicit as counter or quota reset. I define "reset element" command as "reset any state in given element", so from my perspective it makes perfectly sense to reset the timeout as well.

The timer is usually updated from the packet path. We are now planning to support for refreshing the timer from control plane which is not supported.

This implies that people create dynamic sets and then use reset command on the temporary elements. I would assume one either lets packet path "maintain" elements or control path but not both.

Quoted 7 lines
Quoted 4 lines

Note it is possible to set custom timeouts in elements too, for example:

        # nft add element x y { 1.2.3.4 expires 50s }

I assumed this is for dump'n'restore purposes. If you set a custom *timeout* when adding a set, the current reset code respects that.

This could be an exception, ie. a specific timeout for a given element, I am afraid there are more usecases that just a dump'n'restore. User is really free to add specific timeouts for the sets it adds. The default set timeout only applies if user does not specify a timeout for new elements.

Quoted 2 lines
Quoted 2 lines

while default set policy might be different 3m. In this case, you assume resetting to the default set timeout policy (3m) is fine.

reviewer
#11 lore raw
Quoted 95 lines · Pablo Neira Ayuso
Quoted 94 lines · Phil Sutter
Quoted 76 lines · Pablo Neira Ayuso
Quoted 75 lines · Phil Sutter
Quoted 73 lines · Pablo Neira Ayuso
Quoted 59 lines · Phil Sutter
Quoted 18 lines · Pablo Neira Ayuso
Quoted 17 lines · Pablo Neira Ayuso
Quoted 15 lines · Phil Sutter
Quoted 6 lines · Pablo Neira Ayuso

The dump and reset command should not refresh the timeout, this command is intended to allow users to list existing stateful objects and reset them, element expiration should be refresh via transaction instead with a specific command to achieve this, otherwise this is entering combo semantics that will be hard to be undone later (eg. a user asking to retrieve counters but _not_ requiring to refresh expiration).

From a users' perspective, what is special about the element expires value disqualifying it from being reset along with any counter/quota values?

Do you have a PoC for set element reset via transaction yet? Can we integrate non-timeout resets with it, too? Because IIUC, that's an alternative to the pending reset locking.

Quoted 8 lines
Quoted 5 lines

Problem is listing is not supported from transaction path, this is using existing netlink dump infrastructure which runs lockless via rcu. So we could support reset, but we could not use netlink dump semantics to fetch the values, and user likely wants this to fetch-and-reset as in ctnetlink.

Well, with NLM_F_ECHO, it should be possible to explore reset under commit_mutex, but is it really worth the effort?

I don't understand. Wasn't it your proposal to move things into the transaction? Above you write: "element expiration should be refresh via transaction instead". I asked what is special about timeout, why not handle all element state reset the same way?

Quoted 4 lines

With two concurrent threads, we just want to ensure that no invalid state shows in the listing (you mentioned it is possible to list negative values with two threads listing-and-resetting at the same time).

It's not just in the listing, the actual values underrun. A quota e.g. will immediately deny.

Quoted 3 lines

I think we should just make sure something valid is included in the listing, but as for the two threads performing list-and-reset, why ensure strict serialization?

I seem to lack context here. Is there an alternative to "strict" serializing? Expressions' dump+reset callbacks must not run multiple times at the same time for the same expression. At least not how they are currently implemented.

Quoted 9 lines

This is a rare operation to fetch statistics, most likely having a single process performing this in place? So we are currently discussing how to fix the (negative) non-sense in the listing.

Quoted 5 lines
Quoted 4 lines

What we have now is a broad 'reset element', not specifying what to reset. If the above is a feature being asked for, I'd rather implement 'reset element counter', 'reset element timeout', 'reset element quota', etc. commands.

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

We are currently discussing how to implement refresh timeout into the transaction model.

I would suggest we keep this chunk away by now for the _RESET command, until we agree on next steps.

I would suggest to leave things as-is until there's hard evidence why it has to change now or there is a viable alternative implementation.

Leave things as is means we will have this implicit refresh in the element refresh. We have no such semantics in conntrack, for example, and conntrack can be seen as a hardcoded set with a fixed number of tuples.

Quoted 7 lines
Quoted 3 lines

It's just as implicit as counter or quota reset. I define "reset element" command as "reset any state in given element", so from my perspective it makes perfectly sense to reset the timeout as well.

The timer is usually updated from the packet path. We are now planning to support for refreshing the timer from control plane which is not supported.

This implies that people create dynamic sets and then use reset command on the temporary elements. I would assume one either lets packet path "maintain" elements or control path but not both.

Quoted 4 lines

Note it is possible to set custom timeouts in elements too, for example:

        # nft add element x y { 1.2.3.4 expires 50s }
Quoted 8 lines
Quoted 2 lines

I assumed this is for dump'n'restore purposes. If you set a custom *timeout* when adding a set, the current reset code respects that.

This could be an exception, ie. a specific timeout for a given element, I am afraid there are more usecases that just a dump'n'restore. User is really free to add specific timeouts for the sets it adds. The default set timeout only applies if user does not specify a timeout for new elements.

Yes, and if a user chooses a custom timeout like so:

| nft add element x y { 1.2.3.4 timeout 50s }

the element will timeout in 50s and reset command will reset expires value to 50s not the set's default. Adding an element with a defined expires value makes it expire within that time but the set's timeout value applies.

Or am I missing a use-case requiring to use expires instead of timeout?

Quoted 3 lines
Quoted 2 lines
Quoted 2 lines

while default set policy might be different 3m. In this case, you assume resetting to the default set timeout policy (3m) is fine.

author maintainer
#12 lore raw
Quoted 105 lines · Phil Sutter
Quoted 95 lines · Pablo Neira Ayuso
Quoted 94 lines · Phil Sutter
Quoted 76 lines · Pablo Neira Ayuso
Quoted 75 lines · Phil Sutter
Quoted 73 lines · Pablo Neira Ayuso
Quoted 59 lines · Phil Sutter
Quoted 18 lines · Pablo Neira Ayuso
Quoted 17 lines · Pablo Neira Ayuso
Quoted 15 lines · Phil Sutter
Quoted 6 lines · Pablo Neira Ayuso

The dump and reset command should not refresh the timeout, this command is intended to allow users to list existing stateful objects and reset them, element expiration should be refresh via transaction instead with a specific command to achieve this, otherwise this is entering combo semantics that will be hard to be undone later (eg. a user asking to retrieve counters but _not_ requiring to refresh expiration).

From a users' perspective, what is special about the element expires value disqualifying it from being reset along with any counter/quota values?

Do you have a PoC for set element reset via transaction yet? Can we integrate non-timeout resets with it, too? Because IIUC, that's an alternative to the pending reset locking.

Quoted 8 lines
Quoted 5 lines

Problem is listing is not supported from transaction path, this is using existing netlink dump infrastructure which runs lockless via rcu. So we could support reset, but we could not use netlink dump semantics to fetch the values, and user likely wants this to fetch-and-reset as in ctnetlink.

Well, with NLM_F_ECHO, it should be possible to explore reset under commit_mutex, but is it really worth the effort?

I don't understand. Wasn't it your proposal to move things into the transaction? Above you write: "element expiration should be refresh via transaction instead". I asked what is special about timeout, why not handle all element state reset the same way?

Quoted 4 lines

With two concurrent threads, we just want to ensure that no invalid state shows in the listing (you mentioned it is possible to list negative values with two threads listing-and-resetting at the same time).

It's not just in the listing, the actual values underrun. A quota e.g. will immediately deny.

Quoted 3 lines

I think we should just make sure something valid is included in the listing, but as for the two threads performing list-and-reset, why ensure strict serialization?

I seem to lack context here. Is there an alternative to "strict" serializing? Expressions' dump+reset callbacks must not run multiple times at the same time for the same expression. At least not how they are currently implemented.

Quoted 9 lines

This is a rare operation to fetch statistics, most likely having a single process performing this in place? So we are currently discussing how to fix the (negative) non-sense in the listing.

Quoted 5 lines
Quoted 4 lines

What we have now is a broad 'reset element', not specifying what to reset. If the above is a feature being asked for, I'd rather implement 'reset element counter', 'reset element timeout', 'reset element quota', etc. commands.

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

We are currently discussing how to implement refresh timeout into the transaction model.

I would suggest we keep this chunk away by now for the _RESET command, until we agree on next steps.

I would suggest to leave things as-is until there's hard evidence why it has to change now or there is a viable alternative implementation.

Leave things as is means we will have this implicit refresh in the element refresh. We have no such semantics in conntrack, for example, and conntrack can be seen as a hardcoded set with a fixed number of tuples.

Quoted 7 lines
Quoted 3 lines

It's just as implicit as counter or quota reset. I define "reset element" command as "reset any state in given element", so from my perspective it makes perfectly sense to reset the timeout as well.

The timer is usually updated from the packet path. We are now planning to support for refreshing the timer from control plane which is not supported.

This implies that people create dynamic sets and then use reset command on the temporary elements. I would assume one either lets packet path "maintain" elements or control path but not both.

Quoted 4 lines

Note it is possible to set custom timeouts in elements too, for example:

        # nft add element x y { 1.2.3.4 expires 50s }
Quoted 8 lines
Quoted 2 lines

I assumed this is for dump'n'restore purposes. If you set a custom *timeout* when adding a set, the current reset code respects that.

This could be an exception, ie. a specific timeout for a given element, I am afraid there are more usecases that just a dump'n'restore. User is really free to add specific timeouts for the sets it adds. The default set timeout only applies if user does not specify a timeout for new elements.

Quoted 8 lines

Yes, and if a user chooses a custom timeout like so:

| nft add element x y { 1.2.3.4 timeout 50s }

the element will timeout in 50s and reset command will reset expires value to 50s not the set's default. Adding an element with a defined expires value makes it expire within that time but the set's timeout value applies.

That is correct.

Quoted 1 line

Or am I missing a use-case requiring to use expires instead of timeout?

You are correct.

We will soon need NFT_MSG_GETRULE_RESET_NO_TIMEOUT to undo this combo command semantics, from userspace this will require some sort of 'nft reset table x notimeout' syntax.

I really don't understand why you consider a timer is a stateful property, ctnetlink does not reset timeouts when you list-and-reset counters, I do not see why you have to do this with set elements.

maintainer
#13 lore raw
Quoted 3 lines · Pablo Neira Ayuso

We will soon need NFT_MSG_GETRULE_RESET_NO_TIMEOUT to undo this combo command semantics, from userspace this will require some sort of 'nft reset table x notimeout' syntax.

NFT_MSG_GETRULE_RESET_NO_TIMEOUT sounds super ugly :/

Do you think we can add a flags attr that describes which parts to reset?

No flags attr would reset everything.

Do you consider reset of timers to be something that must be handled via transaction infra or do you think it can (re)use the dump-and-reset approach?

author maintainer
#14 lore raw
Quoted 9 lines · Florian Westphal
Quoted 3 lines · Pablo Neira Ayuso

We will soon need NFT_MSG_GETRULE_RESET_NO_TIMEOUT to undo this combo command semantics, from userspace this will require some sort of 'nft reset table x notimeout' syntax.

NFT_MSG_GETRULE_RESET_NO_TIMEOUT sounds super ugly :/

Do you think we can add a flags attr that describes which parts to reset?

Sure. This will require one attribute for each object type, also reject it where it does not make sense.

Quoted 1 line

No flags attr would reset everything.

Refreshing timers is a bad default behaviour.

And how does this mix with the set element timeout model from transaction? Now timers becomes a "moving target" again with this refresh? Oh, this will drag commit_mutex to netlink dump path to avoid that.

Quoted 3 lines

Do you consider reset of timers to be something that must be handled via transaction infra or do you think it can (re)use the dump-and-reset approach?

The question why user wants to reset the timers in this path.

For counters, this is to collect stats while leaving remaining things as is. Refreshing timers make no sense to me.

For quota, this is to fetch the consumed quota and restart it, it might make sense to refresh the timer, but transaction sounds like a better path for this usecase?

For limit, they do not expose internal stateful information, so this just a reset. Timer refresh makes no sense to me here.

If this is for a dynamic set, user is refreshing/extending the timeout, but usually it is packet path that refreshes this timeouts via update.

This reset feature is just there to collect stateful properties and leave things as is.

maintainer
#15 lore raw
Quoted 11 lines · Pablo Neira Ayuso
Quoted 9 lines · Florian Westphal
Quoted 3 lines · Pablo Neira Ayuso

We will soon need NFT_MSG_GETRULE_RESET_NO_TIMEOUT to undo this combo command semantics, from userspace this will require some sort of 'nft reset table x notimeout' syntax.

NFT_MSG_GETRULE_RESET_NO_TIMEOUT sounds super ugly :/

Do you think we can add a flags attr that describes which parts to reset?

Quoted 6 lines

Sure. This will require one attribute for each object type, also reject it where it does not make sense.

Quoted 1 line

No flags attr would reset everything.

Refreshing timers is a bad default behaviour.

Looking at the "evolution" of the reset command in nftables.git I agree. "reset counters" etc. was rather specific as to what is reset.

Quoted 4 lines

And how does this mix with the set element timeout model from transaction? Now timers becomes a "moving target" again with this refresh? Oh, this will drag commit_mutex to netlink dump path to avoid that.

The lock is needed to prevent *two* reset calls messing up the interal object state, e.g. quota or counters.

We will need *some* type of lock for the commands where the reset logic is handled via dump path.

At this point I think we should consider reverting ALL reset changes that use the dump path, because we also have the consistency issue:

Cpu 1: nft list ruleset
Cpu 2: nft reset ruleset
Cpu 3: transaction, seq is bumped

AFAIU Cpu2 will restart dump due to interrupt, so the listing will be consistent but will, on retry -- show counters zeroed in previous, inconsitent and suppressed dump.

So I think the reset logic should be reworked to walk the rules and use the transaction infra to reset everything manually. I think we can optimize by letting userspace skip rules that lack a stateful object that cannot be reset.

I don't think the dump paths were ever designed to munge existing data. For those parts that provide full/consistent serialization, e.g. single rule is fetched, its fine.

But whenever we may yield in between successive partial dumps, its not.

Quoted 2 lines

For counters, this is to collect stats while leaving remaining things as is. Refreshing timers make no sense to me.

Looking at the history, I agree... for something like "reset counters" its clear what should happen.

Quoted 3 lines

For quota, this is to fetch the consumed quota and restart it, it might make sense to refresh the timer, but transaction sounds like a better path for this usecase?

See above, I agree.

author maintainer
#16 lore raw
Quoted 23 lines · Florian Westphal
Quoted 11 lines · Pablo Neira Ayuso
Quoted 9 lines · Florian Westphal
Quoted 3 lines · Pablo Neira Ayuso

We will soon need NFT_MSG_GETRULE_RESET_NO_TIMEOUT to undo this combo command semantics, from userspace this will require some sort of 'nft reset table x notimeout' syntax.

NFT_MSG_GETRULE_RESET_NO_TIMEOUT sounds super ugly :/

Do you think we can add a flags attr that describes which parts to reset?

Quoted 6 lines

Sure. This will require one attribute for each object type, also reject it where it does not make sense.

Quoted 1 line

No flags attr would reset everything.

Refreshing timers is a bad default behaviour.

Looking at the "evolution" of the reset command in nftables.git I agree. "reset counters" etc. was rather specific as to what is reset.

Quoted 7 lines
Quoted 4 lines

And how does this mix with the set element timeout model from transaction? Now timers becomes a "moving target" again with this refresh? Oh, this will drag commit_mutex to netlink dump path to avoid that.

The lock is needed to prevent *two* reset calls messing up the interal object state, e.g. quota or counters.

Agreed, no question there is a need for a lock from that path, the discussion so far has been what type of lock, whether reset_spinlock or commit_mutex.

reset_spinlock just makes sure that:

Cpu 1: nft list ruleset
Cpu 2: nft reset ruleset

do not show negative counters, as Phil reported with a test script.

commit_mutex just mitigates this issue, for reason see my reply below.

Quoted 20 lines

We will need *some* type of lock for the commands where the reset logic is handled via dump path.

At this point I think we should consider reverting ALL reset changes that use the dump path, because we also have the consistency issue:

Cpu 1: nft list ruleset
Cpu 2: nft reset ruleset
Cpu 3: transaction, seq is bumped

AFAIU Cpu2 will restart dump due to interrupt, so the listing will be consistent but will, on retry -- show counters zeroed in previous, inconsitent and suppressed dump.

So I think the reset logic should be reworked to walk the rules and use the transaction infra to reset everything manually. I think we can optimize by letting userspace skip rules that lack a stateful object that cannot be reset.

Quoted 5 lines

I don't think the dump paths were ever designed to munge existing data. For those parts that provide full/consistent serialization, e.g. single rule is fetched, its fine.

But whenever we may yield in between successive partial dumps, its not.

Yes, netlink dumps do not provide atomic listing semantics, that is why there is the generation ID from userspace. I am trying to think of a way to achieve this from the kernel but I did not come with any so far.

From userspace, it should be possible to keep a generation ID per object in the cache, so the cache becomes a collection of objects of different generations, then when listing, just take the objects that are still current. Or it should be possible to disambiguate this from userspace with the u64 handle, ie. keep stale objects around and merge them to new ones when fetching the counters.

But this is lots of work from userspace, and it might get more complicated if more transactions happen while retrying (see test script from Phil where transaction happens in an infinite loop).

This is the other open issue we have been discussing lately :)

Quoted 11 lines
Quoted 2 lines

For counters, this is to collect stats while leaving remaining things as is. Refreshing timers make no sense to me.

Looking at the history, I agree... for something like "reset counters" its clear what should happen.

Quoted 3 lines

For quota, this is to fetch the consumed quota and restart it, it might make sense to refresh the timer, but transaction sounds like a better path for this usecase?

See above, I agree.

maintainer
#17 lore raw
Quoted 19 lines · Pablo Neira Ayuso
Quoted 5 lines · Florian Westphal

I don't think the dump paths were ever designed to munge existing data. For those parts that provide full/consistent serialization, e.g. single rule is fetched, its fine.

But whenever we may yield in between successive partial dumps, its not.

Yes, netlink dumps do not provide atomic listing semantics, that is why there is the generation ID from userspace. I am trying to think of a way to achieve this from the kernel but I did not come with any so far.

From userspace, it should be possible to keep a generation ID per object in the cache, so the cache becomes a collection of objects of different generations, then when listing, just take the objects that are still current. Or it should be possible to disambiguate this from userspace with the u64 handle, ie. keep stale objects around and merge them to new ones when fetching the counters.

Quoted 5 lines

But this is lots of work from userspace, and it might get more complicated if more transactions happen while retrying (see test script from Phil where transaction happens in an infinite loop).

This is the other open issue we have been discussing lately :)

Right, there is an amalgamation of different issues, lets not get swamped trying to solve everything at once :-)

I've collected a few patches and pushed them out to :testing. Stresstest is still running but so far it looks good to me.

The updated audit selftest passes, as does Xins sctp test case.

I expect to do the PR in the next few hours or so.

I will followup on nf-next once upstream has pulled the PR into net and did a net -> net-next merge, which might take a while. Followup as in "send rebased patches that get rid of the async gc in nft_set_rbtree".

Let me know if there is anything else I can help
with.

Phil, I know all of this sucks from your point of view, this is also my fault, I did not pay too close attention to the reset patches, and, to be clear, even if I would have its likely I would have missed all of the implications of reusing the dump infrastructure for this.

I have not applied Pablos patch to revert the "timeout reset" because its relatively fresh compared to the other patches in the batch (and the batch is already large enough).

But I do agree with having a separate facility for timeout resets (timeout updates) would be better.

I also think we need to find a different strategy for the dump-and-reset part when the reset could be interrupted by a transaction.

ATM userspace would have to add a userspace lock like iptables-legacy to prevent any generation id changes while a "reset dump" is happening and I hope we can all agree that this is something we definitely do not want :-)

author maintainer
#18 lore raw
Quoted 3 lines · Florian Westphal

I also think we need to find a different strategy for the dump-and-reset part when the reset could be interrupted by a transaction.

I think it should be possible to deal with this from userspace.

The idea would be to keep the old cache. Then, from the new cache, if EINTR happened before, iterate over the list of objects in the new cache and then lookup for the old objects, then pour the stats from the old to the new objects, then release old cache. Then only one old cache is kept around in worst case. This needs a lookup function for each stateful object type on the old cache based on the handle.

reviewer
#19 lore raw
Quoted 5 lines · Pablo Neira Ayuso
Quoted 3 lines · Florian Westphal

I also think we need to find a different strategy for the dump-and-reset part when the reset could be interrupted by a transaction.

Quoted 8 lines

I think it should be possible to deal with this from userspace.

The idea would be to keep the old cache. Then, from the new cache, if EINTR happened before, iterate over the list of objects in the new cache and then lookup for the old objects, then pour the stats from the old to the new objects, then release old cache. Then only one old cache is kept around in worst case. This needs a lookup function for each stateful object type on the old cache based on the handle.

In case of EINTR, user space will reset multiple times, right? So returned state from generation X must be combined with that from generation X+1. Easy with counters (val1 + val2) but funny and/or inconsistent with quotas (val1 - val2 might be < 0).

I'd still just declare reset command for multiple items unreliable and point out the need for scripts to use a combination of list command and a number of reset commands for the individual items if the actual values matter.

I just noticed, for the above to be viable 'reset rule' command must be changed - it is silent right now.

Cheers, Phil

reviewer
#20 lore raw
In reply to Florian Westphal
Quoted 50 lines · Florian Westphal
Quoted 19 lines · Pablo Neira Ayuso
Quoted 5 lines · Florian Westphal

I don't think the dump paths were ever designed to munge existing data. For those parts that provide full/consistent serialization, e.g. single rule is fetched, its fine.

But whenever we may yield in between successive partial dumps, its not.

Yes, netlink dumps do not provide atomic listing semantics, that is why there is the generation ID from userspace. I am trying to think of a way to achieve this from the kernel but I did not come with any so far.

From userspace, it should be possible to keep a generation ID per object in the cache, so the cache becomes a collection of objects of different generations, then when listing, just take the objects that are still current. Or it should be possible to disambiguate this from userspace with the u64 handle, ie. keep stale objects around and merge them to new ones when fetching the counters.

Quoted 5 lines

But this is lots of work from userspace, and it might get more complicated if more transactions happen while retrying (see test script from Phil where transaction happens in an infinite loop).

This is the other open issue we have been discussing lately :)

Right, there is an amalgamation of different issues, lets not get swamped trying to solve everything at once :-)

I've collected a few patches and pushed them out to :testing. Stresstest is still running but so far it looks good to me.

The updated audit selftest passes, as does Xins sctp test case.

I expect to do the PR in the next few hours or so.

I will followup on nf-next once upstream has pulled the PR into net and did a net -> net-next merge, which might take a while. Followup as in "send rebased patches that get rid of the async gc in nft_set_rbtree".

Let me know if there is anything else I can help
with.

Phil, I know all of this sucks from your point of view, this is also my fault, I did not pay too close attention to the reset patches, and, to be clear, even if I would have its likely I would have missed all of the implications of reusing the dump infrastructure for this.

Quoted 6 lines

I have not applied Pablos patch to revert the "timeout reset" because its relatively fresh compared to the other patches in the batch (and the batch is already large enough).

But I do agree with having a separate facility for timeout resets (timeout updates) would be better.

I still think they are orthogonal in practice (even though they "clash"):

Dynamic sets use a timeout as they are populated from packet path and may grow exceedingly large over time. Manual intervention means deleting elements (which "resets" them) or adding ones (as an alternative to packet path).

Would non-dynamic sets use both a timeout and other state? I can't imagine a use-case for this.

Quoted 8 lines

I also think we need to find a different strategy for the dump-and-reset part when the reset could be interrupted by a transaction.

ATM userspace would have to add a userspace lock like iptables-legacy to prevent any generation id changes while a "reset dump" is happening and I hope we can all agree that this is something we definitely do not want :-)

I suggest to communicate the situation (for now) and make 'reset rule' return the rule to user space so the non-plural reset commands (apart from 'reset set') become reliable alternatives for those depending upon it.

Setting expectations straight is still the easiest fix to both the inconsistency problem and the "resets also timeouts" problem. In the latter case, this should be fine already as nft(8) explicitly states "resets timeout or other state" when describing 'reset element' and 'reset set'.

Then, consistent output for plural reset commands becomes a missing feature one may add or not. Reset with or without timeout requires a use-case (see above). The only real bug left is the concurrent reset messing up values.

Cheers, Phil