]> git.ozlabs.org Git - ppp.git/commitdiff
Extra debug messages; fix the bug where we were losing
authorPaul Mackerras <paulus@samba.org>
Tue, 24 Mar 1998 23:55:01 +0000 (23:55 +0000)
committerPaul Mackerras <paulus@samba.org>
Tue, 24 Mar 1998 23:55:01 +0000 (23:55 +0000)
decompression when setting the compressor.

include/linux/if_ppp.h
linux/if_ppp.h
linux/ppp.c
linux/ppp_deflate.c

index 1f59f7d618e1955263d0dc7152ecf2f4662b1934..9dc60413ded402a850af496b1ef51f7bdad2a35c 100644 (file)
@@ -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.
 
 /*
  * 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_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 */
 #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 */
 #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_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 */
 
 /* 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 */
 #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 */
index 1f59f7d618e1955263d0dc7152ecf2f4662b1934..9dc60413ded402a850af496b1ef51f7bdad2a35c 100644 (file)
@@ -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.
 
 /*
  * 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_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 */
 #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 */
 #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_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 */
 
 /* 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 */
 #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 */
index e28caa3e7e0a37b31f64571754df921154e64d1f..aa7af25d8d6187a67e1abfa8bc4732076f8c09a2 100644 (file)
@@ -48,7 +48,7 @@
 #define CHECK_CHARACTERS       1
 #define PPP_COMPRESS           1
 
 #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 <linux/version.h>
 #include <linux/config.h> /* for CONFIG_KERNELD */
 
 #include <linux/version.h>
 #include <linux/config.h> /* for CONFIG_KERNELD */
@@ -1459,6 +1459,10 @@ ppp_doframe (struct ppp *ppp)
                        (*ppp->sc_rcomp->incomp) (ppp->sc_rc_state,
                                                  data, count);
                }
                        (*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.
        }
 /*
  * Process the uncompressed frame.
@@ -1796,6 +1800,9 @@ static void ppp_proto_ccp (struct ppp *ppp, __u8 *dp, int len, int rcvd)
                }
                break;
        }
                }
                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);
 }
 
        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
  */
 
 static int
@@ -2323,7 +2330,7 @@ ppp_set_compression (struct ppp *ppp, struct ppp_option_data *odp)
 
        save_flags(flags);
        cli();
 
        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]);
        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);
                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;
        int error = 0;
+       unsigned long flags;
 /*
  * Verify the status of the PPP device.
  */
 /*
  * 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;
                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);
                        printk (KERN_INFO
                                "ppp_tty_ioctl: set flags to %x\n", temp_i);
-               ppp->flags = temp_i;
                break;
 /*
  * Set the compression mode
                break;
 /*
  * Set the compression mode
index e1e6ff4668c015adce873ab13986c86f9c040516..a812eea6ca559baea32986eba8244cb9bfd2f50e 100644 (file)
@@ -3,7 +3,7 @@
  *
  * ppp_deflate.c - interface the zlib procedures for Deflate compression
  * and decompression (as used by gzip) to the PPP code.
  *
  * 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.
  *
  * 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;
                return DECOMP_ERROR;
+       }
 
        olen = osize + overflow - state->strm.avail_out;
        state->stats.unc_bytes += olen;
 
        olen = osize + overflow - state->strm.avail_out;
        state->stats.unc_bytes += olen;