Subject: ppp fixes
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Christos Zoulas <christos@deshaw.com>
List: current-users
Date: 06/13/1994 00:47:04
I finally got ppp to work again. The necessary fix was found in the newer
version of pppd...

On the other hand, as I was reading if_ppp.c, I noticed a few places
where the spl was not being restored. I don't claim that that the
fixes in the second patch are definitely right, but they look right to
me, and I've been running with them with no problems.

Now finally I can upgrade my home machine :-)

christos


*** lcp.c.dist	Mon May 30 07:34:32 1994
--- lcp.c	Mon Jun 13 00:16:26 1994
***************
*** 1267,1274 ****
      ppp_send_config(f->unit, MIN(ao->mru, (ho->neg_mru? ho->mru: MTU)),
  		    (ho->neg_asyncmap? ho->asyncmap: 0xffffffff),
  		    ho->neg_pcompression, ho->neg_accompression);
      ppp_recv_config(f->unit, (go->neg_mru? MAX(wo->mru, go->mru): MTU),
! 		    (go->neg_asyncmap? go->asyncmap: 0xffffffff),
  		    go->neg_pcompression, go->neg_accompression);
  
      if (ho->neg_mru)
--- 1267,1279 ----
      ppp_send_config(f->unit, MIN(ao->mru, (ho->neg_mru? ho->mru: MTU)),
  		    (ho->neg_asyncmap? ho->asyncmap: 0xffffffff),
  		    ho->neg_pcompression, ho->neg_accompression);
+     /*
+      * If the asyncmap hasn't been negotiated, we really should
+      * set the receive asyncmap to ffffffff, but we set it to 0
+      * for backwards contemptibility.
+      */
      ppp_recv_config(f->unit, (go->neg_mru? MAX(wo->mru, go->mru): MTU),
! 		    (go->neg_asyncmap? go->asyncmap: 0x00000000),
  		    go->neg_pcompression, go->neg_accompression);
  
      if (ho->neg_mru)


*** if_ppp.c.dist	Mon May 30 07:14:32 1994
--- if_ppp.c	Mon Jun 13 00:18:37 1994
***************
*** 369,376 ****
  	    return (EWOULDBLOCK);
  	}
  	error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI|PCATCH, ttyin, 0);
! 	if (error)
  	    return error;
      }
      if (tp->t_line != PPPDISC) {
  	splx(s);
--- 369,378 ----
  	    return (EWOULDBLOCK);
  	}
  	error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI|PCATCH, ttyin, 0);
! 	if (error) {
! 	    splx(s);
  	    return error;
+ 	}
      }
      if (tp->t_line != PPPDISC) {
  	splx(s);
***************
*** 727,732 ****
--- 729,735 ----
      return (0);
  
  bad:
+     splx(s);
      m_freem(m0);
      return (error);
  }
***************
*** 1308,1315 ****
  	 * If SC_ESCAPED is set, then we've seen the packet
  	 * abort sequence "}~".
  	 */
! 	if (sc->sc_flags & (SC_FLUSH | SC_ESCAPED)
! 	    || ilen > 0 && sc->sc_fcs != PPP_GOODFCS) {
  #ifdef VJC
  	    /*
  	     * If we've missed a packet, we must toss subsequent compressed
--- 1311,1318 ----
  	 * If SC_ESCAPED is set, then we've seen the packet
  	 * abort sequence "}~".
  	 */
! 	if ((sc->sc_flags & (SC_FLUSH|SC_ESCAPED)) != 0
! 	    || (ilen > 0 && sc->sc_fcs != PPP_GOODFCS)) {
  #ifdef VJC
  	    /*
  	     * If we've missed a packet, we must toss subsequent compressed
***************
*** 1317,1328 ****
  	     */
  	    sl_uncompress_tcp(NULL, 0, TYPE_ERROR, &sc->sc_comp);
  #endif
! 	    if ((sc->sc_flags & (SC_FLUSH | SC_ESCAPED)) == 0){
  		if (sc->sc_flags & SC_DEBUG)
! 		    printf("ppp%d: bad fcs\n", sc->sc_if.if_unit);
  		sc->sc_if.if_ierrors++;
  	    } else
! 		sc->sc_flags &= ~(SC_FLUSH | SC_ESCAPED);
  	    return;
  	}
  
--- 1320,1332 ----
  	     */
  	    sl_uncompress_tcp(NULL, 0, TYPE_ERROR, &sc->sc_comp);
  #endif
! 	    if ((sc->sc_flags & (SC_FLUSH|SC_ESCAPED)) == 0){
  		if (sc->sc_flags & SC_DEBUG)
! 		    printf("ppp%d: bad fcs %x\n", sc->sc_if.if_unit, 
! 						  sc->sc_fcs);
  		sc->sc_if.if_ierrors++;
  	    } else
! 		sc->sc_flags &= ~(SC_FLUSH|SC_ESCAPED);
  	    return;
  	}
  
***************
*** 1493,1500 ****
  	break;
  
      case SIOCSIFMTU:
! 	if (error = suser(p->p_ucred, &p->p_acflag))
  	    return (error);
  	sc->sc_if.if_mtu = ifr->ifr_mtu;
  	break;
  
--- 1497,1506 ----
  	break;
  
      case SIOCSIFMTU:
! 	if (error = suser(p->p_ucred, &p->p_acflag)) {
! 	    splx(s);
  	    return (error);
+ 	}
  	sc->sc_if.if_mtu = ifr->ifr_mtu;
  	break;
  

------------------------------------------------------------------------------