Source-Changes-HG archive

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

[src/trunk]: src/sys/net Close lcp when the lower layer down if the interface...



details:   https://anonhg.NetBSD.org/src/rev/8344e25f4654
branches:  trunk
changeset: 946386:8344e25f4654
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Wed Nov 25 10:18:49 2020 +0000

description:
Close lcp when the lower layer down if the interface is passive or on-demand

reivewed by knakahara@n.o.

diffstat:

 sys/net/if_pppoe.c    |  11 +++++++++--
 sys/net/if_spppsubr.c |  18 ++++++++----------
 2 files changed, 17 insertions(+), 12 deletions(-)

diffs (90 lines):

diff -r 7df31112eb46 -r 8344e25f4654 sys/net/if_pppoe.c
--- a/sys/net/if_pppoe.c        Wed Nov 25 10:12:03 2020 +0000
+++ b/sys/net/if_pppoe.c        Wed Nov 25 10:18:49 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.153 2020/09/25 06:22:33 yamaguchi Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.154 2020/11/25 10:18:49 yamaguchi Exp $ */
 
 /*
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.153 2020/09/25 06:22:33 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.154 2020/11/25 10:18:49 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -1886,9 +1886,16 @@
        PPPOE_LOCK(sc, RW_WRITER);
 
        if (sc->sc_state < PPPOE_STATE_SESSION) {
+               callout_stop(&sc->sc_timeout);
+               sc->sc_state = PPPOE_STATE_INITIAL;
+               sc->sc_padi_retried = 0;
+               sc->sc_padr_retried = 0;
+               memcpy(&sc->sc_dest, etherbroadcastaddr,
+                   sizeof(sc->sc_dest));
                PPPOE_UNLOCK(sc);
                return;
        }
+
        /*
         * Do not call pppoe_disconnect here, the upper layer state
         * machine gets confused by this. We must return from this
diff -r 7df31112eb46 -r 8344e25f4654 sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Wed Nov 25 10:12:03 2020 +0000
+++ b/sys/net/if_spppsubr.c     Wed Nov 25 10:18:49 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.208 2020/11/25 10:12:03 yamaguchi Exp $       */
+/*     $NetBSD: if_spppsubr.c,v 1.209 2020/11/25 10:18:49 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.208 2020/11/25 10:12:03 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.209 2020/11/25 10:18:49 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -68,6 +68,7 @@
 #include <sys/workqueue.h>
 #include <sys/atomic.h>
 #include <sys/compat_stub.h>
+#include <sys/cpu.h>
 
 #include <net/if.h>
 #include <net/netisr.h>
@@ -2466,10 +2467,6 @@
                        sppp_wq_add(sp->wq_cp, &sp->scp[pidx].work_open);
                } else if (debug)
                        addlog("\n");
-       } else if ((ifp->if_flags & (IFF_AUTO | IFF_PASSIVE)) == 0 &&
-                  (sp->scp[IDX_LCP].state == STATE_INITIAL)) {
-                       ifp->if_flags |= IFF_RUNNING;
-                       sppp_wq_add(sp->wq_cp, &sp->scp[pidx].work_open);
        }
 
        sppp_up_event(sp, xcp);
@@ -2510,12 +2507,13 @@
                        log(LOG_DEBUG,
                            "%s: Down event (carrier loss)\n",
                            ifp->if_xname);
+
+               sp->pp_flags &= ~PP_CALLIN;
+               if (sp->scp[pidx].state != STATE_INITIAL)
+                       sppp_wq_add(sp->wq_cp, &sp->scp[pidx].work_close);
+               ifp->if_flags &= ~IFF_RUNNING;
        }
        sp->scp[pidx].fail_counter = 0;
-       sp->pp_flags &= ~PP_CALLIN;
-       if (sp->scp[pidx].state != STATE_INITIAL)
-               sppp_wq_add(sp->wq_cp, &sp->scp[IDX_LCP].work_close);
-       ifp->if_flags &= ~IFF_RUNNING;
 }
 
 static void



Home | Main Index | Thread Index | Old Index