Module Name:    src
Committed By:   yamaguchi
Date:           Tue Jun  1 04:59:50 UTC 2021

Modified Files:
        src/sys/net: if_spppsubr.c if_spppvar.h

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.41 -r1.42 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.251 src/sys/net/if_spppsubr.c:1.252
--- src/sys/net/if_spppsubr.c:1.251	Tue Jun  1 04:55:55 2021
+++ src/sys/net/if_spppsubr.c	Tue Jun  1 04:59:50 2021
@@ -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 @@ sppp_ioctl(struct ifnet *ifp, u_long cmd
 			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 @@ sppp_lcp_open(struct sppp *sp, void *xcp
 	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);

Index: src/sys/net/if_spppvar.h
diff -u src/sys/net/if_spppvar.h:1.41 src/sys/net/if_spppvar.h:1.42
--- src/sys/net/if_spppvar.h:1.41	Tue Jun  1 04:55:55 2021
+++ src/sys/net/if_spppvar.h	Tue Jun  1 04:59:50 2021
@@ -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 @@ struct sppp {
 #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 */

Reply via email to