Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Reconnect when a down event caused by tlf caught



details:   https://anonhg.NetBSD.org/src/rev/1782d4b8872c
branches:  trunk
changeset: 957362:1782d4b8872c
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Wed Nov 25 10:27:18 2020 +0000

description:
Reconnect when a down event caused by tlf caught

diffstat:

 sys/net/if_spppsubr.c |  27 +++++++++++++++++++++++++--
 sys/net/if_spppvar.h  |   3 ++-
 2 files changed, 27 insertions(+), 3 deletions(-)

diffs (86 lines):

diff -r 889d513074ab -r 1782d4b8872c sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Wed Nov 25 10:25:22 2020 +0000
+++ b/sys/net/if_spppsubr.c     Wed Nov 25 10:27:18 2020 +0000
@@ -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 @@
        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_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 @@
 
        /* Notify lower layer if desired. */
        sppp_notify_tls_wlocked(sp);
+       sp->lcp.tlf_sent = false;
 }
 
 static void
@@ -3161,6 +3173,17 @@
 
        /* 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
diff -r 889d513074ab -r 1782d4b8872c sys/net/if_spppvar.h
--- a/sys/net/if_spppvar.h      Wed Nov 25 10:25:22 2020 +0000
+++ b/sys/net/if_spppvar.h      Wed Nov 25 10:27:18 2020 +0000
@@ -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 @@
        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 */



Home | Main Index | Thread Index | Old Index