summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>2001-12-12 04:46:43 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>2001-12-12 04:46:43 +0000
commit31ecde09f805146ef282c0504ec096c1d21c948f (patch)
tree47f6c9ba82e7fc86868c968a33e587b1f2c29ca4 /sys/net
parentafcaa1320f51d209ec3f953f0675384d34bafa07 (diff)
Remember to add the current time...problem noticed by ho@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/pfkeyv2_convert.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/net/pfkeyv2_convert.c b/sys/net/pfkeyv2_convert.c
index db1e30c76d8..e33642b8590 100644
--- a/sys/net/pfkeyv2_convert.c
+++ b/sys/net/pfkeyv2_convert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkeyv2_convert.c,v 1.6 2001/12/06 22:52:10 angelos Exp $ */
+/* $OpenBSD: pfkeyv2_convert.c,v 1.7 2001/12/12 04:46:42 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@keromytis.org)
*
@@ -243,12 +243,14 @@ void
import_lifetime(struct tdb *tdb, struct sadb_lifetime *sadb_lifetime, int type)
{
struct timeval tv;
+ int s;
if (!sadb_lifetime)
return;
- tv.tv_sec = 0;
- tv.tv_usec = 0;
+ s = splhigh();
+ tv = time;
+ splx(s);
switch (type) {
case PFKEYV2_LIFETIME_HARD:
@@ -267,7 +269,7 @@ import_lifetime(struct tdb *tdb, struct sadb_lifetime *sadb_lifetime, int type)
if ((tdb->tdb_exp_timeout =
sadb_lifetime->sadb_lifetime_addtime) != 0) {
tdb->tdb_flags |= TDBF_TIMER;
- tv.tv_sec = tdb->tdb_exp_timeout;
+ tv.tv_sec += tdb->tdb_exp_timeout;
timeout_add(&tdb->tdb_timer_tmo,
hzto(&tv));
} else
@@ -296,7 +298,7 @@ import_lifetime(struct tdb *tdb, struct sadb_lifetime *sadb_lifetime, int type)
if ((tdb->tdb_soft_timeout =
sadb_lifetime->sadb_lifetime_addtime) != 0) {
tdb->tdb_flags |= TDBF_SOFT_TIMER;
- tv.tv_sec = tdb->tdb_soft_timeout;
+ tv.tv_sec += tdb->tdb_soft_timeout;
timeout_add(&tdb->tdb_stimer_tmo,
hzto(&tv));
} else