All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH ipsec-next 1/4] Revert "xfrm: update SA curlft.use_time"
@ 2022-07-08  6:16 Antony Antony
  2022-07-08  6:16 ` [PATCH ipsec-next 2/4] xfrm: fix XFRMA_LASTUSED comment Antony Antony
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Antony Antony @ 2022-07-08  6:16 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu; +Cc: netdev, Tobias Brunner

This reverts commit af734a26a1a95a9fda51f2abb0c22a7efcafd5ca.

The abvoce commit is a regression according RFC 2367. A better fix would be
use x->lastused. Which will be propsed later.

according to RFC 2367 use_time == sadb_lifetime_usetime.

"sadb_lifetime_usetime
                   For CURRENT, the time, in seconds, when association
                   was first used. For HARD and SOFT, the number of
                   seconds after the first use of the association until
                   it expires."

Fixes: af734a26a1a9 ("xfrm: update SA curlft.use_time")
Signed-off-by: Antony Antony <antony.antony@secunet.com>
---
 net/xfrm/xfrm_input.c  | 1 -
 net/xfrm/xfrm_output.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 144238a50f3d..70a8c36f0ba6 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -669,7 +669,6 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
 
 		x->curlft.bytes += skb->len;
 		x->curlft.packets++;
-		x->curlft.use_time = ktime_get_real_seconds();
 
 		spin_unlock(&x->lock);
 
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 555ab35cd119..9a5e79a38c67 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -534,7 +534,6 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
 
 		x->curlft.bytes += skb->len;
 		x->curlft.packets++;
-		x->curlft.use_time = ktime_get_real_seconds();
 
 		spin_unlock_bh(&x->lock);
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH ipsec-next 2/4] xfrm: fix XFRMA_LASTUSED comment
  2022-07-08  6:16 [PATCH ipsec-next 1/4] Revert "xfrm: update SA curlft.use_time" Antony Antony
@ 2022-07-08  6:16 ` Antony Antony
  2022-07-08  6:17 ` [PATCH ipsec-next 3/4] xfrm: update x->lastused for every packet Antony Antony
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Antony Antony @ 2022-07-08  6:16 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu; +Cc: netdev, Tobias Brunner

It is a __u64, internally time64_t.

Fixes: bf825f81b454 ("xfrm: introduce basic mark infrastructure")
Signed-off-by: Antony Antony <antony.antony@secunet.com>
---
 include/uapi/linux/xfrm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h
index 3ed61df9cc91..23319c2f714c 100644
--- a/include/uapi/linux/xfrm.h
+++ b/include/uapi/linux/xfrm.h
@@ -296,7 +296,7 @@ enum xfrm_attr_type_t {
 	XFRMA_ETIMER_THRESH,
 	XFRMA_SRCADDR,		/* xfrm_address_t */
 	XFRMA_COADDR,		/* xfrm_address_t */
-	XFRMA_LASTUSED,		/* unsigned long  */
+	XFRMA_LASTUSED,		/* __u64 */
 	XFRMA_POLICY_TYPE,	/* struct xfrm_userpolicy_type */
 	XFRMA_MIGRATE,
 	XFRMA_ALG_AEAD,		/* struct xfrm_algo_aead */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH ipsec-next 3/4] xfrm: update x->lastused for every packet
  2022-07-08  6:16 [PATCH ipsec-next 1/4] Revert "xfrm: update SA curlft.use_time" Antony Antony
  2022-07-08  6:16 ` [PATCH ipsec-next 2/4] xfrm: fix XFRMA_LASTUSED comment Antony Antony
@ 2022-07-08  6:17 ` Antony Antony
  2022-07-08  6:18 ` [PATCH ipsec-next 4/4] xfrm: clone x->lastused in xfrm_do_migrate Antony Antony
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Antony Antony @ 2022-07-08  6:17 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu; +Cc: netdev, Tobias Brunner

x->lastused was only updated for outgoing mobile IPv6.
With this fix make it generic, update it for every,
both in and out packet.
This useful to check if the a SA is still in use, or when was the last time
an SA was used.

Signed-off-by: Antony Antony <antony.antony@secunet.com>
---
 net/xfrm/xfrm_input.c  | 1 +
 net/xfrm/xfrm_output.c | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 70a8c36f0ba6..7978048df837 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -669,6 +669,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
 
 		x->curlft.bytes += skb->len;
 		x->curlft.packets++;
