Subject: pppd doesn't handle LCP echo-response; fixed
To: None <current-users@netbsd.org>
From: Roland McGrath <roland@frob.com>
List: current-users
Date: 11/01/1994 11:19:04
pppd does not properly understand LCP echo-response packets.
This is easily demonstrable if you turn put these lines in /etc/ppp/options:

lcp-echo-interval 5
lcp-echo-failure 3

In about 15 seconds after establishing the connection, pppd will
decide it is nonresponsive and kill it.  Turning on the debugging
traces shows that the bottom i/o layer of pppd reads the echo response
and it looks fine, but the LCP layer erroneously decides the packet is
bogus and ignores it.

This patch fixed it for me.  
Probably it should use 4 instead of sizeof(u_long), in fact.


diff -c /usr/src/usr.sbin/pppd/lcp.c.\~2\~ /usr/src/usr.sbin/pppd/lcp.c
*** /usr/src/usr.sbin/pppd/lcp.c.~2~    Tue Jun 28 06:27:07 1994
--- /usr/src/usr.sbin/pppd/lcp.c        Tue Nov  1 11:14:29 1994
***************
*** 278,285 ****
        LCPDEBUG((LOG_INFO, "lcp: Echo-Request, Rcvd id %d", id));
        magp = inp;
        PUTLONG(lcp_gotoptions[f->unit].magicnumber, magp);
!       if (len < CILEN_LONG)
!           len = CILEN_LONG;
        fsm_sdata(f, ECHOREP, id, inp, len);
        break;
      
--- 278,285 ----
        LCPDEBUG((LOG_INFO, "lcp: Echo-Request, Rcvd id %d", id));
        magp = inp;
        PUTLONG(lcp_gotoptions[f->unit].magicnumber, magp);
!       if (len < sizeof(u_long))
!           len = sizeof(u_long);
        fsm_sdata(f, ECHOREP, id, inp, len);
        break;
      
***************
*** 1525,1531 ****
      u_long magic;
  
      /* Check the magic number - don't count replies from ourselves. */
!     if (len < CILEN_LONG)
        return;
      GETLONG(magic, inp);
      if (lcp_gotoptions[f->unit].neg_magicnumber
--- 1525,1531 ----
      u_long magic;
  
      /* Check the magic number - don't count replies from ourselves. */
!     if (len < sizeof magic)
        return;
      GETLONG(magic, inp);
      if (lcp_gotoptions[f->unit].neg_magicnumber

Diff exited abnormally with code 1 at Tue Nov  1 11:14:36