]> git.ozlabs.org Git - ppp.git/blobdiff - freebsd-2.0/if_ppp.c
Some mods from Bruce Evans
[ppp.git] / freebsd-2.0 / if_ppp.c
index d467ca012e2f6d3c7304a8562ecb219c14876234..d62251aa5dba80ef5dc9fd3fb3f3dbea5eaec5c8 100644 (file)
@@ -69,7 +69,7 @@
  * Paul Mackerras (paulus@cs.anu.edu.au).
  */
 
-/* $Id: if_ppp.c,v 1.1 1994/12/15 22:28:09 paulus Exp $ */
+/* $Id: if_ppp.c,v 1.5 1995/08/16 01:36:38 paulus Exp $ */
 /* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */
 
 #include "ppp.h"
 #include <net/if_pppvar.h>
 #include <machine/cpu.h>
 
+#ifndef NETISR_PPP
+/* This definition should be moved to net/netisr.h */
+#define NETISR_PPP     26      /* PPP software interrupt */
+#endif
+
 #ifdef PPP_COMPRESS
 #define PACKETPTR      struct mbuf *
 #include <net/ppp-comp.h>
@@ -163,7 +168,9 @@ static void pppdumpm __P((struct mbuf *m0));
 extern struct compressor ppp_bsd_compress;
 
 struct compressor *ppp_compressors[8] = {
+#if DO_BSD_COMPRESS
     &ppp_bsd_compress,
+#endif
     NULL
 };
 #endif /* PPP_COMPRESS */
@@ -184,7 +191,7 @@ pppattach()
        sc->sc_if.if_name = "ppp";
        sc->sc_if.if_unit = i++;
        sc->sc_if.if_mtu = PPP_MTU;
-       sc->sc_if.if_flags = IFF_POINTOPOINT;
+       sc->sc_if.if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
        sc->sc_if.if_type = IFT_PPP;
        sc->sc_if.if_hdrlen = PPP_HDRLEN;
        sc->sc_if.if_ioctl = pppsioctl;
@@ -504,6 +511,19 @@ pppsioctl(ifp, cmd, data)
        ifr->ifr_mtu = sc->sc_if.if_mtu;
        break;
 
+    case SIOCADDMULTI:
+    case SIOCDELMULTI:
+       switch(ifr->ifr_addr.sa_family) {
+#ifdef INET
+       case AF_INET:
+           break;
+#endif
+       default:
+           error = EAFNOSUPPORT;
+           break;
+       }
+       break;
+
     case SIOCGPPPSTATS:
        psp = &((struct ifpppstatsreq *) data)->stats;
        bzero(psp, sizeof(*psp));
@@ -877,7 +897,7 @@ ppp_outpkt(sc)
 #ifdef PPP_COMPRESS
     if (protocol != PPP_LCP && protocol != PPP_CCP
        && sc->sc_xc_state && (sc->sc_flags & SC_COMP_RUN)) {
-       struct mbuf *mcomp;
+       struct mbuf *mcomp = NULL;
        int slen, clen;
 
        slen = 0;
@@ -981,7 +1001,7 @@ ppp_ccp(sc, m, rcvd)
                if (sc->sc_xc_state != NULL
                    && (*sc->sc_xcomp->comp_init)
                        (sc->sc_xc_state, dp + CCP_HDRLEN, slen - CCP_HDRLEN,
-                        sc->sc_if.if_unit, sc->sc_flags & SC_DEBUG)) {
+                        sc->sc_if.if_unit, 0, sc->sc_flags & SC_DEBUG)) {
                    s = splimp();
                    sc->sc_flags |= SC_COMP_RUN;
                    splx(s);
@@ -1073,7 +1093,7 @@ ppp_inproc(sc, m)
     struct ifqueue *inq;
     int s, ilen, xlen, proto, rv;
     u_char *cp, adrs, ctrl;
-    struct mbuf *mp, *dmp;
+    struct mbuf *mp, *dmp = NULL;
     u_char *iphdr;
     u_int hlen;
 
@@ -1105,32 +1125,30 @@ ppp_inproc(sc, m)
        && !(sc->sc_flags & SC_DC_ERROR) && !(sc->sc_flags & SC_DC_FERROR)) {
        /* decompress this packet */
        rv = (*sc->sc_rcomp->decompress)(sc->sc_rc_state, m, &dmp);
-       if (dmp != NULL) {
+       if (rv == DECOMP_OK) {
            m_freem(m);
+           if (dmp == NULL) {
+               /* no error, but no decompressed packet produced */
+               return;
+           }
            m = dmp;
            cp = mtod(m, u_char *);
            proto = PPP_PROTOCOL(cp);
 
        } else {
-           /* pass the compressed packet up to pppd, which may take
-              CCP down or issue a Reset-Req. */
+           /*
+            * An error has occurred in decompression.
+            * Pass the compressed packet up to pppd, which may take
+            * CCP down or issue a Reset-Req.
+            */
            if (sc->sc_flags & SC_DEBUG)
                printf("ppp%d: decompress failed %d\n", sc->sc_if.if_unit, rv);
            s = splimp();
            sc->sc_flags |= SC_VJ_RESET;
-           switch (rv) {
-           case DECOMP_OK:
-               /* no error, but no decompressed packet produced */
-               splx(s);
-               m_freem(m);
-               return;
-           case DECOMP_ERROR:
+           if (rv == DECOMP_ERROR)
                sc->sc_flags |= SC_DC_ERROR;
-               break;
-           case DECOMP_FATALERROR:
+           else
                sc->sc_flags |= SC_DC_FERROR;
-               break;
-           }
            splx(s);
        }