+		x->lastused = ktime_get_real_seconds();
 
 		spin_unlock(&x->lock);
 
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 9a5e79a38c67..78cb8d0a6a18 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -209,8 +209,6 @@ static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb)
 	__skb_pull(skb, hdr_len);
 	memmove(ipv6_hdr(skb), iph, hdr_len);
 
-	x->lastused = ktime_get_real_seconds();
-
 	return 0;
 #else
 	WARN_ON_ONCE(1);
@@ -534,6 +532,7 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
 
 		x->curlft.bytes += skb->len;
 		x->curlft.packets++;
+		x->lastused = ktime_get_real_seconds();
 
 		spin_unlock_bh(&x->lock);
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH ipsec-next 4/4] xfrm: clone x->lastused in xfrm_do_migrate
  2022-07-08  6:16 [PATCH ipsec-next 1/4] Revert "xfrm: update SA curlft.use_time" Antony Antony
  2022-07-08  6:16 ` [PATCH ipsec-next 2/4] xfrm: fix XFRMA_LASTUSED comment Antony Antony
  2022-07-08  6:17 ` [PATCH ipsec-next 3/4] xfrm: update x->lastused for every packet Antony Antony
@ 2022-07-08  6:18 ` Antony Antony
  2022-07-11  8:34   ` Steffen Klassert
  2022-07-11  8:24 ` [PATCH ipsec-next 1/4] Revert "xfrm: update SA curlft.use_time" Steffen Klassert
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Antony Antony @ 2022-07-08  6:18 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu; +Cc: netdev, Tobias Brunner

migrate x->lastused xfrm_do_migrate. It was not in the original commit

Signed-off-by: Antony Antony <antony.antony@secunet.com>
---
 net/xfrm/xfrm_state.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 03b180878e61..712b6d46f8ee 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1592,6 +1592,7 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig,
 	x->replay = orig->replay;
 	x->preplay = orig->preplay;
 	x->mapping_maxage = orig->mapping_maxage;
+	x->lastused = orig->lastused;
 	x->new_mapping = 0;
 	x->new_mapping_sport = 0;
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH ipsec-next 1/4] Revert "xfrm: update SA curlft.use_time"
  2022-07-08  6:16 [PATCH ipsec-next 1/4] Revert "xfrm: update SA curlft.use_time" Antony Antony
                   ` (2 preceding siblings ...)
  2022-07-08  6:18 ` [PATCH ipsec-next 4/4] xfrm: clone x->lastused in xfrm_do_migrate Antony Antony
@ 2022-07-11  8:24 ` Steffen Klassert
  2022-07-27 15:45   ` Antony Antony
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Steffen Klassert @ 2022-07-11  8:24 UTC (permalink / raw)
  To: Antony Antony; +Cc: Herbert Xu, netdev, Tobias Brunner

On Fri, Jul 08, 2022 at 08:16:28AM +0200, Antony Antony wrote:
> This reverts commit af734a26a1a95a9fda51f2abb0c22a7efcafd5ca.
> 
> The abvoce commit is a regression according RFC 2367. A better fix would be
> use x->lastused. Which will be propsed later.
> 
> according to RFC 2367 use_time == sadb_lifetime_usetime.
> 
> "sadb_lifetime_usetime
>                    For CURRENT, the time, in seconds, when association
>                    was first used. For HARD and SOFT, the number of
>                    seconds after the first use of the association until
>                    it expires."
> 
> Fixes: af734a26a1a9 ("xfrm: update SA curlft.use_time")
> Signed-off-by: Antony Antony <antony.antony@secunet.com>

This is a fix, so it should go to the ipsec tree. Please
slpit your patchset into fixes that go to the ipsec tree
and new features that go to ipsec-next.

Thanks!


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH ipsec-next 4/4] xfrm: clone x->lastused in xfrm_do_migrate
  2022-07-08  6:18 ` [PATCH ipsec-next 4/4] xfrm: clone x->lastused in xfrm_do_migrate Antony Antony
