Module Name: src Committed By: yamaguchi Date: Wed Nov 25 10:27:18 UTC 2020
Modified Files: src/sys/net: if_spppsubr.c if_spppvar.h Log Message: Reconnect when a down event caused by tlf caught To generate a diff of this commit: cvs rdiff -u -r1.211 -r1.212 src/sys/net/if_spppsubr.c cvs rdiff -u -r1.30 -r1.31 src/sys/net/if_spppvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/if_spppsubr.c diff -u src/sys/net/if_spppsubr.c:1.211 src/sys/net/if_spppsubr.c:1.212 --- src/sys/net/if_spppsubr.c:1.211 Wed Nov 25 10:25:22 2020 +++ src/sys/net/if_spppsubr.c Wed Nov 25 10:27:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_spppsubr.c,v 1.211 2020/11/25 10:25:22 yamaguchi Exp $ */ +/* $NetBSD: if_spppsubr.c,v 1.212 2020/11/25 10:27:18 yamaguchi Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.211 2020/11/25 10:25:22 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.212 2020/11/25 10:27:18 yamaguchi Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -2426,6 +2426,7 @@ sppp_lcp_init(struct sppp *sp) sp->lcp.max_terminate = 2; sp->lcp.max_configure = 10; sp->lcp.max_failure = 10; + sp->lcp.tlf_sent = false; /* * Initialize counters and timeout values. Note that we don't @@ -2485,6 +2486,16 @@ sppp_lcp_down(struct sppp *sp, void *xcp sppp_down_event(sp, xcp); /* + * We need to do tls to restart when a down event is caused + * by the last tlf. + */ + if (sp->scp[pidx].state == STATE_STARTING && + sp->lcp.tlf_sent) { + cp->tls(cp, sp); + sp->lcp.tlf_sent = false; + } + + /* * If this is neither a dial-on-demand nor a passive * interface, simulate an ``ifconfig down'' action, so the * administrator can force a redial by another ``ifconfig @@ -3149,6 +3160,7 @@ sppp_lcp_tls(const struct cp *cp __unuse /* Notify lower layer if desired. */ sppp_notify_tls_wlocked(sp); + sp->lcp.tlf_sent = false; } static void @@ -3161,6 +3173,17 @@ sppp_lcp_tlf(const struct cp *cp __unuse /* Notify lower layer if desired. */ sppp_notify_tlf_wlocked(sp); + + switch (sp->scp[IDX_LCP].state) { + case STATE_CLOSED: + case STATE_STOPPED: + sp->lcp.tlf_sent = true; + break; + case STATE_INITIAL: + default: + /* just in case */ + sp->lcp.tlf_sent = false; + } } static void Index: src/sys/net/if_spppvar.h diff -u src/sys/net/if_spppvar.h:1.30 src/sys/net/if_spppvar.h:1.31 --- src/sys/net/if_spppvar.h:1.30 Wed Nov 25 10:12:03 2020 +++ src/sys/net/if_spppvar.h Wed Nov 25 10:27:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_spppvar.h,v 1.30 2020/11/25 10:12:03 yamaguchi Exp $ */ +/* $NetBSD: if_spppvar.h,v 1.31 2020/11/25 10:27:18 yamaguchi Exp $ */ #ifndef _NET_IF_SPPPVAR_H_ #define _NET_IF_SPPPVAR_H_ @@ -58,6 +58,7 @@ struct slcp { u_long mrru; /* our max received reconstructed unit */ u_long their_mrru; /* their max receive dreconstructed unit */ bool reestablish; /* reestablish after the next down event */ + bool tlf_sent; /* call lower layer's tlf before a down event */ }; #define IDX_IPCP 1 /* idx into state table */