summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>2002-06-07 23:18:30 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>2002-06-07 23:18:30 +0000
commit396c12b15b5bc3869a89e2d194724cd4d35e8e14 (patch)
treef7a068fee6bee017317aa081b9565bd33c4be03f
parentd96938b9545775cbdbf7b555282b5bf5e9ede6ff (diff)
Detect wrap-around of timeout and set it to its maximum value. Hacky
way of getting the max value attributed to millert@
-rw-r--r--sys/net/pfkeyv2_convert.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/sys/net/pfkeyv2_convert.c b/sys/net/pfkeyv2_convert.c
index bf2562fcd55..a882fea570c 100644
--- a/sys/net/pfkeyv2_convert.c
+++ b/sys/net/pfkeyv2_convert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkeyv2_convert.c,v 1.10 2002/06/07 04:47:06 ho Exp $ */
+/* $OpenBSD: pfkeyv2_convert.c,v 1.11 2002/06/07 23:18:29 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@keromytis.org)
*
@@ -270,9 +270,11 @@ 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;
- timeout_add(&tdb->tdb_timer_tmo,
- hzto(&tv));
+ if (tv.tv_sec + tdb->tdb_exp_timeout < tv.tv_sec)
+ tv.tv_sec = ((unsigned long) -1) / 2; /* XXX */
+ else
+ tv.tv_sec += tdb->tdb_exp_timeout;
+ timeout_add(&tdb->tdb_timer_tmo, hzto(&tv));
} else
tdb->tdb_flags &= ~TDBF_TIMER;
@@ -299,9 +301,11 @@ 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;
- timeout_add(&tdb->tdb_stimer_tmo,
- hzto(&tv));
+ if (tv.tv_sec + tdb->tdb_soft_timeout < tv.tv_sec)
+ tv.tv_sec = ((unsigned long) -1) / 2; /* XXX */
+ else
+ tv.tv_sec += tdb->tdb_soft_timeout;
+ timeout_add(&tdb->tdb_stimer_tmo, hzto(&tv));
} else
tdb->tdb_flags &= ~TDBF_SOFT_TIMER;