@ 2022-07-11  8:34   ` Steffen Klassert
  0 siblings, 0 replies; 13+ messages in thread
From: Steffen Klassert @ 2022-07-11  8:34 UTC (permalink / raw)
  To: Antony Antony; +Cc: Herbert Xu, netdev, Tobias Brunner

On Fri, Jul 08, 2022 at 08:18:18AM +0200, Antony Antony wrote:
> migrate x->lastused xfrm_do_migrate. It was not in the original commit

Is the commit message intentional like this?
It reads a bit odd :)

> Signed-off-by: Antony Antony <antony.antony@secunet.com>
> ---
>  net/xfrm/xfrm_state.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
> index 03b180878e61..712b6d46f8ee 100644
> --- a/net/xfrm/xfrm_state.c
> +++ b/net/xfrm/xfrm_state.c
> @@ -1592,6 +1592,7 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig,
>  	x->replay = orig->replay;
>  	x->preplay = orig->preplay;
>  	x->mapping_maxage = orig->mapping_maxage;
> +	x->lastused = orig->lastused;

We lose lastused when cloning a state, so this one is a fix too.

Please submit to the ipsec tree with a proper 'Fixes' tag.

Thanks!

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH ipsec 1/3] Revert "xfrm: update SA curlft.use_time"
@ 2022-07-27 15:45   ` Antony Antony
  0 siblings, 0 replies; 13+ messages in thread
From: Antony Antony @ 2022-07-27 15:38 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu,
	0002-xfrm-fix-XFRMA_LASTUSED-comment.patch,
	0003-xfrm-clone-missing-x-lastused-in-xfrm_do_migrate.patch
  Cc: netdev, Tobias Brunner

This reverts commit af734a26a1a95a9fda51f2abb0c22a7efcafd5ca.

The abvoce commit is a regression according RFC 2367. A better fix would be
use x->lastused. Which will be propsed later.

according to RFC 2367 use_time == sadb_lifetime_usetime.

"sadb_lifetime_usetime
                   For CURRENT, the time, in seconds, when association
                   was first used. For HARD and SOFT, the number of
                   seconds after the first use of the association until
                   it expires."

Fixes: af734a26a1a9 ("xfrm: update SA curlft.use_time")
Signed-off-by: Antony Antony <antony.antony@secunet.com>
---
 net/xfrm/xfrm_input.c  | 1 -
 net/xfrm/xfrm_output.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 144238a50f3d..70a8c36f0ba6 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -669,7 +669,6 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
 
 		x->curlft.bytes += skb->len;
 		x->curlft.packets++;
-		x->curlft.use_time = ktime_get_real_seconds();
 
 		spin_unlock(&x->lock);
 
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 555ab35cd119..9a5e79a38c67 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -534,7 +534,6 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
 
 		x->curlft.bytes += skb->len;
 		x->curlft.packets++;
-		x->curlft.use_time = ktime_get_real_seconds();
 
 		spin_unlock_bh(&x->lock);
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH ipsec 2/3] xfrm: fix XFRMA_LASTUSED comment
  2022-07-08  6:16 [PATCH ipsec-next 1/4] Revert "xfrm: update SA curlft.use_time" Antony Antony
                   ` (4 preceding siblings ...)
  2022-07-27 15:45   ` Antony Antony
@ 2022-07-27 15:40 ` Antony Antony
  2022-07-27 15:41 ` [PATCH ipsec 3/3] xfrm: clone missing x->lastused in xfrm_do_migrate Antony Antony
  2022-10-21 13:42 ` [PATCH ipsec-next v2] xfrm: update x->lastused for every packet Antony Antony
  7 siblings, 0 replies; 13+ messages in thread
From: Antony Antony @ 2022-07-27 15:40 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu, Antony Antony; +Cc: netdev, Tobias Brunner

It is a __u64, internally time64_t.

Fixes: bf825f81b454 ("xfrm: introduce basic mark infrastructure")
Signed-off-by: Antony Antony <antony.antony@secunet.com>
---
 include/uapi/linux/xfrm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h
index 65e13a099b1a..a9f5d884560a 100644
--- a/include/uapi/linux/xfrm.h
+++ b/include/uapi/linux/xfrm.h
@@ -296,7 +296,7 @@ enum xfrm_attr_type_t {
 	XFRMA_ETIMER_THRESH,
 	XFRMA_SRCADDR,		/* xfrm_address_t */
 	XFRMA_COADDR,		/* xfrm_address_t */
-	XFRMA_LASTUSED,		/* unsigned long  */
+	XFRMA_LASTUSED,		/* __u64 */
 	XFRMA_POLICY_TYPE,	/* struct xfrm_userpolicy_type */
 	XFRMA_MIGRATE,
 	XFRMA_ALG_AEAD,		/* struct xfrm_algo_aead */
--
2.30.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH ipsec 3/3] xfrm: clone missing x->lastused in xfrm_do_migrate
  2022-07-08  6:16 [PATCH ipsec-next 1/4] Revert "xfrm: update SA curlft.use_time" Antony Antony
                   ` (5 preceding siblings ...)
  2022-07-27 15:40 ` [PATCH ipsec 2/3] xfrm: fix XFRMA_LASTUSED comment Antony Antony
@ 2022-07-27 15:41 ` Antony Antony
  2022-10-21 13:42 ` [PATCH ipsec-next v2] xfrm: update x->lastused for every packet Antony Antony
  7 siblings, 0 replies; 13+ messages in thread
From: Antony Antony @ 2022-07-27 15:41 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu; +Cc: netdev, Tobias Brunner, Antony Antony

x->lastused was not cloned in xfrm_do_migrate. Add it to clone during
migrate.

Fixes: 80c9abaabf42 ("[XFRM]: Extension for dynamic update of endpoint address(es)")
Signed-off-by: Antony Antony <antony.antony@secunet.com>
---
 net/xfrm/xfrm_state.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index ccfb172eb5b8..11d89af9cb55 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1592,6 +1592,7 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig,
 	x->replay = orig->replay;
 	x->preplay = orig->preplay;
 	x->mapping_maxage = orig->mapping_maxage;
+	x->lastused = orig->lastused;
 	x->new_mapping = 0;
 	x->new_mapping_sport = 0;

--
2.30.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH ipsec 1/3] Revert "xfrm: update SA curlft.use_time"
@ 2022-07-27 15:45   ` Antony Antony
  0 siblings, 0 replies; 13+ messages in thread
