From 0f6dd4f00bd28d250d5965440c252d371ac13d8c Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Thu, 26 Sep 1996 06:24:39 +0000 Subject: [PATCH 1/1] better way of not sending compressed packet when CCP is not up. --- freebsd-2.0/if_ppp.c | 19 ++++++++++++------- netbsd-1.1/if_ppp.c | 19 ++++++++++++------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/freebsd-2.0/if_ppp.c b/freebsd-2.0/if_ppp.c index 2d195dd..f540a9b 100644 --- a/freebsd-2.0/if_ppp.c +++ b/freebsd-2.0/if_ppp.c @@ -69,7 +69,7 @@ * 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.9 1996/09/26 06:24:39 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 */ @@ -890,13 +890,18 @@ ppp_dequeue(sc) 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) { - 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 */ diff --git a/netbsd-1.1/if_ppp.c b/netbsd-1.1/if_ppp.c index 4f0072d..c4f1256 100644 --- a/netbsd-1.1/if_ppp.c +++ b/netbsd-1.1/if_ppp.c @@ -1,4 +1,4 @@ -/* $Id: if_ppp.c,v 1.4 1996/07/01 05:30:45 paulus Exp $ */ +/* $Id: if_ppp.c,v 1.5 1996/09/26 06:24:14 paulus Exp $ */ /* * if_ppp.c - Point-to-Point Protocol (PPP) Asynchronous driver. @@ -935,13 +935,18 @@ ppp_dequeue(sc) 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) { - 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 */ -- 2.39.2