-/* $OpenBSD: pfkeyv2.c,v 1.258 2023/09/29 18:40:08 tobhe Exp $ */
+/* $OpenBSD: pfkeyv2.c,v 1.259 2023/10/11 22:13:16 tobhe Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
/* Delete old version of the SA, insert new one */
tdb_delete(sa2);
+
+ tdb_addtimeouts(newsa);
+
puttdb(newsa);
} else {
/*
#endif
import_iface(sa2, headers[SADB_X_EXT_IFACE]);
+ tdb_addtimeouts(sa2);
+
if (headers[SADB_EXT_ADDRESS_SRC] ||
headers[SADB_EXT_ADDRESS_PROXY]) {
mtx_enter(&tdb_sadb_mtx);
goto ret;
}
+ tdb_addtimeouts(newsa);
+
/* Add TDB in table */
puttdb(newsa);
}
-/* $OpenBSD: pfkeyv2_convert.c,v 1.81 2023/09/16 09:33:27 mpi Exp $ */
+/* $OpenBSD: pfkeyv2_convert.c,v 1.82 2023/10/11 22:13:16 tobhe Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@keromytis.org)
*
if ((tdb->tdb_exp_timeout =
sadb_lifetime->sadb_lifetime_addtime) != 0) {
tdb->tdb_flags |= TDBF_TIMER;
- if (timeout_add_sec(&tdb->tdb_timer_tmo,
- tdb->tdb_exp_timeout))
- tdb_ref(tdb);
} else
tdb->tdb_flags &= ~TDBF_TIMER;
if ((tdb->tdb_soft_timeout =
sadb_lifetime->sadb_lifetime_addtime) != 0) {
tdb->tdb_flags |= TDBF_SOFT_TIMER;
- if (timeout_add_sec(&tdb->tdb_stimer_tmo,
- tdb->tdb_soft_timeout))
- tdb_ref(tdb);
} else
tdb->tdb_flags &= ~TDBF_SOFT_TIMER;
-/* $OpenBSD: ip_ipsp.c,v 1.276 2023/08/07 03:43:57 dlg Exp $ */
+/* $OpenBSD: ip_ipsp.c,v 1.277 2023/10/11 22:13:16 tobhe Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr),
NET_UNLOCK();
}
+void
+tdb_addtimeouts(struct tdb *tdbp)
+{
+ mtx_enter(&tdbp->tdb_mtx);
+ if (tdbp->tdb_flags & TDBF_TIMER) {
+ if (timeout_add_sec(&tdbp->tdb_timer_tmo,
+ tdbp->tdb_exp_timeout))
+ tdb_ref(tdbp);
+ }
+ if (tdbp->tdb_flags & TDBF_SOFT_TIMER) {
+ if (timeout_add_sec(&tdbp->tdb_stimer_tmo,
+ tdbp->tdb_soft_timeout))
+ tdb_ref(tdbp);
+ }
+ mtx_leave(&tdbp->tdb_mtx);
+}
+
void
tdb_soft_timeout(void *v)
{
-/* $OpenBSD: ip_ipsp.h,v 1.242 2023/08/07 01:44:51 dlg Exp $ */
+/* $OpenBSD: ip_ipsp.h,v 1.243 2023/10/11 22:13:16 tobhe Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr),
void tdb_unlink_locked(struct tdb *);
void tdb_cleanspd(struct tdb *);
void tdb_unbundle(struct tdb *);
+void tdb_addtimeouts(struct tdb *);
void tdb_deltimeouts(struct tdb *);
int tdb_walk(u_int, int (*)(struct tdb *, void *, int), void *);
void tdb_printit(void *, int, int (*)(const char *, ...));