From: Antony Antony @ 2022-07-27 15:45 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu; +Cc: netdev, Tobias Brunner, Antony Antony

This reverts commit af734a26a1a95a9fda51f2abb0c22a7efcafd5ca.

The abvoce commit is a regression according RFC 2367. A better fix would be
use x->lastused. Which will be propsed later.

according to RFC 2367 use_time == sadb_lifetime_usetime.

"sadb_lifetime_usetime
                   For CURRENT, the time, in seconds, when association
                   was first used. For HARD and SOFT, the number of
                   seconds after the first use of the association until
                   it expires."

Fixes: af734a26a1a9 ("xfrm: update SA curlft.use_time")
Signed-off-by: Antony Antony <antony.antony@secunet.com>
---
 net/xfrm/xfrm_input.c  | 1 -
 net/xfrm/xfrm_output.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 144238a50f3d..70a8c36f0ba6 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -669,7 +669,6 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
 
 		x->curlft.bytes += skb->len;
 		x->curlft.packets++;
-		x->curlft.use_time = ktime_get_real_seconds();
 
 		spin_unlock(&x->lock);
 
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 555ab35cd119..9a5e79a38c67 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -534,7 +534,6 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
 
 		x->curlft.bytes += skb->len;
 		x->curlft.packets++;
-		x->curlft.use_time = ktime_get_real_seconds();
 
 		spin_unlock_bh(&x->lock);
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH ipsec 1/3] Revert "xfrm: update SA curlft.use_time"
  2022-07-27 15:45   ` Antony Antony
  (?)
@ 2022-08-04  9:31   ` Steffen Klassert
  -1 siblings, 0 replies; 13+ messages in thread
From: Steffen Klassert @ 2022-08-04  9:31 UTC (permalink / raw)
  To: Antony Antony
  Cc: Herbert Xu, 0002-xfrm-fix-XFRMA_LASTUSED-comment.patch,
	0003-xfrm-clone-missing-x-lastused-in-xfrm_do_migrate.patch,
	netdev, Tobias Brunner

On Wed, Jul 27, 2022 at 05:38:35PM +0200, Antony Antony wrote:
> This reverts commit af734a26a1a95a9fda51f2abb0c22a7efcafd5ca.
> 
> The abvoce commit is a regression according RFC 2367. A better fix would be
> use x->lastused. Which will be propsed later.
> 
> according to RFC 2367 use_time == sadb_lifetime_usetime.
> 
> "sadb_lifetime_usetime
>                    For CURRENT, the time, in seconds, when association
>                    was first used. For HARD and SOFT, the number of
>                    seconds after the first use of the association until
>                    it expires."
> 
> Fixes: af734a26a1a9 ("xfrm: update SA curlft.use_time")
> Signed-off-by: Antony Antony <antony.antony@secunet.com>

