From 4182e4cd4ec9c8ed6a0890dce4e24f31605899bc Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Tue, 24 Mar 1998 23:55:01 +0000 Subject: [PATCH] Extra debug messages; fix the bug where we were losing decompression when setting the compressor. --- include/linux/if_ppp.h | 8 ++------ linux/if_ppp.h | 8 ++------ linux/ppp.c | 30 ++++++++++++++++++++---------- linux/ppp_deflate.c | 8 ++++++-- 4 files changed, 30 insertions(+), 24 deletions(-) diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h index 1f59f7d..9dc6041 100644 --- a/include/linux/if_ppp.h +++ b/include/linux/if_ppp.h @@ -1,4 +1,4 @@ -/* From: if_ppp.h,v 1.3 1995/06/12 11:36:50 paulus Exp */ +/* $Id: if_ppp.h,v 1.11 1998/03/24 23:54:58 paulus Exp $ */ /* * if_ppp.h - Point-to-Point Protocol definitions. @@ -65,7 +65,6 @@ #define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ #define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */ #define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */ -#define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */ #define SC_COMP_RUN 0x00001000 /* compressor has been inited */ #define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */ #define SC_DEBUG 0x00010000 /* enable debug messages */ @@ -73,12 +72,9 @@ #define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ #define SC_LOG_RAWIN 0x00080000 /* log all chars received */ #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ -#define SC_MASK 0x0fE0ffff /* bits that user can change */ +#define SC_MASK 0x0f0000ff /* bits that user can change */ /* state bits */ -#define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */ -#define SC_FLUSH 0x40000000 /* flush input until next PPP_FLAG */ -#define SC_VJ_RESET 0x20000000 /* Need to reset the VJ decompressor */ #define SC_XMIT_BUSY 0x10000000 /* ppp_write_wakeup is active */ #define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ #define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ diff --git a/linux/if_ppp.h b/linux/if_ppp.h index 1f59f7d..9dc6041 100644 --- a/linux/if_ppp.h +++ b/linux/if_ppp.h @@ -1,4 +1,4 @@ -/* From: if_ppp.h,v 1.3 1995/06/12 11:36:50 paulus Exp */ +/* $Id: if_ppp.h,v 1.11 1998/03/24 23:54:58 paulus Exp $ */ /* * if_ppp.h - Point-to-Point Protocol definitions. @@ -65,7 +65,6 @@ #define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ #define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */ #define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */ -#define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */ #define SC_COMP_RUN 0x00001000 /* compressor has been inited */ #define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */ #define SC_DEBUG 0x00010000 /* enable debug messages */ @@ -73,12 +72,9 @@ #define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ #define SC_LOG_RAWIN 0x00080000 /* log all chars received */ #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ -#define SC_MASK 0x0fE0ffff /* bits that user can change */ +#define SC_MASK 0x0f0000ff /* bits that user can change */ /* state bits */ -#define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */ -#define SC_FLUSH 0x40000000 /* flush input until next PPP_FLAG */ -#define SC_VJ_RESET 0x20000000 /* Need to reset the VJ decompressor */ #define SC_XMIT_BUSY 0x10000000 /* ppp_write_wakeup is active */ #define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ #define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ diff --git a/linux/ppp.c b/linux/ppp.c index e28caa3..aa7af25 100644 --- a/linux/ppp.c +++ b/linux/ppp.c @@ -48,7 +48,7 @@ #define CHECK_CHARACTERS 1 #define PPP_COMPRESS 1 -/* $Id: ppp.c,v 1.16 1998/03/19 05:02:17 paulus Exp $ */ +/* $Id: ppp.c,v 1.17 1998/03/24 23:54:59 paulus Exp $ */ #include #include /* for CONFIG_KERNELD */ @@ -1459,6 +1459,10 @@ ppp_doframe (struct ppp *ppp) (*ppp->sc_rcomp->incomp) (ppp->sc_rc_state, data, count); } + } else if (proto == PPP_COMP && (ppp->flags & SC_DEBUG)) { + printk(KERN_DEBUG "ppp: frame not decompressed: " + "flags=%x, count=%d, sc_rc_state=%p\n", + ppp->flags, count, ppp->sc_rc_state); } /* * Process the uncompressed frame. @@ -1796,6 +1800,9 @@ static void ppp_proto_ccp (struct ppp *ppp, __u8 *dp, int len, int rcvd) } break; } + if (ppp->flags & SC_DEBUG) + printk(KERN_DEBUG "ppp_proto_ccp: %s code %d, flags=%x\n", + (rcvd? "rcvd": "sent"), CCP_CODE(dp), ppp->flags); restore_flags(flags); } @@ -2289,7 +2296,7 @@ out_free: } /* - * Process the BSD compression IOCTL event for the tty device. + * Process the set-compression ioctl. */ static int @@ -2323,7 +2330,7 @@ ppp_set_compression (struct ppp *ppp, struct ppp_option_data *odp) save_flags(flags); cli(); - ppp->flags &= ~(SC_COMP_RUN | SC_DECOMP_RUN); + ppp->flags &= ~(data.transmit? SC_COMP_RUN: SC_DECOMP_RUN); restore_flags(flags); cp = find_compressor (ccp_option[0]); @@ -2391,8 +2398,9 @@ ppp_tty_ioctl (struct tty_struct *tty, struct file * file, unsigned int param2, unsigned long param3) { struct ppp *ppp = tty2ppp (tty); - register int temp_i = 0; + register int temp_i = 0, oldflags; int error = 0; + unsigned long flags; /* * Verify the status of the PPP device. */ @@ -2442,16 +2450,18 @@ ppp_tty_ioctl (struct tty_struct *tty, struct file * file, if (error != 0) break; temp_i &= SC_MASK; - temp_i |= (ppp->flags & ~SC_MASK); - if ((ppp->flags & SC_CCP_OPEN) && - (temp_i & SC_CCP_OPEN) == 0) - ppp_ccp_closed (ppp); + if ((ppp->flags & SC_CCP_OPEN) && (temp_i & SC_CCP_OPEN) == 0) + ppp_ccp_closed(ppp); - if ((ppp->flags | temp_i) & SC_DEBUG) + save_flags(flags); + cli(); + oldflags = ppp->flags; + ppp->flags = temp_i |= (ppp->flags & ~SC_MASK); + restore_flags(flags); + if ((oldflags | temp_i) & SC_DEBUG) printk (KERN_INFO "ppp_tty_ioctl: set flags to %x\n", temp_i); - ppp->flags = temp_i; break; /* * Set the compression mode diff --git a/linux/ppp_deflate.c b/linux/ppp_deflate.c index e1e6ff4..a812eea 100644 --- a/linux/ppp_deflate.c +++ b/linux/ppp_deflate.c @@ -3,7 +3,7 @@ * * ppp_deflate.c - interface the zlib procedures for Deflate compression * and decompression (as used by gzip) to the PPP code. - * This version is for use with Linux kernel 1.3.X. + * This version is for use with Linux kernel 1.3.X and later. * * Copyright (c) 1994 The Australian National University. * All rights reserved. @@ -554,8 +554,12 @@ z_decompress(arg, ibuf, isize, obuf, osize) } } - if (decode_proto) + if (decode_proto) { + if (state->debug) + printk(KERN_DEBUG "z_decompress%d: didn't get proto\n", + state->unit); return DECOMP_ERROR; + } olen = osize + overflow - state->strm.avail_out; state->stats.unc_bytes += olen; -- 2.39.2