diff options
-rw-r--r-- | sys/net/if_sppp.h | 7 | ||||
-rw-r--r-- | sys/net/if_spppsubr.c | 37 |
2 files changed, 35 insertions, 9 deletions
diff --git a/sys/net/if_sppp.h b/sys/net/if_sppp.h index 25b529d9e10..184c324a46c 100644 --- a/sys/net/if_sppp.h +++ b/sys/net/if_sppp.h @@ -26,6 +26,10 @@ #ifndef _NET_IF_HDLC_H_ #define _NET_IF_HDLC_H_ 1 +#ifdef __OpenBSD__ +#include <sys/timeout.h> +#endif + #define IDX_LCP 0 /* idx into state table */ struct slcp { @@ -100,6 +104,9 @@ struct sppp { #if defined(__FreeBSD__) && __FreeBSD__ >= 3 struct callout_handle ch[IDX_COUNT]; /* per-proto and if callouts */ struct callout_handle pap_my_to_ch; /* PAP needs one more... */ +#elif defined(__OpenBSD__) + struct timeout ch[IDX_COUNT]; + struct timeout pap_my_to_ch; #endif struct slcp lcp; /* LCP params */ struct sipcp ipcp; /* IPCP params */ diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index 16b11872fac..e0bb2c2dada 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_spppsubr.c,v 1.6 2001/03/07 05:44:05 aaron Exp $ */ +/* $OpenBSD: if_spppsubr.c,v 1.7 2001/03/22 01:42:35 mickey Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. * Keepalive protocol implemented in both Cisco and PPP modes. @@ -49,6 +49,7 @@ #include <sys/mbuf.h> #if defined (__OpenBSD__) +#include <sys/timeout.h> #include <sys/md5k.h> #else #include <sys/md5.h> @@ -103,6 +104,9 @@ #if defined (__FreeBSD__) # define UNTIMEOUT(fun, arg, handle) \ untimeout(fun, arg, handle) +#elif defined(__OpenBSD__) +# define UNTIMEOUT(fun, arg, handle) \ + timeout_del(&(handle)) #else # define UNTIMEOUT(fun, arg, handle) \ untimeout(fun, arg) @@ -256,6 +260,9 @@ struct cp { }; static struct sppp *spppq; +#if defined (__OpenBSD__) +static struct timeout keepalive_ch; +#endif #if defined (__FreeBSD__) static struct callout_handle keepalive_ch; #endif @@ -804,9 +811,11 @@ sppp_attach(struct ifnet *ifp) /* Initialize keepalive handler. */ if (! spppq) #if defined (__FreeBSD__) - keepalive_ch = + keepalive_ch = timeout(sppp_keepalive, 0, hz * 10); +#elif defined(__OpenBSD__) + timeout_set(&keepalive_ch, sppp_keepalive, NULL); + timeout_add(&keepalive_ch, hz * 10); #endif - timeout(sppp_keepalive, 0, hz * 10); /* Insert new entry into the keepalive list. */ sp->pp_next = spppq; @@ -1718,8 +1727,11 @@ sppp_increasing_timeout (const struct cp *cp, struct sppp *sp) timo = 1; #if defined(__FreeBSD__) && __FreeBSD__ >= 3 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 - timeout(cp->TO, (void *)sp, timo * sp->lcp.timeout); } HIDE void @@ -3285,9 +3297,11 @@ sppp_chap_tlu(struct sppp *sp) i = 300 + ((unsigned)(random() & 0xff00) >> 7); #if defined (__FreeBSD__) - sp->ch[IDX_CHAP] = + 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 - timeout(chap.TO, (void *)sp, i * hz); } if (debug) { @@ -3554,8 +3568,11 @@ sppp_pap_open(struct sppp *sp) pap.scr(sp); #if defined (__FreeBSD__) 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 - timeout(sppp_pap_my_TO, (void *)sp, sp->lcp.timeout); } } @@ -3829,9 +3846,11 @@ sppp_keepalive(void *dummy) } splx(s); #if defined (__FreeBSD__) - keepalive_ch = + keepalive_ch = timeout(sppp_keepalive, 0, hz * 10); +#endif +#if defined (__OpenBSD__) + timeout_add(&keepalive_ch, hz * 10); #endif - timeout(sppp_keepalive, 0, hz * 10); } /* |