summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>1998-03-24 23:52:37 +0000
committerPaul Mackerras <paulus@samba.org>1998-03-24 23:52:37 +0000
commit4fdc878315fc1752f4cf53b3352f27f09e2b6bcb (patch)
tree081cbf851f8f6ba9f8326c3731d837730842e761 /modules
parenta33610f4d2b55eb85e302954272ce238e8bc577d (diff)
downloadppp-4fdc878315fc1752f4cf53b3352f27f09e2b6bcb.tar.gz
More debugging.
Support old draft rfc deflate number. Allow mtu + hdrlen for compressor output packet size.
Diffstat (limited to 'modules')
-rw-r--r--modules/deflate.c35
-rw-r--r--modules/ppp.c60
-rw-r--r--modules/ppp_ahdlc.c10
-rw-r--r--modules/ppp_comp.c23
4 files changed, 113 insertions, 15 deletions
diff --git a/modules/deflate.c b/modules/deflate.c
index bf1d318..f65273c 100644
--- a/modules/deflate.c
+++ b/modules/deflate.c
@@ -27,7 +27,7 @@
* 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
@@ -45,7 +45,7 @@
#ifdef __osf__
#include "zlib.h"
#else
-#include "common/zlib.h"
+#include "../common/zlib.h"
#endif
#if DO_DEFLATE
@@ -89,7 +89,7 @@ static void z_decomp_reset __P((void *state));
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 */
@@ -108,6 +108,23 @@ struct compressor ppp_deflate = {
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
/*
@@ -178,7 +195,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_DEFLATE_DRAFT)
|| options[1] != CILEN_DEFLATE
|| DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
|| options[3] != DEFLATE_CHK_SEQUENCE)
@@ -230,7 +248,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_DEFLATE_DRAFT)
|| options[1] != CILEN_DEFLATE
|| DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
|| DEFLATE_SIZE(options[2]) != state->w_size
@@ -428,7 +447,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_DEFLATE_DRAFT)
|| options[1] != CILEN_DEFLATE
|| DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
|| options[3] != DEFLATE_CHK_SEQUENCE)
@@ -477,7 +497,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_DEFLATE_DRAFT)
|| options[1] != CILEN_DEFLATE
|| DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
|| DEFLATE_SIZE(options[2]) != state->w_size
diff --git a/modules/ppp.c b/modules/ppp.c
index f386e5b..b2598f1 100644
--- a/modules/ppp.c
+++ b/modules/ppp.c
@@ -24,7 +24,7 @@
* 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 $
*/
/*
@@ -391,10 +391,12 @@ pppclose(q, flag)
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;
@@ -494,6 +496,18 @@ pppuwput(q, mp)
#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:
@@ -533,8 +547,16 @@ pppuwput(q, mp)
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));
@@ -564,11 +586,17 @@ pppuwput(q, mp)
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;
@@ -608,6 +636,10 @@ pppuwput(q, mp)
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)
@@ -625,6 +657,10 @@ pppuwput(q, mp)
/* 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)
@@ -644,6 +680,10 @@ pppuwput(q, mp)
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;
@@ -659,6 +699,10 @@ pppuwput(q, mp)
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;
@@ -681,6 +725,10 @@ pppuwput(q, mp)
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);
@@ -704,6 +752,10 @@ pppuwput(q, mp)
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)
diff --git a/modules/ppp_ahdlc.c b/modules/ppp_ahdlc.c
index 5bc8e53..c1853bb 100644
--- a/modules/ppp_ahdlc.c
+++ b/modules/ppp_ahdlc.c
@@ -24,7 +24,7 @@
* 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 $
*/
/*
@@ -225,6 +225,10 @@ ahdlc_wput(q, mp)
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 */
@@ -236,6 +240,10 @@ ahdlc_wput(q, mp)
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;
diff --git a/modules/ppp_comp.c b/modules/ppp_comp.c
index c3badd3..c4ed83e 100644
--- a/modules/ppp_comp.c
+++ b/modules/ppp_comp.c
@@ -24,7 +24,7 @@
* 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 $
*/
/*
@@ -162,7 +162,7 @@ extern task_t first_task;
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[] = {
@@ -171,6 +171,7 @@ struct compressor *ppp_compressors[] = {
#endif
#if DO_DEFLATE
&ppp_deflate,
+ &ppp_deflate_draft,
#endif
NULL
};
@@ -340,6 +341,10 @@ ppp_comp_wput(q, mp)
/* 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);
@@ -366,6 +371,10 @@ ppp_comp_wput(q, mp)
*/
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)
@@ -380,6 +389,10 @@ ppp_comp_wput(q, mp)
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)
@@ -515,6 +528,10 @@ ppp_comp_wput(q, mp)
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);
@@ -659,7 +676,7 @@ ppp_comp_wsrv(q)
&& 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;