From b2e6e1eb395f6c36fe0176c879f0dc667cd3c28d Mon Sep 17 00:00:00 2001 From: mickey Date: Thu, 19 Dec 1996 13:45:16 +0000 Subject: [PATCH] sync to 2.3b3 --- sys/net/if_ppp.c | 23 ++++++++++++++--------- sys/net/ppp-deflate.c | 12 ++++++++++-- sys/net/ppp_defs.h | 1 + 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index f8997836756..893c482108b 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ppp.c,v 1.8 1996/07/25 14:20:50 joshd Exp $ */ +/* $OpenBSD: if_ppp.c,v 1.9 1996/12/19 13:45:16 mickey Exp $ */ /* $NetBSD: if_ppp.c,v 1.31 1996/05/07 02:40:36 thorpej Exp $ */ /* @@ -755,7 +755,7 @@ pppoutput(ifp, m0, dst, rtp) } /* - * Update the time we sent the most recent packet. + * Update the time we sent the most recent data packet. */ if (sc->sc_active_filt.bf_insns == 0 || bpf_filter(sc->sc_active_filt.bf_insns, (u_char *) m0, len, 0)) @@ -930,8 +930,7 @@ ppp_dequeue(sc) break; ip = mtod(mp, struct ip *); } - /* this code assumes the IP/TCP header is in one non-shared -mbuf */ + /* this code assumes the IP/TCP header is in one non-shared mbuf */ if (ip->ip_p == IPPROTO_TCP) { type = sl_compress_tcp(mp, ip, sc->sc_comp, !(sc->sc_flags & SC_NO_TCP_CCID)); @@ -971,12 +970,18 @@ mbuf */ 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_flags & SC_CCP_UP? sc->sc_if.if_mtu + PPP_HDRLEN: 0)); 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/sys/net/ppp-deflate.c b/sys/net/ppp-deflate.c index 008714330a0..25bc385e9eb 100644 --- a/sys/net/ppp-deflate.c +++ b/sys/net/ppp-deflate.c @@ -531,7 +531,9 @@ z_decompress(arg, mi, mop) for (;;) { r = inflate(&state->strm, flush); if (r != Z_OK) { +#ifndef DEFLATE_DEBUG if (state->debug) +#endif printf("z_decompress%d: inflate returned %d (%s)\n", state->unit, r, (state->strm.msg? state->strm.msg: "")); m_freem(mo_head); @@ -578,6 +580,11 @@ z_decompress(arg, mi, mop) return DECOMP_ERROR; } olen += (mo->m_len = ospace - state->strm.avail_out); +#ifdef DEFLATE_DEBUG + if (olen > state->mru + PPP_HDRLEN) + printf("ppp_deflate%d: exceeded mru (%d > %d)\n", + state->unit, olen, state->mru + PPP_HDRLEN); +#endif state->stats.unc_bytes += olen; state->stats.unc_packets++; @@ -627,10 +634,11 @@ z_incomp(arg, mi) r = inflateIncomp(&state->strm); if (r != Z_OK) { /* gak! */ - if (state->debug) { +#ifndef DEFLATE_DEBUG + if (state->debug) +#endif printf("z_incomp%d: inflateIncomp returned %d (%s)\n", state->unit, r, (state->strm.msg? state->strm.msg: "")); - } return; } mi = mi->m_next; diff --git a/sys/net/ppp_defs.h b/sys/net/ppp_defs.h index b5fc672a34e..9be5a9d28b4 100644 --- a/sys/net/ppp_defs.h +++ b/sys/net/ppp_defs.h @@ -65,6 +65,7 @@ #define PPP_PAP 0xc023 /* Password Authentication Protocol */ #define PPP_LQR 0xc025 /* Link Quality Report protocol */ #define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */ +#define PPP_CBCP 0xc029 /* Callback Control Protocol */ /* * Values for FCS calculations. -- 2.20.1