-/* $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 $ */
/*
}
/*
- * 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))
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));
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 */
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);
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++;
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;
#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.