Subject: kern/11161: sppp driver sends too many up-events to NCP layer.
To: None <gnats-bugs@gnats.netbsd.org>
From: Joachim Kuebart <kuebart@mathematik.uni-ulm.de>
List: netbsd-bugs
Date: 10/07/2000 17:34:11
>Number:         11161
>Category:       kern
>Synopsis:       sppp driver sends too many up-events to NCP layer.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 07 17:34:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Joachim Kuebart
>Release:        September 2000
>Organization:
>Environment:
	
System: NetBSD shire.domestic.de 1.5_ALPHA2 NetBSD 1.5_ALPHA2 (SHIRE) #5: So Okt 8 02:19:24 CEST 2000 joki@shire.domestic.de:/usr/obj/kern/src/sys/arch/i386/compile/SHIRE i386


>Description:
	When dialing out using the sppp driver from /sys/net/if_spppsubr.c
	with authentication enabled, the NCP layer (IPCP, IPCPv6, ...)
	gets Up events from the LCP layer (which it shouldn't) and
	from the AUTH layer (which it should) resulting in an "illegal
	up" log message when authentication finishes.
>How-To-Repeat:
	Dial out using an sppp line with some authentication enabled.
	The LCP layer finishes in phase authenticate, but generates an
	ipcp Up event nonetheless, which is wrong. The authentication
	protocol itself generates Open and Up events for the Network
	Control Protocols, which generate the abovementioned error log
	message.
>Fix:
	It turns out this is a simple case of mistaken operator
	precedence. Apply the patch below and the message goes away:

cvs diff: Diffing .
Index: if_spppsubr.c
===================================================================
RCS file: /home/cvs/netbsd/src/sys/net/if_spppsubr.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 if_spppsubr.c
--- if_spppsubr.c	2000/06/11 10:10:19	1.1.1.5
+++ if_spppsubr.c	2000/10/08 00:24:58
@@ -2531,7 +2531,7 @@
 
 	/* Send Up events to all started protos. */
 	for (i = 0, mask = 1; i < IDX_COUNT; i++, mask <<= 1)
-		if (sp->lcp.protos & mask && ((cps[i])->flags & CP_LCP) == 0)
+		if ((sp->lcp.protos & mask) && ((cps[i])->flags & CP_LCP) == 0)
 			(cps[i])->Up(sp);
 
 	/* notify low-level driver of state change */
>Release-Note:
>Audit-Trail:
>Unformatted: