]> git.ozlabs.org Git - ppp.git/blobdiff - modules/ppp.c
Cleaned up major lint warnings.
[ppp.git] / modules / ppp.c
index 5e47a62b200776dd0d2baf959751a0ba2d7b2f81..d033f6e173196303a70f4821809df1986e27b7cb 100644 (file)
@@ -24,7 +24,7 @@
  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
  * OR MODIFICATIONS.
  *
- * $Id: ppp.c,v 1.18 1999/03/22 05:55:59 paulus Exp $
+ * $Id: ppp.c,v 1.21 1999/09/15 23:49:05 masputra Exp $
  */
 
 /*
@@ -255,7 +255,9 @@ static upperstr_t *find_dest __P((upperstr_t *, int));
 static int putctl2 __P((queue_t *, int, int, int));
 static int putctl4 __P((queue_t *, int, int, int));
 static int pass_packet __P((upperstr_t *ppa, mblk_t *mp, int outbound));
+#ifdef FILTER_PACKETS
 static int ip_hard_filter __P((upperstr_t *ppa, mblk_t *mp, int outbound));
+#endif /* FILTER_PACKETS */
 
 #define PPP_ID 0xb1a6
 static struct module_info ppp_info = {
@@ -556,7 +558,7 @@ pppuwput(q, mp)
     queue_t *q;
     mblk_t *mp;
 {
-    upperstr_t *us, *usnext, *ppa, *os, *nps;
+    upperstr_t *us, *ppa, *nps;
     struct iocblk *iop;
     struct linkblk *lb;
 #ifdef LACHTCP
@@ -567,7 +569,6 @@ pppuwput(q, mp)
     int error, n, sap;
     mblk_t *mq;
     struct ppp_idle *pip;
-    int len;
 #ifdef PRIOQ
     queue_t *tlq;
 #endif /* PRIOQ */
@@ -809,7 +810,7 @@ pppuwput(q, mp)
            if (n == PPPDBG_DUMP + PPPDBG_DRIVER) {
                qwriter(q, NULL, debug_dump, PERIM_OUTER);
                iop->ioc_count = 0;
-               error = 0;
+               error = -1;
            } else if (n == PPPDBG_LOG + PPPDBG_DRIVER) {
                DPRINT1("ppp/%d: debug log enabled\n", us->mn);
                us->flags |= US_DBGLOG;
@@ -1042,7 +1043,7 @@ dlpi_request(q, mp, us)
     int size = mp->b_wptr - mp->b_rptr;
     mblk_t *reply, *np;
     upperstr_t *ppa, *os;
-    int sap, *ip, len;
+    int sap, len;
     dl_info_ack_t *info;
     dl_bind_ack_t *ackp;
 
@@ -1098,7 +1099,7 @@ dlpi_request(q, mp, us)
        }
        us->ppa = ppa;
        qwriter(q, mp, attach_ppa, PERIM_OUTER);
-       break;
+       return;
 
     case DL_DETACH_REQ:
        if (size < sizeof(dl_detach_req_t))
@@ -1108,7 +1109,7 @@ dlpi_request(q, mp, us)
            break;
        }
        qwriter(q, mp, detach_ppa, PERIM_OUTER);
-       break;
+       return;
 
     case DL_BIND_REQ:
        if (size < sizeof(dl_bind_req_t))
@@ -1129,6 +1130,18 @@ dlpi_request(q, mp, us)
           except that we accept ETHERTYPE_IP in place of PPP_IP. */
        sap = d->bind_req.dl_sap;
        us->req_sap = sap;
+
+#ifdef SOL2
+        /* 
+        * ip will send a sap value of 0 (post-Solaris 7), or
+        * ETHERTYPE_IP (0x800) (pre-Solaris 8) due to how the
+        * ppp DLPI provider declares its characteristics.
+        * <adi.masputra@sun.com>
+        */
+       if (sap == 0)
+            sap = ETHERTYPE_IP;
+#endif /* SOL2 */
+
        if (sap == ETHERTYPE_IP)
            sap = PPP_IP;
        if (sap < 0x21 || sap > 0x3fff || (sap & 0x101) != 1) {
@@ -1423,7 +1436,6 @@ send_data(mp, us)
     mblk_t *mp;
     upperstr_t *us;
 {
-    queue_t *q;
     upperstr_t *ppa;
 
     if ((us->flags & US_BLOCKED) || us->npmode == NPMODE_QUEUE)
@@ -1435,7 +1447,7 @@ send_data(mp, us)
        freemsg(mp);
        return 1;
     }
-    if ((q = ppa->lowerq) == 0) {
+    if (ppa->lowerq == 0) {
        /* try to send it up the control stream */
         if (bcanputnext(ppa->q, mp->b_band)) {
            /*
@@ -1699,9 +1711,7 @@ pppurput(q, mp)
     mblk_t *mp;
 {
     upperstr_t *ppa, *us;
-    queue_t *uq;
     int proto, len;
-    mblk_t *np;
     struct iocblk *iop;
 
     ppa = (upperstr_t *) q->q_ptr;
@@ -2092,8 +2102,8 @@ putctl4(q, type, code, val)
 
 static void
 debug_dump(q, mp)
-    queue_t *q;                        /* not used */
-    mblk_t *mp;                        /* not used either */
+    queue_t *q;
+    mblk_t *mp;
 {
     upperstr_t *us;
     queue_t *uq, *lq;
@@ -2119,6 +2129,8 @@ debug_dump(q, mp)
                    (lq? qsize(lq): 0), us->mru, us->mtu);
        }
     }
+    mp->b_datap->db_type = M_IOCACK;
+    qreply(q, mp);
 }
 
 #ifdef FILTER_PACKETS