summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormcbride <mcbride@openbsd.org>2004-01-19 07:24:07 +0000
committermcbride <mcbride@openbsd.org>2004-01-19 07:24:07 +0000
commit7093b336e6baa6e90de7ec62b4d91bd62aff1314 (patch)
treea992cb3bfdf0f696813c6184445648cc5ea58060
parenttest taken from /usr/include/db.h (diff)
downloadwireguard-openbsd-7093b336e6baa6e90de7ec62b4d91bd62aff1314.tar.xz
wireguard-openbsd-7093b336e6baa6e90de7ec62b4d91bd62aff1314.zip
Clean up creation and expiry timestamp calculations.
-rw-r--r--sys/net/if_pfsync.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c
index 89862b8ac50..7eb229efc31 100644
--- a/sys/net/if_pfsync.c
+++ b/sys/net/if_pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pfsync.c,v 1.14 2003/12/31 11:18:25 cedric Exp $ */
+/* $OpenBSD: if_pfsync.c,v 1.15 2004/01/19 07:24:07 mcbride Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -195,7 +195,7 @@ pfsync_insert_net_state(struct pfsync_state *sp)
bcopy(&sp->rt_addr, &st->rt_addr, sizeof(st->rt_addr));
secs = time.tv_sec;
- st->creation = secs + ntohl(sp->creation);
+ st->creation = ntohl(sp->creation) + secs;
st->af = sp->af;
st->proto = sp->proto;
@@ -207,11 +207,10 @@ pfsync_insert_net_state(struct pfsync_state *sp)
st->creatorid = sp->creatorid;
st->sync_flags = sp->sync_flags | PFSTATE_FROMSYNC;
- secs = time.tv_sec;
if (sp->expire)
- st->expire = 0;
- else
st->expire = ntohl(sp->expire) + secs;
+ else
+ st->expire = 0;
if (pf_insert_state(kif, st)) {
pfi_maybe_destroy(kif);