diff options
author | Can Erkin Acar <canacar@cvs.openbsd.org> | 2008-05-17 04:50:55 +0000 |
---|---|---|
committer | Can Erkin Acar <canacar@cvs.openbsd.org> | 2008-05-17 04:50:55 +0000 |
commit | 4041c491936e26f6252c703e86e2e9ff0cb20275 (patch) | |
tree | 81f42c25df9c2cc11e67fba56e09c24ae72f26f0 /sys/net/if_spppsubr.c | |
parent | 39454d1751cb81f5e571500fd2f8ff4ea5de027a (diff) |
Initialize the timeouts only once instead of everytime they are started
Prevents hangs as reported and tested by James Stark, PR:5795, ok henning@
Diffstat (limited to 'sys/net/if_spppsubr.c')
-rw-r--r-- | sys/net/if_spppsubr.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index f0c6a2bcaab..6e45a52da4f 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_spppsubr.c,v 1.67 2008/05/11 02:55:45 brad Exp $ */ +/* $OpenBSD: if_spppsubr.c,v 1.68 2008/05/17 04:50:54 canacar Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. * Keepalive protocol implemented in both Cisco and PPP modes. @@ -900,6 +900,7 @@ void sppp_attach(struct ifnet *ifp) { struct sppp *sp = (struct sppp*) ifp; + int i; /* Initialize keepalive handler. */ if (! spppq) { @@ -930,6 +931,11 @@ sppp_attach(struct ifnet *ifp) sp->pp_up = lcp.Up; sp->pp_down = lcp.Down; + + for (i = 0; i < IDX_COUNT; i++) + timeout_set(&sp->ch[i], (cps[i])->TO, (void *)sp); + timeout_set(&sp->pap_my_to_ch, sppp_pap_my_TO, (void *)sp); + sppp_lcp_init(sp); sppp_ipcp_init(sp); sppp_ipv6cp_init(sp); @@ -1885,7 +1891,6 @@ sppp_increasing_timeout (const struct cp *cp, struct sppp *sp) sp->ch[cp->protoidx] = timeout(cp->TO, (void *)sp, timo * sp->lcp.timeout); #elif defined(__OpenBSD__) - timeout_set(&sp->ch[cp->protoidx], cp->TO, (void *)sp); timeout_add(&sp->ch[cp->protoidx], timo * sp->lcp.timeout); #endif } @@ -4005,7 +4010,6 @@ sppp_chap_tlu(struct sppp *sp) #if defined (__FreeBSD__) sp->ch[IDX_CHAP] = timeout(chap.TO, (void *)sp, i * hz); #elif defined(__OpenBSD__) - timeout_set(&sp->ch[IDX_CHAP], chap.TO, (void *)sp); timeout_add(&sp->ch[IDX_CHAP], i * hz); #endif } @@ -4262,7 +4266,6 @@ sppp_pap_open(struct sppp *sp) sp->pap_my_to_ch = timeout(sppp_pap_my_TO, (void *)sp, sp->lcp.timeout); #elif defined (__OpenBSD__) - timeout_set(&sp->pap_my_to_ch, sppp_pap_my_TO, (void *)sp); timeout_add(&sp->pap_my_to_ch, sp->lcp.timeout); #endif } |