Source-Changes-HG archive

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

[src/trunk]: src/sys/net Drop the Open event of LCP to stop the interface



details:   https://anonhg.NetBSD.org/src/rev/c25f0545d0c4
branches:  trunk
changeset: 983664:c25f0545d0c4
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Tue Jun 01 04:59:50 2021 +0000

description:
Drop the Open event of LCP to stop the interface
even a reconnection is scheduled

The queue for events in if_spppsubr.c is not possible
to enqueue the same event. So, The close event caused
while a close event and open event are enqueued for
reconnection is not possible to stop interface.
To solve this issue, The open event after
"ifconfig pppoe? down" is dropped.

diffstat:

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

diffs (59 lines):

diff -r 301d82ea6efc -r c25f0545d0c4 sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Tue Jun 01 04:55:55 2021 +0000
+++ b/sys/net/if_spppsubr.c     Tue Jun 01 04:59:50 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.251 2021/06/01 04:55:55 yamaguchi Exp $       */
+/*     $NetBSD: if_spppsubr.c,v 1.252 2021/06/01 04:59:50 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.251 2021/06/01 04:55:55 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.252 2021/06/01 04:59:50 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1256,6 +1256,12 @@
                        ifp->if_flags &= ~IFF_AUTO;
                }
 
+               if (ifp->if_flags & IFF_UP) {
+                       sp->pp_flags |= PP_ADMIN_UP;
+               } else {
+                       sp->pp_flags &= ~PP_ADMIN_UP;
+               }
+
                if (going_up || going_down) {
                        sp->lcp.reestablish = false;
                        sppp_wq_add(sp->wq_cp, &sp->scp[IDX_LCP].work_close);
@@ -2571,6 +2577,10 @@
        sp->lcp.reestablish = false;
        sp->scp[IDX_LCP].fail_counter = 0;
 
+       /* the interface was down while waiting for reconnection */
+       if ((sp->pp_flags & PP_ADMIN_UP) == 0)
+               return;
+
        if (sp->pp_if.if_mtu < PP_MTU) {
                sp->lcp.mru = sp->pp_if.if_mtu;
                SET(sp->lcp.opts, SPPP_LCP_OPT_MRU);
diff -r 301d82ea6efc -r c25f0545d0c4 sys/net/if_spppvar.h
--- a/sys/net/if_spppvar.h      Tue Jun 01 04:55:55 2021 +0000
+++ b/sys/net/if_spppvar.h      Tue Jun 01 04:59:50 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppvar.h,v 1.41 2021/06/01 04:55:55 yamaguchi Exp $        */
+/*     $NetBSD: if_spppvar.h,v 1.42 2021/06/01 04:59:50 yamaguchi Exp $        */
 
 #ifndef _NET_IF_SPPPVAR_H_
 #define _NET_IF_SPPPVAR_H_
@@ -214,6 +214,7 @@
 #define PP_LOOPBACK            0x40    /* in line loopback mode */
 #define PP_LOOPBACK_IFDOWN     0x80    /* if_down() when loopback detected */
 #define PP_KEEPALIVE_IFDOWN    0x100   /* if_down() when no ECHO_REPLY received */
+#define PP_ADMIN_UP            0x200   /* the interface is up */
 
 
 #define PP_MTU          1500    /* default/minimal MRU */



Home | Main Index | Thread Index | Old Index