X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=ultrix%2Fbsd-comp.c;h=27f3f9397088db9b389e611ffcbb8c14e20ecedd;hp=f129b3e07781afd8e08e244e97ca5d26f320946f;hb=e5ad7e3dbf232955054ee90e54cebd6ee9533a85;hpb=48fc486824e0d900f0cdbbd0a478ddc5ab33816d diff --git a/ultrix/bsd-comp.c b/ultrix/bsd-comp.c index f129b3e..27f3f93 100644 --- a/ultrix/bsd-comp.c +++ b/ultrix/bsd-comp.c @@ -40,7 +40,7 @@ /* * This version is for use with mbufs on Ultrix systems. * - * $Id: bsd-comp.c,v 1.4 1995/05/01 01:41:29 paulus Exp $ + * $Id: bsd-comp.c,v 1.8 1996/08/28 06:32:00 paulus Exp $ */ #include "../h/param.h" @@ -129,7 +129,7 @@ struct bsd_db { }; #define BSD_OVHD 2 /* BSD compress overhead/packet */ -#define BSD_INIT_BITS MIN_BSD_BITS +#define BSD_INIT_BITS BSD_MIN_BITS static void *bsd_comp_alloc __P((u_char *options, int opt_len)); static void *bsd_decomp_alloc __P((u_char *options, int opt_len)); @@ -197,6 +197,12 @@ struct compressor ppp_bsd_compress = { #define RATIO_SCALE (1<>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 */ @@ -210,7 +216,6 @@ bsd_clear(db) db->ratio = 0; db->bytes_out = 0; db->in_count = 0; - db->incomp_count = 0; db->checkpoint = CHECK_GAP; } @@ -318,7 +323,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; @@ -416,7 +421,7 @@ 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 @@ -494,7 +499,7 @@ bsd_compress(state, mret, mp, slen, maxolen) u_char *rptr, *wptr; u_char *cp_end; int olen; - struct mbuf *m, **mnp, *clp; + struct mbuf *m, *clp; #define PUTBYTE(v) { \ ++olen; \ @@ -721,7 +726,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; @@ -842,7 +846,7 @@ bsd_decompress(state, cmp, dmpp) struct mbuf *m, *dmp, *mret; int adrs, ctrl, ilen; int space, codelen, extra; - struct mbuf *last, *clp; + struct mbuf *clp; /* * Save the address/control from the PPP header