Update to ppp-2.3b5

This commit is contained in:
christos 1997-05-17 21:11:59 +00:00
parent 7a128d9be1
commit cf463415ec
10 changed files with 95 additions and 49 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ppp.c,v 1.38 1997/04/16 12:54:42 is Exp $ */
/* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */
/* Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp */
/*
@ -234,7 +234,7 @@ pppalloc(pid)
MALLOC(sc->sc_comp, struct slcompress *, sizeof(struct slcompress),
M_DEVBUF, M_NOWAIT);
if (sc->sc_comp)
sl_compress_init(sc->sc_comp, -1);
sl_compress_init(sc->sc_comp);
#endif
#ifdef PPP_COMPRESS
sc->sc_xc_state = NULL;
@ -383,7 +383,7 @@ pppioctl(sc, cmd, data, flag, p)
return (error);
if (sc->sc_comp) {
s = splsoftnet();
sl_compress_init(sc->sc_comp, *(int *)data);
sl_compress_init(sc->sc_comp);
splx(s);
}
break;

View File

@ -1,5 +1,5 @@
/* $NetBSD: if_ppp.h,v 1.13 1997/04/16 12:54:43 is Exp $ */
/* Id: if_ppp.h,v 1.15 1997/03/04 03:32:26 paulus Exp */
/* $NetBSD: if_ppp.h,v 1.14 1997/05/17 21:12:02 christos Exp $ */
/* Id: if_ppp.h,v 1.16 1997/04/30 05:46:04 paulus Exp */
/*
* if_ppp.h - Point-to-Point Protocol definitions.
@ -23,12 +23,6 @@
#ifndef _IF_PPP_H_
#define _IF_PPP_H_
/*
* Packet sizes
*/
#define PPP_MTU 1500 /* Default MTU (size of Info field) */
#define PPP_MAXMRU 65000 /* Largest MRU we allow */
/*
* Bit definitions for flags.
*/
@ -135,7 +129,5 @@ struct ifpppcstatsreq {
#if defined(_KERNEL) || defined(KERNEL)
void pppattach __P((void));
void pppintr __P((void));
int pppoutput __P((struct ifnet *, struct mbuf *,
struct sockaddr *, struct rtentry *));
#endif
#endif /* _IF_PPP_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_pppvar.h,v 1.6 1997/03/12 20:26:54 christos Exp $ */
/* $NetBSD: if_pppvar.h,v 1.7 1997/05/17 21:12:03 christos Exp $ */
/* Id: if_pppvar.h,v 1.3 1996/07/01 01:04:37 paulus Exp */
/*
@ -110,4 +110,6 @@ int pppioctl __P((struct ppp_softc *sc, u_long cmd, caddr_t data,
void ppp_restart __P((struct ppp_softc *sc));
void ppppktin __P((struct ppp_softc *sc, struct mbuf *m, int lost));
struct mbuf *ppp_dequeue __P((struct ppp_softc *sc));
int pppoutput __P((struct ifnet *, struct mbuf *,
struct sockaddr *, struct rtentry *));
#endif /* _KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_sl.c,v 1.45 1997/03/27 20:36:14 thorpej Exp $ */
/* $NetBSD: if_sl.c,v 1.46 1997/05/17 21:12:05 christos Exp $ */
/*
* Copyright (c) 1987, 1989, 1992, 1993
@ -240,7 +240,7 @@ slinit(sc)
}
sc->sc_buf = sc->sc_ep - SLMAX;
sc->sc_mp = sc->sc_buf;
sl_compress_init(&sc->sc_comp, -1);
sl_compress_init(&sc->sc_comp);
return (1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ppp-deflate.c,v 1.4 1997/03/12 20:26:56 christos Exp $ */
/* $NetBSD: ppp-deflate.c,v 1.5 1997/05/17 21:12:06 christos Exp $ */
/* Id: ppp-deflate.c,v 1.5 1997/03/04 03:33:28 paulus Exp */
/*
@ -149,6 +149,7 @@ z_comp_alloc(options, opt_len)
state->strm.next_in = NULL;
state->strm.zalloc = zalloc;
state->strm.zalloc_init = zalloc;
state->strm.zfree = zfree;
if (deflateInit2(&state->strm, Z_DEFAULT_COMPRESSION, DEFLATE_METHOD_VAL,
-w_size, 8, Z_DEFAULT_STRATEGY, DEFLATE_OVHD+2) != Z_OK) {
@ -380,6 +381,7 @@ z_decomp_alloc(options, opt_len)
state->strm.next_out = NULL;
state->strm.zalloc = zalloc;
state->strm.zalloc_init = zalloc;
state->strm.zfree = zfree;
if (inflateInit2(&state->strm, -w_size) != Z_OK) {
FREE(state, M_DEVBUF);

View File

@ -1,5 +1,5 @@
/* $NetBSD: ppp_defs.h,v 1.2 1997/03/12 20:26:59 christos Exp $ */
/* Id: ppp_defs.h,v 1.10 1997/03/04 03:32:37 paulus Exp */
/* $NetBSD: ppp_defs.h,v 1.3 1997/05/17 21:12:08 christos Exp $ */
/* Id: ppp_defs.h,v 1.11 1997/04/30 05:46:24 paulus Exp */
/*
* ppp_defs.h - PPP definitions.
@ -36,7 +36,21 @@
*/
#define PPP_HDRLEN 4 /* octets for standard ppp header */
#define PPP_FCSLEN 2 /* octets for FCS */
/*
* Packet sizes
*
* Note - lcp shouldn't be allowed to negotiate stuff outside these
* limits. See lcp.h in the pppd directory.
* (XXX - these constants should simply be shared by lcp.c instead
* of living in lcp.h)
*/
#define PPP_MTU 1500 /* Default MTU (size of Info field) */
#define PPP_MAXMTU 65535 - (PPP_HDRLEN + PPP_FCSLEN)
#define PPP_MINMTU 64
#define PPP_MRU 1500 /* default MRU = max length of info field */
#define PPP_MAXMRU 65000 /* Largest MRU we allow */
#define PPP_MINMRU 128
#define PPP_ADDRESS(p) (((u_char *)(p))[0])
#define PPP_CONTROL(p) (((u_char *)(p))[1])

View File

@ -1,4 +1,4 @@
/* $NetBSD: slcompress.c,v 1.16 1997/03/12 20:27:03 christos Exp $ */
/* $NetBSD: slcompress.c,v 1.17 1997/05/17 21:12:10 christos Exp $ */
/* Id: slcompress.c,v 1.3 1996/05/24 07:04:47 paulus Exp */
/*
@ -67,10 +67,36 @@
#define ovbcopy bcopy
#endif
void
sl_compress_init(comp, max_state)
sl_compress_init(comp)
struct slcompress *comp;
int max_state;
{
register u_int i;
register struct cstate *tstate = comp->tstate;
bzero((char *)comp, sizeof(*comp));
for (i = MAX_STATES - 1; i > 0; --i) {
tstate[i].cs_id = i;
tstate[i].cs_next = &tstate[i - 1];
}
tstate[0].cs_next = &tstate[MAX_STATES - 1];
tstate[0].cs_id = 0;
comp->last_cs = &tstate[0];
comp->last_recv = 255;
comp->last_xmit = 255;
comp->flags = SLF_TOSS;
}
/*
* Like sl_compress_init, but we get to specify the maximum connection
* ID to use on transmission.
*/
void
sl_compress_setup(comp, max_state)
struct slcompress *comp;
int max_state;
{
register u_int i;
register struct cstate *tstate = comp->tstate;

View File

@ -1,5 +1,5 @@
/* $NetBSD: slcompress.h,v 1.10 1997/03/12 20:27:05 christos Exp $ */
/* Id: slcompress.h,v 1.1 1995/12/11 05:17:12 paulus Exp */
/* $NetBSD: slcompress.h,v 1.11 1997/05/17 21:12:11 christos Exp $ */
/* Id: slcompress.h,v 1.4 1994/09/21 06:50:08 paulus Exp */
/*
* Copyright (c) 1989, 1993
@ -43,6 +43,9 @@
* - Initial distribution.
*/
#ifndef _SLCOMPRESS_H_
#define _SLCOMPRESS_H_
#define MAX_STATES 16 /* must be > 2 and < 256 */
#define MAX_HDR MLEN /* XXX 4bsd-ism: should really be 128 */
@ -155,9 +158,12 @@ struct slcompress {
/* flag values */
#define SLF_TOSS 1 /* tossing rcvd frames because of input err */
void sl_compress_init __P((struct slcompress *, int));
u_int sl_compress_tcp __P((struct mbuf *,
struct ip *, struct slcompress *, int));
int sl_uncompress_tcp __P((u_char **, int, u_int, struct slcompress *));
int sl_uncompress_tcp_core __P((u_char *, int, int, u_int,
struct slcompress *, u_char **, u_int *));
void sl_compress_init __P((struct slcompress *));
void sl_compress_setup __P((struct slcompress *, int));
u_int sl_compress_tcp __P((struct mbuf *,
struct ip *, struct slcompress *, int));
int sl_uncompress_tcp __P((u_char **, int, u_int, struct slcompress *));
int sl_uncompress_tcp_core __P((u_char *, int, int, u_int,
struct slcompress *, u_char **, u_int *));
#endif /* _SLCOMPRESS_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: zlib.c,v 1.5 1997/03/13 20:11:53 fvdl Exp $ */
/* $NetBSD: zlib.c,v 1.6 1997/05/17 21:12:14 christos Exp $ */
/*
* This file is derived from various .h and .c files from the zlib-0.95
@ -13,11 +13,11 @@
* - added Z_PACKET_FLUSH (see zlib.h for details)
* - added inflateIncomp
*
* Id: zlib.c,v 1.5 1997/03/04 03:26:35 paulus Exp
* Id: zlib.c,v 1.6 1997/04/30 05:41:19 paulus Exp
*/
/*
* ==FILEVERSION 960926==
* ==FILEVERSION 970421==
*
* This marker is used by the Linux installation script to determine
* whether an up-to-date version of this file is already installed.
@ -146,6 +146,8 @@ typedef uLong (*check_func) OF((uLong check, Bytef *buf, uInt len));
#define ZALLOC(strm, items, size) \
(*((strm)->zalloc))((strm)->opaque, (items), (size))
#define ZALLOC_INIT(strm, items, size) \
(*((strm)->zalloc_init))((strm)->opaque, (items), (size))
#define ZFREE(strm, addr, size) \
(*((strm)->zfree))((strm)->opaque, (voidpf)(addr), (size))
#define TRY_FREE(s, p, n) {if (p) ZFREE(s, p, n);}
@ -169,7 +171,7 @@ typedef uLong (*check_func) OF((uLong check, Bytef *buf, uInt len));
*/
/* Data type */
#define BINARY 0
#define Z_BINARY 0
#define ASCII 1
#define UNKNOWN 2
@ -242,7 +244,7 @@ typedef struct deflate_state {
int pending; /* nb of bytes in the pending buffer */
uLong adler; /* adler32 of uncompressed data */
int noheader; /* suppress zlib header and adler32 */
Byte data_type; /* UNKNOWN, BINARY or ASCII */
Byte data_type; /* UNKNOWN, Z_BINARY or ASCII */
Byte method; /* STORED (for zip only) or DEFLATED */
int minCompr; /* min size decrease for Z_FLUSH_NOSTORE */
@ -638,7 +640,7 @@ int deflateInit2 (strm, level, method, windowBits, memLevel,
windowBits < 8 || windowBits > 15 || level < 1 || level > 9) {
return Z_STREAM_ERROR;
}
s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
s = (deflate_state *) ZALLOC_INIT(strm, 1, sizeof(deflate_state));
if (s == Z_NULL) return Z_MEM_ERROR;
strm->state = (struct internal_state FAR *)s;
s->strm = strm;
@ -653,13 +655,13 @@ int deflateInit2 (strm, level, method, windowBits, memLevel,
s->hash_mask = s->hash_size - 1;
s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
s->window = (Bytef *) ZALLOC_INIT(strm, s->w_size, 2*sizeof(Byte));
s->prev = (Posf *) ZALLOC_INIT(strm, s->w_size, sizeof(Pos));
s->head = (Posf *) ZALLOC_INIT(strm, s->hash_size, sizeof(Pos));
s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 2*sizeof(ush));
s->pending_buf = (uchf *) ZALLOC_INIT(strm, s->lit_bufsize, 2*sizeof(ush));
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
s->pending_buf == Z_NULL) {
@ -690,7 +692,8 @@ int deflateReset (strm)
deflate_state *s;
if (strm == Z_NULL || strm->state == Z_NULL ||
strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR;
strm->zalloc == Z_NULL || strm->zfree == Z_NULL ||
strm->zalloc_init == Z_NULL) return Z_STREAM_ERROR;
strm->total_in = strm->total_out = 0;
strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
@ -2519,7 +2522,7 @@ local void compress_block(s, ltree, dtree)
}
/* ===========================================================================
* Set the data type to ASCII or BINARY, using a crude approximation:
* Set the data type to ASCII or Z_BINARY, using a crude approximation:
* binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise.
* IN assertion: the fields freq of dyn_ltree are set and the total of all
* frequencies does not exceed 64K (to fit in an int on 16 bit machines).
@ -2533,7 +2536,7 @@ local void set_data_type(s)
while (n < 7) bin_freq += s->dyn_ltree[n++].Freq;
while (n < 128) ascii_freq += s->dyn_ltree[n++].Freq;
while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq;
s->data_type = (Byte)(bin_freq > (ascii_freq >> 2) ? BINARY : ASCII);
s->data_type = (Byte)(bin_freq > (ascii_freq >> 2) ? Z_BINARY : ASCII);
}
/* ===========================================================================
@ -2832,7 +2835,7 @@ int w;
/* if (z->zalloc == Z_NULL) z->zalloc = zcalloc; */
/* if (z->zfree == Z_NULL) z->zfree = zcfree; */
if ((z->state = (struct internal_state FAR *)
ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL)
ZALLOC_INIT(z,1,sizeof(struct internal_state))) == Z_NULL)
return Z_MEM_ERROR;
z->state->blocks = Z_NULL;
@ -3260,10 +3263,10 @@ uInt w;
{
inflate_blocks_statef *s;
if ((s = (inflate_blocks_statef *)ZALLOC
if ((s = (inflate_blocks_statef *)ZALLOC_INIT
(z,1,sizeof(struct inflate_blocks_state))) == Z_NULL)
return s;
if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL)
if ((s->window = (Bytef *)ZALLOC_INIT(z, 1, w)) == Z_NULL)
{
ZFREE(z, s, sizeof(struct inflate_blocks_state));
return Z_NULL;

View File

@ -1,5 +1,5 @@
/* $NetBSD: zlib.h,v 1.2 1997/03/12 20:27:11 christos Exp $ */
/* Id: zlib.h,v 1.4 1997/03/04 03:26:36 paulus Exp */
/* $NetBSD: zlib.h,v 1.3 1997/05/17 21:12:17 christos Exp $ */
/* Id: zlib.h,v 1.5 1997/04/30 05:41:20 paulus Exp */
/*
* This file is derived from zlib.h and zconf.h from the zlib-0.95
@ -9,7 +9,7 @@
*/
/*
* ==FILEVERSION 960122==
* ==FILEVERSION 970421==
*
* This marker is used by the Linux installation script to determine
* whether an up-to-date version of this file is already installed.
@ -177,6 +177,7 @@ typedef struct z_stream_s {
struct internal_state FAR *state; /* not visible by applications */
alloc_func zalloc; /* used to allocate the internal state */
alloc_func zalloc_init; /* used to allocate the internal state during initialization */
free_func zfree; /* used to free the internal state */
voidp opaque; /* private data object passed to zalloc and zfree */