]> git.ozlabs.org Git - ppp.git/blobdiff - modules/ppp_ahdlc.c
Merge in 1.3 and post 1.3 fixes; some of them might be applicable to
[ppp.git] / modules / ppp_ahdlc.c
index 0dc502bdac3eaffbeb1b58c09ba9f5178c1af3bb..cfde35d296ddac3e3f7d25c231005549b9bd54c5 100644 (file)
@@ -24,7 +24,7 @@
  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
  * OR MODIFICATIONS.
  *
- * $Id: ppp_ahdlc.c,v 1.2 1996/06/26 00:54:01 paulus Exp $
+ * $Id: ppp_ahdlc.c,v 1.8 1998/05/04 06:11:50 paulus Exp $
  */
 
 /*
@@ -42,6 +42,9 @@
 #include <sys/ddi.h>
 #else
 #include <sys/user.h>
+#ifdef __osf__
+#include <sys/cmn_err.h>
+#endif
 #endif /* SVR4 */
 
 #include <net/ppp_defs.h>
@@ -68,7 +71,11 @@ static int msg_byte __P((mblk_t *, unsigned int));
 
 #define PPP_AHDL_ID 0x7d23
 static struct module_info minfo = {
+#ifdef PRIOQ
+    PPP_AHDL_ID, "ppp_ahdl", 0, INFPSZ, 640, 512
+#else
     PPP_AHDL_ID, "ppp_ahdl", 0, INFPSZ, 4096, 128
+#endif PRIOQ
 };
 
 static struct qinit rinit = {
@@ -79,6 +86,10 @@ static struct qinit winit = {
     ahdlc_wput, NULL, NULL, NULL, NULL, &minfo, NULL
 };
 
+#if defined(SVR4) && !defined(SOL2)
+int phdldevflag = 0;
+#define ppp_ahdlcinfo phdlinfo
+#endif
 struct streamtab ppp_ahdlcinfo = {
     &rinit, &winit, NULL, NULL
 };
@@ -160,7 +171,7 @@ MOD_OPEN(ahdlc_open)
        WR(q)->q_ptr = (caddr_t) sp;
        sp->xaccm[0] = ~0;
        sp->xaccm[3] = 0x60000000;
-       sp->mru = 1500;
+       sp->mru = PPP_MRU;
        ++ppp_ahdlc_count;
        qprocson(q);
     }
@@ -214,9 +225,13 @@ 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 */
+           state->xaccm[2] &= ~0x40000000;     /* don't escape 0x5e */
            state->xaccm[3] |= 0x60000000;      /* do escape 0x7d, 0x7e */
            iop->ioc_count = 0;
            error = 0;
@@ -225,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;
@@ -376,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
@@ -493,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.
      */