summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkn <kn@openbsd.org>2019-06-24 21:36:53 +0000
committerkn <kn@openbsd.org>2019-06-24 21:36:53 +0000
commit880c030aad1331e89a1d5ecb34b7cc2c0b1f98a6 (patch)
treec31ed1f582f1d2f41cd0c92eb6d835ed3742f1a6
parentAdd glkgpio(4), a driver for the GPIO controllers found on Intel's Gemini (diff)
downloadwireguard-openbsd-880c030aad1331e89a1d5ecb34b7cc2c0b1f98a6.tar.xz
wireguard-openbsd-880c030aad1331e89a1d5ecb34b7cc2c0b1f98a6.zip
Use timeout_add_sec(9)
Re-challenge timeouts are made up of single scalar factors which are multiplied with the time unit lcp.timeout to compute the timeout period. Simply reduce that unit of 1 * hz [ticks] to 1 [s] and use the appropiate API. OK mpi
-rw-r--r--sys/net/if_sppp.h4
-rw-r--r--sys/net/if_spppsubr.c8
2 files changed, 6 insertions, 6 deletions
diff --git a/sys/net/if_sppp.h b/sys/net/if_sppp.h
index 5a7146f521b..9688699762c 100644
--- a/sys/net/if_sppp.h
+++ b/sys/net/if_sppp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sppp.h,v 1.26 2017/01/24 10:08:30 krw Exp $ */
+/* $OpenBSD: if_sppp.h,v 1.27 2019/06/24 21:36:53 kn Exp $ */
/* $NetBSD: if_sppp.h,v 1.2.2.1 1999/04/04 06:57:39 explorer Exp $ */
/*
@@ -110,7 +110,7 @@ struct slcp {
u_long protos; /* bitmask of protos that are started */
u_char echoid; /* id of last keepalive echo request */
/* restart max values, see RFC 1661 */
- int timeout;
+ int timeout; /* seconds */
int max_terminate;
int max_configure;
int max_failure;
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c
index 2a63c88ccf7..991f102738c 100644
--- a/sys/net/if_spppsubr.c
+++ b/sys/net/if_spppsubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_spppsubr.c,v 1.178 2019/06/22 20:15:09 kn Exp $ */
+/* $OpenBSD: if_spppsubr.c,v 1.179 2019/06/24 21:36:53 kn Exp $ */
/*
* Synchronous PPP link level subroutines.
*
@@ -1491,7 +1491,7 @@ sppp_increasing_timeout (const struct cp *cp, struct sppp *sp)
timo = sp->lcp.max_configure - sp->rst_counter[cp->protoidx];
if (timo < 1)
timo = 1;
- timeout_add(&sp->ch[cp->protoidx], timo * sp->lcp.timeout);
+ timeout_add_sec(&sp->ch[cp->protoidx], timo * sp->lcp.timeout);
}
void
@@ -1608,7 +1608,7 @@ sppp_lcp_init(struct sppp *sp)
* the exponential backoff option. Note that these values are
* relevant for all control protocols, not just LCP only.
*/
- sp->lcp.timeout = 1 * hz;
+ sp->lcp.timeout = 1; /* seconds */
sp->lcp.max_terminate = 2;
sp->lcp.max_configure = 10;
sp->lcp.max_failure = 10;
@@ -3828,7 +3828,7 @@ sppp_pap_open(struct sppp *sp)
if (sp->myauth.proto == PPP_PAP) {
/* we are peer, send a request, and start a timer */
pap.scr(sp);
- timeout_add(&sp->pap_my_to_ch, sp->lcp.timeout);
+ timeout_add_sec(&sp->pap_my_to_ch, sp->lcp.timeout);
}
}