]> git.ozlabs.org Git - ppp.git/blobdiff - modules/ppp_ahdlc.c
move PPP_VERSION to ppp.c; don't use dev->tbusy as a lock
[ppp.git] / modules / ppp_ahdlc.c
index 5bc8e531fac84f90cf90613e6e87d470830aadec..cfde35d296ddac3e3f7d25c231005549b9bd54c5 100644 (file)
@@ -24,7 +24,7 @@
  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
  * OR MODIFICATIONS.
  *
- * $Id: ppp_ahdlc.c,v 1.6 1997/04/30 05:44:58 paulus Exp $
+ * $Id: ppp_ahdlc.c,v 1.8 1998/05/04 06:11:50 paulus Exp $
  */
 
 /*
@@ -225,6 +225,10 @@ ahdlc_wput(q, mp)
            if (iop->ioc_count < sizeof(u_int32_t)
                || iop->ioc_count > sizeof(ext_accm))
                break;
+           if (mp->b_cont == 0) {
+               DPRINT1("ahdlc_wput/%d: PPPIO_XACCM b_cont = 0!\n", state->unit);
+               break;
+           }
            bcopy((caddr_t)mp->b_cont->b_rptr, (caddr_t)state->xaccm,
                  iop->ioc_count);
            state->xaccm[2] &= ~0x40000000;     /* don't escape 0x5e */
@@ -236,6 +240,10 @@ ahdlc_wput(q, mp)
        case PPPIO_RACCM:
            if (iop->ioc_count != sizeof(u_int32_t))
                break;
+           if (mp->b_cont == 0) {
+               DPRINT1("ahdlc_wput/%d: PPPIO_RACCM b_cont = 0!\n", state->unit);
+               break;
+           }
            bcopy((caddr_t)mp->b_cont->b_rptr, (caddr_t)&state->raccm,
                  sizeof(u_int32_t));
            iop->ioc_count = 0;
@@ -387,12 +395,14 @@ stuff_frame(q, mp)
        goto bomb;
 
     /*
-     * Put in an initial flag for now.  We'll remove it later
-     * if we decide we don't need it.
+     * Put in an initial flag, unless the serial driver currently has
+     * packets still to be transmitted in its queue.
      */
     dp = op->b_wptr;
-    *dp++ = PPP_FLAG;
-    --olen;
+    if (qsize(q->q_next) == 0) {
+       *dp++ = PPP_FLAG;
+       --olen;
+    }
 
     /*
      * For LCP packets with code values between 1 and 7 (Conf-Req
@@ -504,12 +514,6 @@ stuff_frame(q, mp)
     *dp++ = PPP_FLAG;
     op->b_wptr = dp;
 
-    /*
-     * Remove the initial flag, if possible.
-     */
-    if (qsize(q->q_next) > 0)
-       ++omsg->b_rptr;
-
     /*
      * Update statistics.
      */