summaryrefslogtreecommitdiffstats
path: root/sys/net/bsd_comp.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-08-19 14:10:50 +0000
committerpeter <peter@FreeBSD.org>1997-08-19 14:10:50 +0000
commit3970ef27019843920c6306bec80d164f8eee7e82 (patch)
tree34b2d5bc6895d2f3fc3464536dd15f5c6286c76f /sys/net/bsd_comp.c
parent813bc0386ea8626c9016862d4d8013c749e44ff6 (diff)
downloadFreeBSD-src-3970ef27019843920c6306bec80d164f8eee7e82.zip
FreeBSD-src-3970ef27019843920c6306bec80d164f8eee7e82.tar.gz
Update kernel parts of pppd from 2.2.0 to 2.3.0. I've yet to look at the
2.3.0 -> 2.3.1 changes, but I seem to recall that there are certain "issues" with 2.3.1 (I'm not sure if it's just pppd or the whole lot, I am not quite that far). The present pppd seems to work with it just fine for the time being. Among the changes are that zlib (aka LZ77 aka deflate aka gzip) compression is implemented as well as the original compress(1) LZW style.
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