summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkn <kn@cvs.openbsd.org>2019-06-24 21:36:54 +0000
committerkn <kn@cvs.openbsd.org>2019-06-24 21:36:54 +0000
commitd730ff1f811552cc4da4f8c6b7ca8a986ac0614b (patch)
treead19553f72b4de8fe95af3bdca4322e037cfb262
parent9f5e3c54e494c0083cd9cdda439ffbd1bb6581d0 (diff)
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);
}
}