summaryrefslogtreecommitdiffstats
path: root/sys/net/bsd_comp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/net/bsd_comp.c')
-rw-r--r--sys/net/bsd_comp.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/net/bsd_comp.c b/sys/net/bsd_comp.c
index f428501..fd649f8 100644
--- a/sys/net/bsd_comp.c
+++ b/sys/net/bsd_comp.c
@@ -40,8 +40,7 @@
/*
* This version is for use with mbufs on BSD-derived systems.
*
- * from: Id: bsd-comp.c,v 1.11 1995/07/04 03:35:11 paulus Exp
- * $Id$
+ * $Id: bsd_comp.c,v 1.6 1997/02/22 09:40:57 peter Exp $
*/
#include <sys/param.h>
@@ -194,6 +193,12 @@ struct compressor ppp_bsd_compress = {
#define RATIO_SCALE (1<<RATIO_SCALE_LOG)
#define RATIO_MAX (0x7fffffff>>RATIO_SCALE_LOG)
+static void bsd_clear __P((struct bsd_db *));
+static int bsd_check __P((struct bsd_db *));
+static void *bsd_alloc __P((u_char *, int, int));
+static int bsd_init __P((struct bsd_db *, u_char *, int, int, int, int,
+ int, int));
+
/*
* clear the dictionary
*/
@@ -207,7 +212,6 @@ bsd_clear(db)
db->ratio = 0;
db->bytes_out = 0;
db->in_count = 0;
- db->incomp_count = 0;
db->checkpoint = CHECK_GAP;
}
@@ -315,7 +319,7 @@ bsd_alloc(options, opt_len, decomp)
u_int newlen, hsize, hshift, maxmaxcode;
struct bsd_db *db;
- if (opt_len != CILEN_BSD_COMPRESS || options[0] != CI_BSD_COMPRESS
+ if (opt_len < CILEN_BSD_COMPRESS || options[0] != CI_BSD_COMPRESS
|| options[1] != CILEN_BSD_COMPRESS
|| BSD_VERSION(options[2]) != BSD_CURRENT_VERSION)
return NULL;
@@ -413,11 +417,11 @@ bsd_init(db, options, opt_len, unit, hdrlen, mru, debug, decomp)
{
int i;
- if (opt_len != CILEN_BSD_COMPRESS || options[0] != CI_BSD_COMPRESS
+ if (opt_len < CILEN_BSD_COMPRESS || options[0] != CI_BSD_COMPRESS
|| options[1] != CILEN_BSD_COMPRESS
|| BSD_VERSION(options[2]) != BSD_CURRENT_VERSION
|| BSD_NBITS(options[2]) != db->maxbits
- || decomp && db->lens == NULL)
+ || (decomp && db->lens == NULL))
return 0;
if (decomp) {
@@ -715,7 +719,6 @@ bsd_incomp(state, dmsg)
if (ent < 0x21 || ent > 0xf9)
return;
- db->incomp_count++;
db->seqno++;
ilen = 1; /* count the protocol as 1 byte */
rptr += PPP_HDRLEN;
@@ -945,7 +948,7 @@ bsd_decompress(state, cmp, dmpp)
}
if (incode > max_ent + 2 || incode > db->maxmaxcode
- || incode > max_ent && oldcode == CLEAR) {
+ || (incode > max_ent && oldcode == CLEAR)) {
m_freem(mret);
if (db->debug) {
printf("bsd_decomp%d: bad code 0x%x oldcode=0x%x ",
OpenPOWER on IntegriCloud