From f19c69323cd7e8120fabf36070addb5d17a92f41 Mon Sep 17 00:00:00 2001 From: martin Date: Sat, 15 Dec 2001 20:40:37 +0000 Subject: [PATCH] Make reconnects after LCP keepalive detected an error actually work. --- sys/net/if_spppsubr.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index 5f130bc882b6..a09d98e04e53 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_spppsubr.c,v 1.32 2001/12/10 00:22:21 martin Exp $ */ +/* $NetBSD: if_spppsubr.c,v 1.33 2001/12/15 20:40:37 martin Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.32 2001/12/10 00:22:21 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.33 2001/12/15 20:40:37 martin Exp $"); #include "opt_inet.h" #include "opt_ipx.h" @@ -4491,11 +4491,20 @@ sppp_keepalive(void *dummy) if_down (ifp); IF_PURGE (&sp->pp_cpq); if (! (sp->pp_flags & PP_CISCO)) { - /* XXX */ - /* Shut down the PPP link. */ - lcp.Down(sp); - /* Initiate negotiation. XXX */ - lcp.Up(sp); + printf("%s: LCP keepalive timed out, going to restart the connection\n", + ifp->if_xname); + sp->pp_alivecnt = 0; + + /* we are down, close all open protocols */ + lcp.Close(sp); + + /* And now prepare LCP to reestablish the link, if configured to do so. */ + sppp_cp_change_state(&lcp, sp, STATE_STOPPED); + + /* Close connection imediatly, completition of this + * will summon the magic needed to reestablish it. */ + sp->pp_tlf(sp); + continue; } } if (sp->pp_alivecnt <= MAXALIVECNT)