aboutsummaryrefslogtreecommitdiff
path: root/sys/netipsec
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2023-02-08 09:53:05 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2023-02-16 07:33:51 +0000
commit889a9acc54758922b3529ea473a2dac159d85fd5 (patch)
treeab76cdcd33d7dae615e94a0e125845ace3826a8c /sys/netipsec
parent6b9acd1bfba70c96ac89817fcf8d221d2387be60 (diff)
Diffstat (limited to 'sys/netipsec')
-rw-r--r--sys/netipsec/key.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c
index 345c302c2a80..62aa99019437 100644
--- a/sys/netipsec/key.c
+++ b/sys/netipsec/key.c
@@ -917,6 +917,7 @@ key_allocsp(struct secpolicyindex *spidx, u_int dir)
struct spdcache_entry *entry, *lastentry, *tmpentry;
struct secpolicy *sp;
uint32_t hashv;
+ time_t ts;
int nb_entries;
if (!SPDCACHE_ACTIVE()) {
@@ -969,7 +970,9 @@ key_allocsp(struct secpolicyindex *spidx, u_int dir)
out:
if (sp != NULL) { /* found a SPD entry */
- sp->lastused = time_second;
+ ts = time_second;
+ if (__predict_false(sp->lastused != ts))
+ sp->lastused = ts;
KEYDBG(IPSEC_STAMP,
printf("%s: return SP(%p)\n", __func__, sp));
KEYDBG(IPSEC_DATA, kdebug_secpolicy(sp));