Support old draft rfc deflate number.
Allow mtu + hdrlen for compressor output packet size.
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
* OR MODIFICATIONS.
*
- * $Id: deflate.c,v 1.7 1997/11/27 06:25:19 paulus Exp $
+ * $Id: deflate.c,v 1.8 1998/03/24 23:52:31 paulus Exp $
*/
#ifdef AIX4
#ifdef __osf__
#include "zlib.h"
#else
-#include "common/zlib.h"
+#include "../common/zlib.h"
#endif
#if DO_DEFLATE
static void z_comp_stats __P((void *state, struct compstat *stats));
/*
- * Procedures exported to if_ppp.c.
+ * Procedures exported to ppp_comp.c.
*/
struct compressor ppp_deflate = {
CI_DEFLATE, /* compress_proto */
z_comp_stats, /* decomp_stat */
};
+struct compressor ppp_deflate_draft = {
+ CI_DEFLATE_DRAFT, /* 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 */
+};
+
#define DECOMP_CHUNK 512
/*
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_DEFLATE_DRAFT)
|| options[1] != CILEN_DEFLATE
|| DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
|| options[3] != DEFLATE_CHK_SEQUENCE)
{
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_DEFLATE_DRAFT)
|| options[1] != CILEN_DEFLATE
|| DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
|| DEFLATE_SIZE(options[2]) != state->w_size
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_DEFLATE_DRAFT)
|| options[1] != CILEN_DEFLATE
|| DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
|| options[3] != DEFLATE_CHK_SEQUENCE)
{
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_DEFLATE_DRAFT)
|| options[1] != CILEN_DEFLATE
|| DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
|| DEFLATE_SIZE(options[2]) != state->w_size
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
* OR MODIFICATIONS.
*
- * $Id: ppp.c,v 1.13 1997/11/27 06:05:36 paulus Exp $
+ * $Id: ppp.c,v 1.14 1998/03/24 23:52:33 paulus Exp $
*/
/*
qprocsoff(q);
up = (upperstr_t *) q->q_ptr;
+ if (up == 0) {
+ DPRINT("pppclose: q_ptr = 0\n");
+ return 0;
+ }
if (up->flags & US_DBGLOG)
DPRINT2("ppp/%d: close, flags=%x\n", up->mn, up->flags);
- if (up == 0)
- return 0;
if (up->flags & US_CONTROL) {
#ifdef LACHTCP
struct ifstats *ifp, *pifp;
#endif /* PRIOQ */
us = (upperstr_t *) q->q_ptr;
+ if (us == 0) {
+ DPRINT("pppuwput: q_ptr = 0!\n");
+ return 0;
+ }
+ if (mp == 0) {
+ DPRINT1("pppuwput/%d: mp = 0!\n", us->mn);
+ return 0;
+ }
+ if (mp->b_datap == 0) {
+ DPRINT1("pppuwput/%d: mp->b_datap = 0!\n", us->mn);
+ return 0;
+ }
switch (mp->b_datap->db_type) {
#ifndef NO_DLPI
case M_PCPROTO:
case I_LINK:
if ((us->flags & US_CONTROL) == 0 || us->lowerq != 0)
break;
+ if (mp->b_cont == 0) {
+ DPRINT1("pppuwput/%d: ioctl I_LINK b_cont = 0!\n", us->mn);
+ break;
+ }
lb = (struct linkblk *) mp->b_cont->b_rptr;
us->lowerq = lq = lb->l_qbot;
+ if (lq == 0) {
+ DPRINT1("pppuwput/%d: ioctl I_LINK l_qbot = 0!\n", us->mn);
+ break;
+ }
lq->q_ptr = (caddr_t) us;
RD(lq)->q_ptr = (caddr_t) us;
noenable(RD(lq));
break;
case I_UNLINK:
+ if (mp->b_cont == 0) {
+ DPRINT1("pppuwput/%d: ioctl I_UNLINK b_cont = 0!\n", us->mn);
+ break;
+ }
lb = (struct linkblk *) mp->b_cont->b_rptr;
#if DEBUG
- if (us->lowerq != lb->l_qbot)
+ if (us->lowerq != lb->l_qbot) {
DPRINT2("ppp unlink: lowerq=%x qbot=%x\n",
us->lowerq, lb->l_qbot);
+ break;
+ }
#endif
us->lowerq = 0;
iop->ioc_count = 0;
the stream (like pppstats) */
if (iop->ioc_count != sizeof(int) || us->ppa != 0)
break;
+ if (mp->b_cont == 0) {
+ DPRINT1("pppuwput/%d: ioctl PPPIO_ATTACH b_cont = 0!\n", us->mn);
+ break;
+ }
n = *(int *)mp->b_cont->b_rptr;
for (ppa = ppas; ppa != 0; ppa = ppa->nextppa)
if (ppa->ppa_id == n)
/* Attach to a given SAP. */
if (iop->ioc_count != sizeof(int) || us->ppa == 0)
break;
+ if (mp->b_cont == 0) {
+ DPRINT1("pppuwput/%d: ioctl PPPIO_BIND b_cont = 0!\n", us->mn);
+ break;
+ }
n = *(int *)mp->b_cont->b_rptr;
/* n must be a valid PPP network protocol number. */
if (n < 0x21 || n > 0x3fff || (n & 0x101) != 1)
case PPPIO_MRU:
if (iop->ioc_count != sizeof(int) || (us->flags & US_CONTROL) == 0)
break;
+ if (mp->b_cont == 0) {
+ DPRINT1("pppuwput/%d: ioctl PPPIO_MRU b_cont = 0!\n", us->mn);
+ break;
+ }
n = *(int *)mp->b_cont->b_rptr;
if (n <= 0 || n > PPP_MAXMRU)
break;
case PPPIO_MTU:
if (iop->ioc_count != sizeof(int) || (us->flags & US_CONTROL) == 0)
break;
+ if (mp->b_cont == 0) {
+ DPRINT1("pppuwput/%d: ioctl PPPIO_MTU b_cont = 0!\n", us->mn);
+ break;
+ }
n = *(int *)mp->b_cont->b_rptr;
if (n <= 0 || n > PPP_MAXMTU)
break;
case PPPIO_DEBUG:
if (iop->ioc_count != sizeof(int))
break;
+ if (mp->b_cont == 0) {
+ DPRINT1("pppuwput/%d: ioctl PPPIO_DEBUG b_cont = 0!\n", us->mn);
+ break;
+ }
n = *(int *)mp->b_cont->b_rptr;
if (n == PPPDBG_DUMP + PPPDBG_DRIVER) {
qwriter(q, NULL, debug_dump, PERIM_OUTER);
break;
if ((us->flags & US_CONTROL) == 0)
break;
+ if (mp->b_cont == 0) {
+ DPRINT1("pppuwput/%d: ioctl PPPIO_NPMODE b_cont = 0!\n", us->mn);
+ break;
+ }
sap = ((int *)mp->b_cont->b_rptr)[0];
for (nps = us->next; nps != 0; nps = nps->next)
if (nps->sap == sap)
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
* OR MODIFICATIONS.
*
- * $Id: ppp_ahdlc.c,v 1.6 1997/04/30 05:44:58 paulus Exp $
+ * $Id: ppp_ahdlc.c,v 1.7 1998/03/24 23:52:35 paulus Exp $
*/
/*
if (iop->ioc_count < sizeof(u_int32_t)
|| iop->ioc_count > sizeof(ext_accm))
break;
+ if (mp->b_cont == 0) {
+ DPRINT1("ahdlc_wput/%d: PPPIO_XACCM b_cont = 0!\n", state->unit);
+ break;
+ }
bcopy((caddr_t)mp->b_cont->b_rptr, (caddr_t)state->xaccm,
iop->ioc_count);
state->xaccm[2] &= ~0x40000000; /* don't escape 0x5e */
case PPPIO_RACCM:
if (iop->ioc_count != sizeof(u_int32_t))
break;
+ if (mp->b_cont == 0) {
+ DPRINT1("ahdlc_wput/%d: PPPIO_RACCM b_cont = 0!\n", state->unit);
+ break;
+ }
bcopy((caddr_t)mp->b_cont->b_rptr, (caddr_t)&state->raccm,
sizeof(u_int32_t));
iop->ioc_count = 0;
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
* OR MODIFICATIONS.
*
- * $Id: ppp_comp.c,v 1.8 1997/04/30 05:45:15 paulus Exp $
+ * $Id: ppp_comp.c,v 1.9 1998/03/24 23:52:37 paulus Exp $
*/
/*
extern struct compressor ppp_bsd_compress;
#endif
#if DO_DEFLATE
-extern struct compressor ppp_deflate;
+extern struct compressor ppp_deflate, ppp_deflate_draft;
#endif
struct compressor *ppp_compressors[] = {
#endif
#if DO_DEFLATE
&ppp_deflate,
+ &ppp_deflate_draft,
#endif
NULL
};
/* set/get CCP state */
if (iop->ioc_count != 2 * sizeof(int))
break;
+ if (mp->b_cont == 0) {
+ DPRINT1("ppp_comp_wput/%d: PPPIO_CFLAGS b_cont = 0!\n", cp->unit);
+ break;
+ }
flags = ((int *) mp->b_cont->b_rptr)[0];
mask = ((int *) mp->b_cont->b_rptr)[1];
cp->flags = (cp->flags & ~mask) | (flags & mask);
*/
if (iop->ioc_count != 2)
break;
+ if (mp->b_cont == 0) {
+ DPRINT1("ppp_comp_wput/%d: PPPIO_VJINIT b_cont = 0!\n", cp->unit);
+ break;
+ }
nxslots = mp->b_cont->b_rptr[0] + 1;
nrslots = mp->b_cont->b_rptr[1] + 1;
if (nxslots > MAX_STATES || nrslots > MAX_STATES)
case PPPIO_RCOMP:
if (iop->ioc_count <= 0)
break;
+ if (mp->b_cont == 0) {
+ DPRINT1("ppp_comp_wput/%d: PPPIO_[XR]COMP b_cont = 0!\n", cp->unit);
+ break;
+ }
opt_data = mp->b_cont->b_rptr;
len = mp->b_cont->b_wptr - opt_data;
if (len > iop->ioc_count)
case PPPIO_DEBUG:
if (iop->ioc_count != sizeof(int))
break;
+ if (mp->b_cont == 0) {
+ DPRINT1("ppp_comp_wput/%d: PPPIO_DEBUG b_cont = 0!\n", cp->unit);
+ break;
+ }
n = *(int *)mp->b_cont->b_rptr;
if (n == PPPDBG_LOG + PPPDBG_COMP) {
DPRINT1("ppp_comp%d: debug log enabled\n", cp->unit);
&& cp->xstate != NULL) {
len = msgdsize(mp);
(*cp->xcomp->compress)(cp->xstate, &cmp, mp, len,
- (cp->flags & CCP_ISUP? cp->mtu: 0));
+ (cp->flags & CCP_ISUP? cp->mtu + PPP_HDRLEN: 0));
if (cmp != NULL) {
#ifdef PRIOQ
cmp->b_band=mp->b_band;