Series applied, thanks Antony!

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH ipsec-next v2] xfrm: update x->lastused for every packet
  2022-07-08  6:16 [PATCH ipsec-next 1/4] Revert "xfrm: update SA curlft.use_time" Antony Antony
                   ` (6 preceding siblings ...)
  2022-07-27 15:41 ` [PATCH ipsec 3/3] xfrm: clone missing x->lastused in xfrm_do_migrate Antony Antony
@ 2022-10-21 13:42 ` Antony Antony
  2022-10-28 11:35   ` Steffen Klassert
  7 siblings, 1 reply; 13+ messages in thread
From: Antony Antony @ 2022-10-21 13:42 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu; +Cc: netdev, Tobias Brunner, Antony Antony

x->lastused was only updated for outgoing mobile IPv6 packet.
With this fix update it for every, in and out, packet.

This is useful to check if the a SA is still in use, or when was
the last time an SA was used. lastused time of in SA can used
to check IPsec path is functional.

Signed-off-by: Antony Antony <antony.antony@secunet.com>
---
 v1 -> v2 now ipsec-next has the required patches.

 net/xfrm/xfrm_input.c  | 1 +
 net/xfrm/xfrm_output.c | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 97074f6f2bde..c06e54a10540 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -671,6 +671,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)

 		x->curlft.bytes += skb->len;
 		x->curlft.packets++;
+		x->lastused = ktime_get_real_seconds();

 		spin_unlock(&x->lock);

diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 9a5e79a38c67..78cb8d0a6a18 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -209,8 +209,6 @@ static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb)
 	__skb_pull(skb, hdr_len);
 	memmove(ipv6_hdr(skb), iph, hdr_len);

-	x->lastused = ktime_get_real_seconds();
-
 	return 0;
 #else
 	WARN_ON_ONCE(1);
@@ -534,6 +532,7 @@ static int xfrm_output_one(struct sk_buff *skb, int err)

 		x->curlft.bytes += skb->len;
 		x->curlft.packets++;
+		x->lastused = ktime_get_real_seconds();

 		spin_unlock_bh(&x->lock);

--
2.30.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH ipsec-next v2] xfrm: update x->lastused for every packet
  2022-10-21 13:42 ` [PATCH ipsec-next v2] xfrm: update x->lastused for every packet Antony Antony
@ 2022-10-28 11:35   ` Steffen Klassert
  0 siblings, 0 replies; 13+ messages in thread
From: Steffen Klassert @ 2022-10-28 11:35 UTC (permalink / raw)
  To: Antony Antony; +Cc: Herbert Xu, netdev, Tobias Brunner, Antony Antony

On Fri, Oct 21, 2022 at 03:42:01PM +0200, Antony Antony wrote:
> x->lastused was only updated for outgoing mobile IPv6 packet.
> With this fix update it for every, in and out, packet.
> 
> This is useful to check if the a SA is still in use, or when was
> the last time an SA was used. lastused time of in SA can used
> to check IPsec path is functional.
> 
> Signed-off-by: Antony Antony <antony.antony@secunet.com>

Applied, thanks a lot Antony!

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-10-28 11:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-08  6:16 [PATCH ipsec-next 1/4] Revert "xfrm: update SA curlft.use_time" Antony Antony
2022-07-08  6:16 ` [PATCH ipsec-next 2/4] xfrm: fix XFRMA_LASTUSED comment Antony Antony
2022-07-08  6:17 ` [PATCH ipsec-next 3/4] xfrm: update x->lastused for every packet Antony Antony
2022-07-08  6:18 ` [PATCH ipsec-next 4/4] xfrm: clone x->lastused in xfrm_do_migrate Antony Antony
2022-07-11  8:34   ` Steffen Klassert
2022-07-11  8:24 ` [PATCH ipsec-next 1/4] Revert "xfrm: update SA curlft.use_time" Steffen Klassert
2022-07-27 15:38 ` [PATCH ipsec 1/3] " Antony Antony
2022-07-27 15:45   ` Antony Antony
2022-08-04  9:31   ` Steffen Klassert
2022-07-27 15:40 ` [PATCH ipsec 2/3] xfrm: fix XFRMA_LASTUSED comment Antony Antony
2022-07-27 15:41 ` [PATCH ipsec 3/3] xfrm: clone missing x->lastused in xfrm_do_migrate Antony Antony
2022-10-21 13:42 ` [PATCH ipsec-next v2] xfrm: update x->lastused for every packet Antony Antony
2022-10-28 11:35   ` Steffen Klassert

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.