diff options
author | Antony Antony <antony.antony@secunet.com> | 2022-10-21 15:42:01 +0200 |
---|---|---|
committer | Steffen Klassert <steffen.klassert@secunet.com> | 2022-10-25 10:24:08 +0200 |
commit | f7fe25a6f00522791cce38bac552d295339d0c79 (patch) | |
tree | 3f6b2255d928958a669fcb6ace19a3d2b6a083d0 /net/xfrm | |
parent | e91001bae0d1725d9a49b5bfb5f46f6d1ca6bf1d (diff) | |
download | linux-stable-f7fe25a6f00522791cce38bac552d295339d0c79.tar.gz linux-stable-f7fe25a6f00522791cce38bac552d295339d0c79.tar.bz2 linux-stable-f7fe25a6f00522791cce38bac552d295339d0c79.zip |
xfrm: update x->lastused for every packet
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>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/xfrm')
-rw-r--r-- | net/xfrm/xfrm_input.c | 1 | ||||
-rw-r--r-- | 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 @@ resume: 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); |