-/* $OpenBSD: if_bridge.c,v 1.241 2015/06/08 13:44:08 mpi Exp $ */
+/* $OpenBSD: if_bridge.c,v 1.242 2015/06/11 15:59:17 mikeb Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
int dir, int af, int hlen, struct mbuf *m)
{
union sockaddr_union dst;
- struct timeval tv;
struct tdb *tdb;
u_int32_t spi;
u_int16_t cpi;
tdb->tdb_xform != NULL) {
if (tdb->tdb_first_use == 0) {
tdb->tdb_first_use = time_second;
-
- tv.tv_usec = 0;
-
- /* Check for wrap-around. */
- if (tdb->tdb_exp_first_use + tdb->tdb_first_use
- < tdb->tdb_first_use)
- tv.tv_sec = ((unsigned long)-1) / 2;
- else
- tv.tv_sec = tdb->tdb_exp_first_use +
- tdb->tdb_first_use;
-
if (tdb->tdb_flags & TDBF_FIRSTUSE)
- timeout_add(&tdb->tdb_first_tmo,
- hzto(&tv));
-
- /* Check for wrap-around. */
- if (tdb->tdb_first_use +
- tdb->tdb_soft_first_use
- < tdb->tdb_first_use)
- tv.tv_sec = ((unsigned long)-1) / 2;
- else
- tv.tv_sec = tdb->tdb_first_use +
- tdb->tdb_soft_first_use;
-
+ timeout_add_sec(&tdb->tdb_first_tmo,
+ tdb->tdb_exp_first_use);
if (tdb->tdb_flags & TDBF_SOFT_FIRSTUSE)
- timeout_add(&tdb->tdb_sfirst_tmo,
- hzto(&tv));
+ timeout_add_sec(&tdb->tdb_sfirst_tmo,
+ tdb->tdb_soft_first_use);
}
(*(tdb->tdb_xform->xf_input))(m, tdb, hlen, off);
-/* $OpenBSD: pfkeyv2_convert.c,v 1.53 2015/05/25 22:18:38 benno Exp $ */
+/* $OpenBSD: pfkeyv2_convert.c,v 1.54 2015/06/11 15:59:17 mikeb Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@keromytis.org)
*
void
import_lifetime(struct tdb *tdb, struct sadb_lifetime *sadb_lifetime, int type)
{
- struct timeval tv;
-
if (!sadb_lifetime)
return;
- getmicrotime(&tv);
-
switch (type) {
case PFKEYV2_LIFETIME_HARD:
if ((tdb->tdb_exp_allocations =
if ((tdb->tdb_exp_timeout =
sadb_lifetime->sadb_lifetime_addtime) != 0) {
tdb->tdb_flags |= TDBF_TIMER;
- 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));
+ timeout_add_sec(&tdb->tdb_timer_tmo,
+ tdb->tdb_exp_timeout);
} else
tdb->tdb_flags &= ~TDBF_TIMER;
if ((tdb->tdb_soft_timeout =
sadb_lifetime->sadb_lifetime_addtime) != 0) {
tdb->tdb_flags |= TDBF_SOFT_TIMER;
- 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));
+ timeout_add_sec(&tdb->tdb_stimer_tmo,
+ tdb->tdb_soft_timeout);
} else
tdb->tdb_flags &= ~TDBF_SOFT_TIMER;
-/* $OpenBSD: ipsec_input.c,v 1.131 2015/05/13 10:42:46 jsg Exp $ */
+/* $OpenBSD: ipsec_input.c,v 1.132 2015/06/11 15:59:17 mikeb Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
sproto == IPPROTO_AH ? (y)++ : (z)++)
union sockaddr_union dst_address;
- struct timeval tv;
struct tdb *tdbp;
struct ifnet *encif;
u_int32_t spi;
/* Register first use, setup expiration timer. */
if (tdbp->tdb_first_use == 0) {
tdbp->tdb_first_use = time_second;
-
- 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, hzto(&tv));
-
- tv.tv_sec = tdbp->tdb_first_use + tdbp->tdb_soft_first_use;
+ timeout_add_sec(&tdbp->tdb_first_tmo,
+ tdbp->tdb_exp_first_use);
if (tdbp->tdb_flags & TDBF_SOFT_FIRSTUSE)
- timeout_add(&tdbp->tdb_sfirst_tmo, hzto(&tv));
+ timeout_add_sec(&tdbp->tdb_sfirst_tmo,
+ tdbp->tdb_soft_first_use);
}
/*
-/* $OpenBSD: ipsec_output.c,v 1.58 2015/04/17 11:04:02 mikeb Exp $ */
+/* $OpenBSD: ipsec_output.c,v 1.59 2015/06/11 15:59:17 mikeb Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
int
ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready)
{
- struct timeval tv;
int i, off, error;
struct mbuf *mp;
#ifdef INET6
*/
if (tdb->tdb_first_use == 0) {
tdb->tdb_first_use = time_second;
-
- tv.tv_usec = 0;
-
- tv.tv_sec = tdb->tdb_first_use + tdb->tdb_exp_first_use;
if (tdb->tdb_flags & TDBF_FIRSTUSE)
- timeout_add(&tdb->tdb_first_tmo,
- hzto(&tv));
-
- tv.tv_sec = tdb->tdb_first_use + tdb->tdb_soft_first_use;
+ timeout_add_sec(&tdb->tdb_first_tmo,
+ tdb->tdb_exp_first_use);
if (tdb->tdb_flags & TDBF_SOFT_FIRSTUSE)
- timeout_add(&tdb->tdb_sfirst_tmo,
- hzto(&tv));
+ timeout_add_sec(&tdb->tdb_sfirst_tmo,
+ tdb->tdb_soft_first_use);
}
/*