aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/netipsec/xform_esp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/netipsec/xform_esp.c b/sys/netipsec/xform_esp.c
index 7ad6085db87f..9c3f97355e7f 100644
--- a/sys/netipsec/xform_esp.c
+++ b/sys/netipsec/xform_esp.c
@@ -824,8 +824,12 @@ esp_output(struct mbuf *m, struct secpolicy *sp, struct secasvar *sav,
SECREPLAY_UNLOCK(sav->replay);
}
cryptoid = sav->tdb_cryptoid;
+ /*
+ * The SA lock is shared by every CPU sending on the SA; the IV
+ * counter must still advance once per packet.
+ */
if (SAV_ISCTRORGCM(sav) || SAV_ISCHACHA(sav))
- cntr = sav->cntr++;
+ cntr = atomic_fetchadd_64(&sav->cntr, 1);
SECASVAR_RUNLOCK(sav);
/*