]> git.ozlabs.org Git - ppp.git/blobdiff - modules/ppp.c
not used any more
[ppp.git] / modules / ppp.c
index 571d95bd3358daf138e97fc24b7586d8e3464ba3..7a181aaeaf469c18307c975f9a2667fe3cf8019c 100644 (file)
  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
  * OR MODIFICATIONS.
  *
- * $Id: ppp.c,v 1.5 1996/05/28 00:56:18 paulus Exp $
+ * $Id: ppp.c,v 1.8 1996/09/14 05:18:45 paulus Exp $
  */
 
 /*
- * This file is used under Solaris 2, SVR4, and SunOS 4.
+ * This file is used under Solaris 2, SVR4, SunOS 4, and Digital UNIX.
  */
 
 #include <sys/types.h>
 #include <sys/stream.h>
 #include <sys/stropts.h>
 #include <sys/errno.h>
+#ifdef __osf__
+#include <sys/ioctl.h>
+#include <sys/cmn_err.h>
+#define queclass(mp)   ((mp)->b_band & QPCTL)
+#else
 #include <sys/ioccom.h>
+#endif
 #include <sys/time.h>
 #ifdef SVR4
 #include <sys/cmn_err.h>
@@ -153,9 +159,11 @@ static void debug_dump __P((queue_t *, mblk_t *));
 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));
 
+#define PPP_ID 0xb1a6
 static struct module_info ppp_info = {
-    0xb1a6, "ppp", 0, 512, 512, 128
+    PPP_ID, "ppp", 0, 512, 512, 128
 };
 
 static struct qinit pppurint = {
@@ -387,7 +395,7 @@ pppclose(q, flag)
            break;
        }
     }
-    kmem_free(up, sizeof(upperstr_t));
+    FREE(up, sizeof(upperstr_t));
     --ppp_count;
 
     return 0;
@@ -660,7 +668,6 @@ pppuwput(q, mp)
 
 #ifdef LACHTCP
        case SIOCSIFNAME:
-           printf("SIOCSIFNAME\n");
            /* Sent from IP down to us.  Attach the ifstats structure.  */
            if (iop->ioc_count != sizeof(struct ifreq) || us->ppa == 0)
                break;
@@ -708,7 +715,6 @@ pppuwput(q, mp)
            break;
 
        case SIOCGIFFLAGS:
-           printf("SIOCGIFFLAGS\n");
            if (!(us->flags & US_CONTROL)) {
                if (us->ppa)
                    us = us->ppa;
@@ -720,7 +726,6 @@ pppuwput(q, mp)
            break;
 
        case SIOCSIFFLAGS:
-           printf("SIOCSIFFLAGS\n");
            if (!(us->flags & US_CONTROL)) {
                if (us->ppa)
                    us = us->ppa;
@@ -732,7 +737,6 @@ pppuwput(q, mp)
            break;
 
        case SIOCSIFADDR:
-           printf("SIOCSIFADDR\n");
            if (!(us->flags & US_CONTROL)) {
                if (us->ppa)
                    us = us->ppa;
@@ -900,7 +904,6 @@ 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;
-       DPRINT1("ppp bind %x\n", sap);
        if (sap == ETHERTYPE_IP)
            sap = PPP_IP;
        if (sap < 0x21 || sap > 0x3fff || (sap & 0x101) != 1) {
@@ -1117,7 +1120,14 @@ send_data(mp, us)
     if ((q = ppa->lowerq) == 0) {
        /* try to send it up the control stream */
        if (canputnext(ppa->q)) {
-           putnext(ppa->q, mp);
+           /*
+            * The message seems to get corrupted for some reason if
+            * we just send the message up as it is, so we send a copy.
+            */
+           mblk_t *np = copymsg(mp);
+           freemsg(mp);
+           if (np != 0)
+               putnext(ppa->q, np);
            return 1;
        }
     } else {
@@ -1457,6 +1467,22 @@ ppplrput(q, mp)
            putnext(us->q, mp);
        break;
 
+    case M_HANGUP:
+       /*
+        * The serial device has hung up.  We don't want to send
+        * the M_HANGUP message up to pppd because that will stop
+        * us from using the control stream any more.  Instead we
+        * send a zero-length message as an end-of-file indication.
+        */
+       freemsg(mp);
+       mp = allocb(1, BPRI_HI);
+       if (mp == 0) {
+           DPRINT1("ppp/%d: couldn't allocate eof message!\n", ppa->mn);
+           break;
+       }
+       putnext(ppa->q, mp);
+       break;
+
     default:
        if (mp->b_datap->db_type == M_DATA) {
            len = msgdsize(mp);