]> git.ozlabs.org Git - ppp.git/blobdiff - freebsd-2.0/if_ppp.c
sifdefaultroute now gets both local and remote addresses;
[ppp.git] / freebsd-2.0 / if_ppp.c
index 2d195dd469e7537117f53fdc431fe6b72b3a35e9..6e450ea5687968e15a7932b60d1dcc1d1b9845f4 100644 (file)
@@ -69,7 +69,7 @@
  * Paul Mackerras (paulus@cs.anu.edu.au).
  */
 
  * Paul Mackerras (paulus@cs.anu.edu.au).
  */
 
-/* $Id: if_ppp.c,v 1.8 1996/07/01 05:25:55 paulus Exp $ */
+/* $Id: if_ppp.c,v 1.11 1997/03/04 03:27:28 paulus Exp $ */
 /* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */
 /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */
 
 /* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */
 /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */
 
 #include <net/ppp-comp.h>
 #endif
 
 #include <net/ppp-comp.h>
 #endif
 
+static int     pppsioctl __P((struct ifnet *, int, caddr_t));
+static int     pppoutput __P((struct ifnet *, struct mbuf *,
+                              struct sockaddr *, struct rtentry *));
 static void    ppp_requeue __P((struct ppp_softc *));
 static void    ppp_outpkt __P((struct ppp_softc *));
 static void    ppp_ccp __P((struct ppp_softc *, struct mbuf *m, int rcvd));
 static void    ppp_requeue __P((struct ppp_softc *));
 static void    ppp_outpkt __P((struct ppp_softc *));
 static void    ppp_ccp __P((struct ppp_softc *, struct mbuf *m, int rcvd));
@@ -234,7 +237,7 @@ pppalloc(pid)
     sc->sc_relinq = NULL;
     bzero((char *)&sc->sc_stats, sizeof(sc->sc_stats));
 #ifdef VJC
     sc->sc_relinq = NULL;
     bzero((char *)&sc->sc_stats, sizeof(sc->sc_stats));
 #ifdef VJC
-    MALLOC(sc->sc_comp, struct slcompress *, sizeof(struct slcompress),
+    MALLOC(sc->sc_comp, struct vjcompress *, sizeof(struct vjcompress),
           M_DEVBUF, M_NOWAIT);
     if (sc->sc_comp)
        vj_compress_init(sc->sc_comp, -1);
           M_DEVBUF, M_NOWAIT);
     if (sc->sc_comp)
        vj_compress_init(sc->sc_comp, -1);
@@ -310,7 +313,7 @@ pppdealloc(sc)
 int
 pppioctl(sc, cmd, data, flag, p)
     struct ppp_softc *sc;
 int
 pppioctl(sc, cmd, data, flag, p)
     struct ppp_softc *sc;
-    u_long cmd;
+    int cmd;
     caddr_t data;
     int flag;
     struct proc *p;
     caddr_t data;
     int flag;
     struct proc *p;
@@ -487,7 +490,7 @@ pppioctl(sc, cmd, data, flag, p)
 int
 pppsioctl(ifp, cmd, data)
     register struct ifnet *ifp;
 int
 pppsioctl(ifp, cmd, data)
     register struct ifnet *ifp;
-    u_long cmd;
+    int cmd;
     caddr_t data;
 {
     struct proc *p = curproc;  /* XXX */
     caddr_t data;
 {
     struct proc *p = curproc;  /* XXX */
@@ -890,13 +893,18 @@ ppp_dequeue(sc)
        for (mp = m; mp != NULL; mp = mp->m_next)
            slen += mp->m_len;
        clen = (*sc->sc_xcomp->compress)
        for (mp = m; mp != NULL; mp = mp->m_next)
            slen += mp->m_len;
        clen = (*sc->sc_xcomp->compress)
-           (sc->sc_xc_state, &mcomp, m, slen,
-            (sc->sc_flags & SC_CCP_UP? sc->sc_if.if_mtu: 0));
+           (sc->sc_xc_state, &mcomp, m, slen, sc->sc_if.if_mtu + PPP_HDRLEN);
        if (mcomp != NULL) {
        if (mcomp != NULL) {
-           m_freem(m);
-           m = mcomp;
-           cp = mtod(m, u_char *);
-           protocol = cp[3];
+           if (sc->sc_flags & SC_CCP_UP) {
+               /* Send the compressed packet instead of the original. */
+               m_freem(m);
+               m = mcomp;
+               cp = mtod(m, u_char *);
+               protocol = cp[3];
+           } else {
+               /* Can't transmit compressed packets until CCP is up. */
+               m_freem(mcomp);
+           }
        }
     }
 #endif /* PPP_COMPRESS */
        }
     }
 #endif /* PPP_COMPRESS */