diff options
author | 2001-12-06 22:52:10 +0000 | |
---|---|---|
committer | 2001-12-06 22:52:10 +0000 | |
commit | 43b784b2c8079e844553069254b3cf8802253d7a (patch) | |
tree | e7aaa8bae52ac113b1c6354645805938af20e9cf /sys/netinet/ipsec_input.c | |
parent | References to ``comment at line foo'' is useless once line foo moves, (diff) | |
download | wireguard-openbsd-43b784b2c8079e844553069254b3cf8802253d7a.tar.xz wireguard-openbsd-43b784b2c8079e844553069254b3cf8802253d7a.zip |
Use hzto() to handle overflow of (hz * timeout) cases --- when using
extremely long SA expirations.
Diffstat (limited to 'sys/netinet/ipsec_input.c')
-rw-r--r-- | sys/netinet/ipsec_input.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c index 2a70187eab4..2abd2b6ae5f 100644 --- a/sys/netinet/ipsec_input.c +++ b/sys/netinet/ipsec_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec_input.c,v 1.53 2001/08/09 15:44:32 angelos Exp $ */ +/* $OpenBSD: ipsec_input.c,v 1.54 2001/12/06 22:52:10 angelos Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -106,6 +106,7 @@ ipsec_common_input(struct mbuf *m, int skip, int protoff, int af, int sproto) IPPROTO_AH ? (y)++ : (z)++) union sockaddr_union dst_address; + struct timeval tv; struct tdb *tdbp; u_int32_t spi; u_int16_t cpi; @@ -229,13 +230,21 @@ ipsec_common_input(struct mbuf *m, int skip, int protoff, int af, int sproto) /* Register first use, setup expiration timer. */ if (tdbp->tdb_first_use == 0) { + int pri; + + pri = splhigh(); tdbp->tdb_first_use = time.tv_sec; + splx(pri); + + tv.tv_usec = 0; + + tv.tv_sec = tdbp->tdb_exp_first_use + tdbp->tdb_first_use; if (tdbp->tdb_flags & TDBF_FIRSTUSE) - timeout_add(&tdbp->tdb_first_tmo, hz * - tdbp->tdb_exp_first_use); + timeout_add(&tdbp->tdb_first_tmo, hzto(&tv)); + + tv.tv_sec = tdbp->tdb_first_use + tdbp->tdb_soft_first_use; if (tdbp->tdb_flags & TDBF_SOFT_FIRSTUSE) - timeout_add(&tdbp->tdb_sfirst_tmo, hz * - tdbp->tdb_soft_first_use); + timeout_add(&tdbp->tdb_sfirst_tmo, hzto(&tv)); } /* |