ppp-2.3.x ships with a bad compression number for deflate. It uses number

24 (which is magnalink!) rather than the correct 26.

Initial attempt at a compatability kludge that will negotiate for either
but will prefer to use the correct deflate compression type.
This commit is contained in:
Peter Wemm 1998-03-22 06:51:57 +00:00
parent 1ceb7f1f59
commit 880dcadfce
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=34774
3 changed files with 40 additions and 8 deletions

View File

@ -69,7 +69,7 @@
* Paul Mackerras (paulus@cs.anu.edu.au).
*/
/* $Id: if_ppp.c,v 1.52 1997/12/15 20:31:04 eivind Exp $ */
/* $Id: if_ppp.c,v 1.53 1998/01/08 23:41:28 eivind Exp $ */
/* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */
/* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */
@ -182,6 +182,9 @@ static void pppdumpm __P((struct mbuf *m0));
extern struct compressor ppp_bsd_compress;
extern struct compressor ppp_deflate;
#ifdef CI_BADDEFLATE
extern struct compressor ppp_baddeflate;
#endif
static struct compressor *ppp_compressors[8] = {
#if DO_BSD_COMPRESS && defined(PPP_BSDCOMP)
@ -189,6 +192,9 @@ static struct compressor *ppp_compressors[8] = {
#endif
#if DO_DEFLATE && defined(PPP_DEFLATE)
&ppp_deflate,
#ifdef CI_BADDEFLATE
&ppp_baddeflate,
#endif
#endif
NULL
};

View File

@ -24,7 +24,7 @@
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
* OR MODIFICATIONS.
*
* $Id: ppp_comp.h,v 1.4 1997/02/22 09:41:11 peter Exp $
* $Id: ppp_comp.h,v 1.5 1997/08/19 14:10:46 peter Exp $
*/
#ifndef _NET_PPP_COMP_H
@ -141,7 +141,9 @@ struct compressor {
/*
* Definitions for Deflate.
*/
#define CI_DEFLATE 24 /* config option for Deflate */
#define CI_DEFLATE 26 /* config option for Deflate */
/* XXX ppp-2.3.x ships with CI_DEFLATE == 24, but that's Magnalink!! */
#define CI_BADDEFLATE 24 /* config option for Magnalink */
#define CILEN_DEFLATE 4 /* length of its config option */
#define DEFLATE_MIN_SIZE 8

View File

@ -1,4 +1,4 @@
/* $Id: ppp_deflate.c,v 1.6 1997/10/28 15:58:32 bde Exp $ */
/* $Id: ppp_deflate.c,v 1.7 1998/03/21 20:56:14 peter Exp $ */
/*
* ppp_deflate.c - interface the zlib procedures for Deflate compression
@ -97,6 +97,26 @@ struct compressor ppp_deflate = {
z_incomp, /* incomp */
z_comp_stats, /* decomp_stat */
};
#ifdef CI_BADDEFLATE
struct compressor ppp_baddeflate = {
CI_BADDEFLATE, /* compress_proto */
z_comp_alloc, /* comp_alloc */
z_comp_free, /* comp_free */
z_comp_init, /* comp_init */
z_comp_reset, /* comp_reset */
z_compress, /* compress */
z_comp_stats, /* comp_stat */
z_decomp_alloc, /* decomp_alloc */
z_decomp_free, /* decomp_free */
z_decomp_init, /* decomp_init */
z_decomp_reset, /* decomp_reset */
z_decompress, /* decompress */
z_incomp, /* incomp */
z_comp_stats, /* decomp_stat */
};
#else
#define CI_BADDEFLATE CI_DEFLATE /* reduce #ifdef's, let gcc optimize */
#endif
/*
* Space allocation and freeing routines for use by zlib routines.
@ -131,7 +151,8 @@ z_comp_alloc(options, opt_len)
struct deflate_state *state;
int w_size;
if (opt_len != CILEN_DEFLATE || options[0] != CI_DEFLATE
if (opt_len != CILEN_DEFLATE
|| (options[0] != CI_DEFLATE && options[0] != CI_BADDEFLATE)
|| options[1] != CILEN_DEFLATE
|| DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
|| options[3] != DEFLATE_CHK_SEQUENCE)
@ -177,7 +198,8 @@ z_comp_init(arg, options, opt_len, unit, hdrlen, debug)
{
struct deflate_state *state = (struct deflate_state *) arg;
if (opt_len < CILEN_DEFLATE || options[0] != CI_DEFLATE
if (opt_len < CILEN_DEFLATE
|| (options[0] != CI_DEFLATE && options[0] != CI_BADDEFLATE)
|| options[1] != CILEN_DEFLATE
|| DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
|| DEFLATE_SIZE(options[2]) != state->w_size
@ -362,7 +384,8 @@ z_decomp_alloc(options, opt_len)
struct deflate_state *state;
int w_size;
if (opt_len != CILEN_DEFLATE || options[0] != CI_DEFLATE
if (opt_len != CILEN_DEFLATE
|| (options[0] != CI_DEFLATE && options[0] != CI_BADDEFLATE)
|| options[1] != CILEN_DEFLATE
|| DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
|| options[3] != DEFLATE_CHK_SEQUENCE)
@ -407,7 +430,8 @@ z_decomp_init(arg, options, opt_len, unit, hdrlen, mru, debug)
{
struct deflate_state *state = (struct deflate_state *) arg;
if (opt_len < CILEN_DEFLATE || options[0] != CI_DEFLATE
if (opt_len < CILEN_DEFLATE
|| (options[0] != CI_DEFLATE && options[0] != CI_BADDEFLATE)
|| options[1] != CILEN_DEFLATE
|| DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
|| DEFLATE_SIZE(options[2]) != state->w_size