Subject: bin/3272: pppd lcp-echos should not be sent on a disconnected line
To: None <gnats-bugs@gnats.netbsd.org>
From: Wailer <banshee@gabriella.abattoir.com>
List: netbsd-bugs
Date: 03/01/1997 19:00:37
>Number:         3272
>Category:       bin
>Synopsis:       pppd should not send lcp echos on a disconnected line.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar  1 19:20:01 1997
>Last-Modified:
>Originator:     Wailer
>Organization:
The Wailer at the Gates of Dawn            /   banshee@resort.com          |
Just who ARE you calling a FROOFROO Head? /                                |
DoD#0667  "Just a friend of the beast."  | http://www.resort.com/~banshee/ |
2,3,5,7,13,17,19,31,61,89,107,127,521,607....\      Port and Absinthe      |
>Release:        2/28/97
>Environment:
System: NetBSD gabriella.abattoir.com 1.2C NetBSD 1.2C (GABRIELLA2) #0: Fri Feb 28 14:30:06 PST 1997 banshee@gabriella.abattoir.com:/usr/src/sys/arch/i386/compile/GABRIELLA2 i386


>Description:
	When pppd is set to request lcp echo to determine the line state,
	it doesn't check the line state before incrementing its failed
	echo counter.  As a consequence, a low setting of lcp-echo-failure
	causes the line to never be brought up because pppd checks for 
	echos while chat is dialing.
>How-To-Repeat:
	In your options file:
		lcp-echo-interval 10
		lcp-echo-failure 3

>Fix:

	The check of line state in LcpLinkFailure() is superfluous
	and perhaps should be removed if this patch is accepted.

--- lcp.old	Sat Mar  1 18:46:18 1997
+++ lcp.c	Sat Mar  1 18:47:52 1997
@@ -1677,20 +1677,20 @@
     u_int32_t lcp_magic;
     u_char pkt[4], *pktp;
 
-    /*
-     * Detect the failure of the peer at this point.
-     */
-    if (lcp_echo_fails != 0) {
-        if (lcp_echos_pending++ >= lcp_echo_fails) {
-            LcpLinkFailure(f);
-	    lcp_echos_pending = 0;
-	}
-    }
-
-    /*
-     * Make and send the echo request frame.
-     */
     if (f->state == OPENED) {
+       /*
+        * Detect the failure of the peer at this point.
+        */
+    	if (lcp_echo_fails != 0) {
+  	      if (lcp_echos_pending++ >= lcp_echo_fails) {
+		    LcpLinkFailure(f);
+		    lcp_echos_pending = 0;
+	      }
+        }
+
+       /*
+        * Make and send the echo request frame.
+        */
         lcp_magic = lcp_gotoptions[f->unit].magicnumber;
 	pktp = pkt;
 	PUTLONG(lcp_magic, pktp);

--end--
>Audit-Trail:
>Unformatted: