diff options
author | brian <brian@cvs.openbsd.org> | 1999-06-02 15:58:42 +0000 |
---|---|---|
committer | brian <brian@cvs.openbsd.org> | 1999-06-02 15:58:42 +0000 |
commit | 23e83cb3a630024238a77045b226ee85ab700beb (patch) | |
tree | da0a7602405c42a46f76fcd1de75a38c329aa697 /usr.sbin | |
parent | f0c75442594776fa060b3d9bce9515a2241093ef (diff) |
o Alter the mbuf type as it's processed by different layers.
o Show more information about missing MP fragments in ``show mp''.
o Do away with mbuf_Log(). It was showing mbuf stats twice on
receipt of LCP/CCP/IPCP packets.... ???!!?
o Pre-allocate a bit extra when creating LQR packets to avoid having
to allocate another mbuf in mbuf_Prepend().
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ppp/ppp/acf.c | 8 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/alias_cmd.c | 9 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/async.c | 6 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/cbcp.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/ccp.c | 43 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/chap.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/deflate.c | 14 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/fsm.c | 31 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/fsm.h | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/hdlc.c | 8 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/ip.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/ipcp.c | 8 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/lcp.c | 11 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/link.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/lqr.c | 27 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/mbuf.c | 53 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/mbuf.h | 55 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/mp.c | 31 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/pap.c | 7 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/pred.c | 6 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/proto.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/sync.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/vjcomp.c | 10 |
23 files changed, 236 insertions, 123 deletions
diff --git a/usr.sbin/ppp/ppp/acf.c b/usr.sbin/ppp/ppp/acf.c index d6fa46f2040..4dc1f1c50ab 100644 --- a/usr.sbin/ppp/ppp/acf.c +++ b/usr.sbin/ppp/ppp/acf.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: acf.c,v 1.1 1999/05/08 11:06:32 brian Exp $ + * $Id: acf.c,v 1.2 1999/06/02 15:58:39 brian Exp $ */ #include <sys/types.h> @@ -61,8 +61,10 @@ acf_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp, { const u_char cp[2] = { HDLC_ADDR, HDLC_UI }; - if (*proto == PROTO_LCP || l->lcp.his_acfcomp == 0) + if (*proto == PROTO_LCP || l->lcp.his_acfcomp == 0) { bp = mbuf_Prepend(bp, cp, 2, 0); + mbuf_SetType(bp, MB_ACFOUT); + } return bp; } @@ -96,12 +98,14 @@ acf_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, u_short *proto) mbuf_Free(bp); return NULL; } + mbuf_SetType(bp, MB_ACFIN); } else if (cp[0] == HDLC_ADDR && cp[1] == HDLC_UI) { /* * We can receive compressed packets, but the peer still sends * uncompressed packets (or maybe this is a PROTO_LCP packet) ! */ bp = mbuf_Read(bp, cp, 2); + mbuf_SetType(bp, MB_ACFIN); } } diff --git a/usr.sbin/ppp/ppp/alias_cmd.c b/usr.sbin/ppp/ppp/alias_cmd.c index 2f69e3338d8..64ac016eb3a 100644 --- a/usr.sbin/ppp/ppp/alias_cmd.c +++ b/usr.sbin/ppp/ppp/alias_cmd.c @@ -2,7 +2,7 @@ * The code in this file was written by Eivind Eklund <perhaps@yes.no>, * who places it in the public domain without restriction. * - * $Id: alias_cmd.c,v 1.8 1999/05/12 10:03:48 brian Exp $ + * $Id: alias_cmd.c,v 1.9 1999/06/02 15:58:39 brian Exp $ */ #include <sys/param.h> @@ -313,6 +313,7 @@ alias_PadMbuf(struct mbuf *bp, int type) struct mbuf **last; int len; + mbuf_SetType(bp, type); for (last = &bp, len = 0; *last != NULL; last = &(*last)->next) len += (*last)->cnt; @@ -330,7 +331,7 @@ alias_LayerPush(struct bundle *bundle, struct link *l, struct mbuf *bp, return bp; log_Printf(LogDEBUG, "alias_LayerPush: PROTO_IP -> PROTO_IP\n"); - bp = mbuf_Contiguous(alias_PadMbuf(bp, MB_IPQ)); + bp = mbuf_Contiguous(alias_PadMbuf(bp, MB_ALIASOUT)); PacketAliasOut(MBUF_CTOP(bp), bp->cnt); bp->cnt = ntohs(((struct ip *)MBUF_CTOP(bp))->ip_len); @@ -350,7 +351,7 @@ alias_LayerPull(struct bundle *bundle, struct link *l, struct mbuf *bp, return bp; log_Printf(LogDEBUG, "alias_LayerPull: PROTO_IP -> PROTO_IP\n"); - bp = mbuf_Contiguous(alias_PadMbuf(bp, MB_IPIN)); + bp = mbuf_Contiguous(alias_PadMbuf(bp, MB_ALIASIN)); pip = (struct ip *)MBUF_CTOP(bp); piip = (struct ip *)((char *)pip + (pip->ip_hl << 2)); @@ -383,7 +384,7 @@ alias_LayerPull(struct bundle *bundle, struct link *l, struct mbuf *bp, last = &bp->pnext; while ((fptr = PacketAliasGetFragment(MBUF_CTOP(bp))) != NULL) { PacketAliasFragmentIn(MBUF_CTOP(bp), fptr); - *last = mbuf_Alloc(ntohs(((struct ip *)fptr)->ip_len), MB_IPIN); + *last = mbuf_Alloc(ntohs(((struct ip *)fptr)->ip_len), MB_ALIASIN); memcpy(MBUF_CTOP(*last), fptr, (*last)->cnt); free(fptr); last = &(*last)->pnext; diff --git a/usr.sbin/ppp/ppp/async.c b/usr.sbin/ppp/ppp/async.c index 96a354954c1..2e12c5b64a0 100644 --- a/usr.sbin/ppp/ppp/async.c +++ b/usr.sbin/ppp/ppp/async.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: async.c,v 1.5 1999/05/12 10:03:48 brian Exp $ + * $Id: async.c,v 1.6 1999/06/02 15:58:40 brian Exp $ * */ #include <sys/types.h> @@ -116,7 +116,7 @@ async_LayerPush(struct bundle *bundle, struct link *l, struct mbuf *bp, cnt = cp - p->async.xbuff; mbuf_Free(bp); - bp = mbuf_Alloc(cnt, MB_ASYNC); + bp = mbuf_Alloc(cnt, MB_ASYNCOUT); memcpy(MBUF_CTOP(bp), p->async.xbuff, cnt); log_DumpBp(LogASYNC, "Write", bp); @@ -135,7 +135,7 @@ async_Decode(struct async *async, u_char c) case HDLC_SYN: async->mode &= ~MODE_HUNT; if (async->length) { /* packet is ready. */ - bp = mbuf_Alloc(async->length, MB_ASYNC); + bp = mbuf_Alloc(async->length, MB_ASYNCIN); mbuf_Write(bp, async->hbuff, async->length); async->length = 0; return bp; diff --git a/usr.sbin/ppp/ppp/cbcp.c b/usr.sbin/ppp/ppp/cbcp.c index ae1c4c10748..3f27abebd26 100644 --- a/usr.sbin/ppp/ppp/cbcp.c +++ b/usr.sbin/ppp/ppp/cbcp.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cbcp.c,v 1.8 1999/05/08 11:06:33 brian Exp $ + * $Id: cbcp.c,v 1.9 1999/06/02 15:58:40 brian Exp $ */ #include <sys/param.h> @@ -195,7 +195,7 @@ cbcp_Output(struct cbcp *cbcp, u_char code, struct cbcp_data *data) struct cbcp_header *head; struct mbuf *bp; - bp = mbuf_Alloc(sizeof *head + data->length, MB_CBCP); + bp = mbuf_Alloc(sizeof *head + data->length, MB_CBCPOUT); head = (struct cbcp_header *)MBUF_CTOP(bp); head->code = code; head->id = cbcp->fsm.id; @@ -630,6 +630,7 @@ cbcp_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) mbuf_Free(bp); return NULL; } + mbuf_SetType(bp, MB_CBCPIN); /* XXX check the id */ diff --git a/usr.sbin/ppp/ppp/ccp.c b/usr.sbin/ppp/ppp/ccp.c index c4ec9290b86..263ebdc5ff6 100644 --- a/usr.sbin/ppp/ppp/ccp.c +++ b/usr.sbin/ppp/ppp/ccp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ccp.c,v 1.9 1999/05/12 10:03:49 brian Exp $ + * $Id: ccp.c,v 1.10 1999/06/02 15:58:40 brian Exp $ * * TODO: * o Support other compression protocols @@ -282,7 +282,7 @@ CcpSendConfigReq(struct fsm *fp) o = &(*o)->next; } - fsm_Output(fp, CODE_CONFIGREQ, fp->reqid, buff, cp - buff); + fsm_Output(fp, CODE_CONFIGREQ, fp->reqid, buff, cp - buff, MB_CCPOUT); } void @@ -293,7 +293,7 @@ ccp_SendResetReq(struct fsm *fp) ccp->reset_sent = fp->reqid; ccp->last_reset = -1; - fsm_Output(fp, CODE_RESETREQ, fp->reqid, NULL, 0); + fsm_Output(fp, CODE_RESETREQ, fp->reqid, NULL, 0, MB_CCPOUT); } static void @@ -306,7 +306,7 @@ static void CcpSendTerminateAck(struct fsm *fp, u_char id) { /* Send Term ACK please */ - fsm_Output(fp, CODE_TERMACK, id, NULL, 0); + fsm_Output(fp, CODE_TERMACK, id, NULL, 0, MB_CCPOUT); } static void @@ -534,6 +534,7 @@ extern struct mbuf * ccp_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) { /* Got PROTO_CCP from link */ + mbuf_SetType(bp, MB_CCPIN); if (bundle_Phase(bundle) == PHASE_NETWORK) fsm_Input(&l->ccp.fsm, bp); else { @@ -578,9 +579,18 @@ ccp_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp, int pri, u_short *proto) { if (PROTO_COMPRESSIBLE(*proto) && l->ccp.fsm.state == ST_OPENED && - l->ccp.out.state != NULL) - return (*algorithm[l->ccp.out.algorithm]->o.Write) - (l->ccp.out.state, &l->ccp, l, pri, proto, bp); + l->ccp.out.state != NULL) { + bp = (*algorithm[l->ccp.out.algorithm]->o.Write) + (l->ccp.out.state, &l->ccp, l, pri, proto, bp); + switch (*proto) { + case PROTO_ICOMPD: + mbuf_SetType(bp, MB_ICOMPDOUT); + break; + case PROTO_COMPD: + mbuf_SetType(bp, MB_COMPDOUT); + break; + } + } return bp; } @@ -599,10 +609,21 @@ ccp_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, u_short *proto) /* Decompress incoming data */ if (l->ccp.reset_sent != -1) /* Send another REQ and put the packet in the bit bucket */ - fsm_Output(&l->ccp.fsm, CODE_RESETREQ, l->ccp.reset_sent, NULL, 0); - else if (l->ccp.in.state != NULL) - return (*algorithm[l->ccp.in.algorithm]->i.Read) - (l->ccp.in.state, &l->ccp, proto, bp); + fsm_Output(&l->ccp.fsm, CODE_RESETREQ, l->ccp.reset_sent, NULL, 0, + MB_CCPOUT); + else if (l->ccp.in.state != NULL) { + bp = (*algorithm[l->ccp.in.algorithm]->i.Read) + (l->ccp.in.state, &l->ccp, proto, bp); + switch (*proto) { + case PROTO_ICOMPD: + mbuf_SetType(bp, MB_ICOMPDIN); + break; + case PROTO_COMPD: + mbuf_SetType(bp, MB_COMPDIN); + break; + } + return bp; + } mbuf_Free(bp); bp = NULL; } else if (PROTO_COMPRESSIBLE(*proto) && l->ccp.in.state != NULL) { diff --git a/usr.sbin/ppp/ppp/chap.c b/usr.sbin/ppp/ppp/chap.c index 0c40dcdb083..7f5f509094d 100644 --- a/usr.sbin/ppp/ppp/chap.c +++ b/usr.sbin/ppp/ppp/chap.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: chap.c,v 1.12 1999/05/08 11:06:34 brian Exp $ + * $Id: chap.c,v 1.13 1999/06/02 15:58:40 brian Exp $ * * TODO: */ @@ -93,7 +93,7 @@ ChapOutput(struct physical *physical, u_int code, u_int id, lh.code = code; lh.id = id; lh.length = htons(plen); - bp = mbuf_Alloc(plen, MB_FSM); + bp = mbuf_Alloc(plen, MB_CHAPOUT); memcpy(MBUF_CTOP(bp), &lh, sizeof(struct fsmheader)); if (count) memcpy(MBUF_CTOP(bp) + sizeof(struct fsmheader), ptr, count); @@ -559,6 +559,7 @@ chap_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) return NULL; } + mbuf_SetType(bp, MB_CHAPIN); if ((bp = auth_ReadHeader(&chap->auth, bp)) == NULL && ntohs(chap->auth.in.hdr.length) == 0) log_Printf(LogWARN, "Chap Input: Truncated header !\n"); diff --git a/usr.sbin/ppp/ppp/deflate.c b/usr.sbin/ppp/ppp/deflate.c index 33aea88d8ca..84ac739afd9 100644 --- a/usr.sbin/ppp/ppp/deflate.c +++ b/usr.sbin/ppp/ppp/deflate.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: deflate.c,v 1.4 1999/05/08 11:06:34 brian Exp $ + * $Id: deflate.c,v 1.5 1999/06/02 15:58:40 brian Exp $ */ #include <sys/types.h> @@ -82,7 +82,7 @@ DeflateOutput(void *v, struct ccp *ccp, struct link *l, int pri, u_short *proto, log_DumpBp(LogDEBUG, "DeflateOutput: Compress packet:", mp); /* Stuff the protocol in front of the input */ - mi_head = mi = mbuf_Alloc(2, MB_HDLCOUT); + mi_head = mi = mbuf_Alloc(2, MB_CCPOUT); mi->next = mp; rp = MBUF_CTOP(mi); if (*proto < 0x100) { /* Compress the protocol */ @@ -95,7 +95,7 @@ DeflateOutput(void *v, struct ccp *ccp, struct link *l, int pri, u_short *proto, } /* Allocate the initial output mbuf */ - mo_head = mo = mbuf_Alloc(DEFLATE_CHUNK_LEN, MB_HDLCOUT); + mo_head = mo = mbuf_Alloc(DEFLATE_CHUNK_LEN, MB_CCPOUT); mo->cnt = 2; wp = MBUF_CTOP(mo); *wp++ = state->seqno >> 8; @@ -135,7 +135,7 @@ DeflateOutput(void *v, struct ccp *ccp, struct link *l, int pri, u_short *proto, } if (state->cx.avail_out == 0) { - mo->next = mbuf_Alloc(DEFLATE_CHUNK_LEN, MB_HDLCOUT); + mo->next = mbuf_Alloc(DEFLATE_CHUNK_LEN, MB_CCPOUT); olen += (mo->cnt = DEFLATE_CHUNK_LEN); mo = mo->next; mo->cnt = 0; @@ -234,7 +234,7 @@ DeflateInput(void *v, struct ccp *ccp, u_short *proto, struct mbuf *mi) state->uncomp_rec = 0; /* Allocate an output mbuf */ - mo_head = mo = mbuf_Alloc(DEFLATE_CHUNK_LEN, MB_IPIN); + mo_head = mo = mbuf_Alloc(DEFLATE_CHUNK_LEN, MB_CCPIN); /* Our proto starts with 0 if it's compressed */ wp = MBUF_CTOP(mo); @@ -291,7 +291,7 @@ DeflateInput(void *v, struct ccp *ccp, u_short *proto, struct mbuf *mi) first = 0; } else { olen += (mo->cnt = DEFLATE_CHUNK_LEN); - mo->next = mbuf_Alloc(DEFLATE_CHUNK_LEN, MB_IPIN); + mo->next = mbuf_Alloc(DEFLATE_CHUNK_LEN, MB_CCPIN); mo = mo->next; state->cx.next_out = MBUF_CTOP(mo); state->cx.avail_out = DEFLATE_CHUNK_LEN; @@ -350,7 +350,7 @@ DeflateDictSetup(void *v, struct ccp *ccp, u_short proto, struct mbuf *mi) * Stuff an ``uncompressed data'' block header followed by the * protocol in front of the input */ - mi_head = mbuf_Alloc(7, MB_HDLCOUT); + mi_head = mbuf_Alloc(7, MB_CCPOUT); mi_head->next = mi; len = mbuf_Length(mi); mi = mi_head; diff --git a/usr.sbin/ppp/ppp/fsm.c b/usr.sbin/ppp/ppp/fsm.c index 96f9530eb1f..d1c033b470f 100644 --- a/usr.sbin/ppp/ppp/fsm.c +++ b/usr.sbin/ppp/ppp/fsm.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: fsm.c,v 1.9 1999/05/14 09:35:27 brian Exp $ + * $Id: fsm.c,v 1.10 1999/06/02 15:58:40 brian Exp $ * * TODO: */ @@ -175,7 +175,8 @@ NewState(struct fsm *fp, int new) } void -fsm_Output(struct fsm *fp, u_int code, u_int id, u_char *ptr, int count) +fsm_Output(struct fsm *fp, u_int code, u_int id, u_char *ptr, int count, + int mtype) { int plen; struct fsmheader lh; @@ -200,7 +201,7 @@ fsm_Output(struct fsm *fp, u_int code, u_int id, u_char *ptr, int count) lh.code = code; lh.id = id; lh.length = htons(plen); - bp = mbuf_Alloc(plen, MB_FSM); + bp = mbuf_Alloc(plen, mtype); memcpy(MBUF_CTOP(bp), &lh, sizeof(struct fsmheader)); if (count) memcpy(MBUF_CTOP(bp) + sizeof(struct fsmheader), ptr, count); @@ -379,7 +380,7 @@ FsmSendConfigReq(struct fsm *fp) static void FsmSendTerminateReq(struct fsm *fp) { - fsm_Output(fp, CODE_TERMREQ, fp->reqid, NULL, 0); + fsm_Output(fp, CODE_TERMREQ, fp->reqid, NULL, 0, MB_UNKNOWN); (*fp->fn->SentTerminateReq)(fp); timer_Start(&fp->FsmTimer); /* Start restart timer */ fp->restart--; /* Decrement restart counter */ @@ -520,11 +521,14 @@ FsmRecvConfigReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) } if (dec.rejend != dec.rej) - fsm_Output(fp, CODE_CONFIGREJ, lhp->id, dec.rej, dec.rejend - dec.rej); + fsm_Output(fp, CODE_CONFIGREJ, lhp->id, dec.rej, dec.rejend - dec.rej, + MB_UNKNOWN); if (dec.nakend != dec.nak) - fsm_Output(fp, CODE_CONFIGNAK, lhp->id, dec.nak, dec.nakend - dec.nak); + fsm_Output(fp, CODE_CONFIGNAK, lhp->id, dec.nak, dec.nakend - dec.nak, + MB_UNKNOWN); if (ackaction) - fsm_Output(fp, CODE_CONFIGACK, lhp->id, dec.ack, dec.ackend - dec.ack); + fsm_Output(fp, CODE_CONFIGACK, lhp->id, dec.ack, dec.ackend - dec.ack, + MB_UNKNOWN); switch (fp->state) { case ST_STOPPED: @@ -881,6 +885,7 @@ FsmRecvEchoReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) u_char *cp; u_int32_t magic; + mbuf_SetType(bp, MB_ECHOIN); if (lcp && mbuf_Length(bp) >= 4) { cp = MBUF_CTOP(bp); ua_ntohl(cp, &magic); @@ -891,7 +896,7 @@ FsmRecvEchoReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) } if (fp->state == ST_OPENED) { ua_htonl(&lcp->want_magic, cp); /* local magic */ - fsm_Output(fp, CODE_ECHOREP, lhp->id, cp, mbuf_Length(bp)); + fsm_Output(fp, CODE_ECHOREP, lhp->id, cp, mbuf_Length(bp), MB_ECHOOUT); } } mbuf_Free(bp); @@ -934,7 +939,7 @@ FsmRecvResetReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) * at the peer before our ResetAck. */ link_SequenceQueue(fp->link); - fsm_Output(fp, CODE_RESETACK, lhp->id, NULL, 0); + fsm_Output(fp, CODE_RESETACK, lhp->id, NULL, 0, MB_CCPOUT); mbuf_Free(bp); } @@ -968,7 +973,7 @@ fsm_Input(struct fsm *fp, struct mbuf *bp) bp = mbuf_Prepend(bp, &lh, sizeof lh, 0); bp = mbuf_Contiguous(bp); - fsm_Output(fp, CODE_CODEREJ, id++, MBUF_CTOP(bp), bp->cnt); + fsm_Output(fp, CODE_CODEREJ, id++, MBUF_CTOP(bp), bp->cnt, MB_UNKNOWN); mbuf_Free(bp); return; } @@ -984,17 +989,11 @@ fsm_Input(struct fsm *fp, struct mbuf *bp) log_Printf(fp->LogLevel, "%s: Recv%s(%d) state = %s\n", fp->link->name, codep->name, lh.id, State2Nam(fp->state)); - if (log_IsKept(LogDEBUG)) - mbuf_Log(); - if (codep->inc_reqid && (lh.id == fp->reqid || (!Enabled(fp->bundle, OPT_IDCHECK) && codep->check_reqid))) fp->reqid++; /* That's the end of that ``exchange''.... */ (*codep->recv)(fp, &lh, bp); - - if (log_IsKept(LogDEBUG)) - mbuf_Log(); } void diff --git a/usr.sbin/ppp/ppp/fsm.h b/usr.sbin/ppp/ppp/fsm.h index 51b2e3aed13..3da36a3ea58 100644 --- a/usr.sbin/ppp/ppp/fsm.h +++ b/usr.sbin/ppp/ppp/fsm.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: fsm.h,v 1.3 1999/02/26 21:28:22 brian Exp $ + * $Id: fsm.h,v 1.4 1999/06/02 15:58:40 brian Exp $ * * TODO: */ @@ -160,7 +160,7 @@ struct fsmconfig { extern void fsm_Init(struct fsm *, const char *, u_short, int, int, int, struct bundle *, struct link *, const struct fsm_parent *, struct fsm_callbacks *, const char *[3]); -extern void fsm_Output(struct fsm *, u_int, u_int, u_char *, int); +extern void fsm_Output(struct fsm *, u_int, u_int, u_char *, int, int); extern void fsm_Open(struct fsm *); extern void fsm_Up(struct fsm *); extern void fsm_Down(struct fsm *); diff --git a/usr.sbin/ppp/ppp/hdlc.c b/usr.sbin/ppp/ppp/hdlc.c index 6bafad18b4c..6beb6c9167a 100644 --- a/usr.sbin/ppp/ppp/hdlc.c +++ b/usr.sbin/ppp/ppp/hdlc.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: hdlc.c,v 1.6 1999/05/08 11:06:35 brian Exp $ + * $Id: hdlc.c,v 1.7 1999/06/02 15:58:40 brian Exp $ * * TODO: */ @@ -158,6 +158,7 @@ hdlc_LayerPush(struct bundle *bundle, struct link *l, struct mbuf *bp, u_char *cp; u_short fcs; + mbuf_SetType(bp, MB_HDLCOUT); fcs = HdlcFcsBuf(INITFCS, bp); fcs = ~fcs; @@ -344,13 +345,12 @@ hdlc_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, } bp = mbuf_Truncate(bp, len - 2); /* discard the FCS */ + mbuf_SetType(bp, MB_HDLCIN); return bp; } -/* - * Detect a HDLC frame - */ +/* Detect a HDLC frame */ static const struct frameheader { const u_char *data; diff --git a/usr.sbin/ppp/ppp/ip.c b/usr.sbin/ppp/ppp/ip.c index c75a051f1fe..bc0cf77229b 100644 --- a/usr.sbin/ppp/ppp/ip.c +++ b/usr.sbin/ppp/ppp/ip.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ip.c,v 1.11 1999/05/31 23:57:37 brian Exp $ + * $Id: ip.c,v 1.12 1999/06/02 15:58:40 brian Exp $ * * TODO: * o Return ICMP message for filterd packet @@ -393,6 +393,7 @@ ip_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) return NULL; } + mbuf_SetType(bp, MB_IPIN); tun_fill_header(tun, AF_INET); nb = mbuf_Length(bp); if (nb > sizeof tun.data) { @@ -439,7 +440,7 @@ ip_Enqueue(struct ipcp *ipcp, int pri, char *ptr, int count) * mbuf_Prepend() in acf_LayerPush() and proto_LayerPush() and * appending in hdlc_LayerPush(). */ - bp = mbuf_Alloc(count + 6, MB_IPQ); + bp = mbuf_Alloc(count + 6, MB_IPOUT); bp->offset += 4; bp->cnt -= 6; memcpy(MBUF_CTOP(bp), ptr, count); diff --git a/usr.sbin/ppp/ppp/ipcp.c b/usr.sbin/ppp/ppp/ipcp.c index a02b84f0293..c8fbc35501e 100644 --- a/usr.sbin/ppp/ppp/ipcp.c +++ b/usr.sbin/ppp/ppp/ipcp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ipcp.c,v 1.14 1999/05/31 23:57:37 brian Exp $ + * $Id: ipcp.c,v 1.15 1999/06/02 15:58:40 brian Exp $ * * TODO: * o Support IPADDRS properly @@ -640,7 +640,8 @@ IpcpSendConfigReq(struct fsm *fp) INC_LCP_OPT(TY_SECONDARY_DNS, 6, o); } - fsm_Output(fp, CODE_CONFIGREQ, fp->reqid, buff, (u_char *)o - buff); + fsm_Output(fp, CODE_CONFIGREQ, fp->reqid, buff, (u_char *)o - buff, + MB_IPCPOUT); } static void @@ -653,7 +654,7 @@ static void IpcpSendTerminateAck(struct fsm *fp, u_char id) { /* Send Term ACK please */ - fsm_Output(fp, CODE_TERMACK, id, NULL, 0); + fsm_Output(fp, CODE_TERMACK, id, NULL, 0, MB_IPCPOUT); } static void @@ -1144,6 +1145,7 @@ extern struct mbuf * ipcp_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) { /* Got PROTO_IPCP from link */ + mbuf_SetType(bp, MB_IPCPIN); if (bundle_Phase(bundle) == PHASE_NETWORK) fsm_Input(&bundle->ncp.ipcp.fsm, bp); else { diff --git a/usr.sbin/ppp/ppp/lcp.c b/usr.sbin/ppp/ppp/lcp.c index 9afa0303f18..457c30d0bc9 100644 --- a/usr.sbin/ppp/ppp/lcp.c +++ b/usr.sbin/ppp/ppp/lcp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: lcp.c,v 1.13 1999/05/09 20:04:01 brian Exp $ + * $Id: lcp.c,v 1.14 1999/06/02 15:58:40 brian Exp $ * */ @@ -430,14 +430,16 @@ LcpSendConfigReq(struct fsm *fp) INC_LCP_OPT(TY_ENDDISC, mp->cfg.enddisc.len + 3, o); } - fsm_Output(fp, CODE_CONFIGREQ, fp->reqid, buff, (u_char *)o - buff); + fsm_Output(fp, CODE_CONFIGREQ, fp->reqid, buff, (u_char *)o - buff, + MB_LCPOUT); } void lcp_SendProtoRej(struct lcp *lcp, u_char *option, int count) { /* Don't understand `option' */ - fsm_Output(&lcp->fsm, CODE_PROTOREJ, lcp->fsm.reqid, option, count); + fsm_Output(&lcp->fsm, CODE_PROTOREJ, lcp->fsm.reqid, option, count, + MB_LCPOUT); } static void @@ -455,7 +457,7 @@ LcpSendTerminateAck(struct fsm *fp, u_char id) if (p && p->dl->state == DATALINK_CBCP) cbcp_ReceiveTerminateReq(p); - fsm_Output(fp, CODE_TERMACK, id, NULL, 0); + fsm_Output(fp, CODE_TERMACK, id, NULL, 0, MB_LCPOUT); } static void @@ -1148,6 +1150,7 @@ extern struct mbuf * lcp_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) { /* Got PROTO_LCP from link */ + mbuf_SetType(bp, MB_LCPIN); fsm_Input(&l->lcp.fsm, bp); return NULL; } diff --git a/usr.sbin/ppp/ppp/link.c b/usr.sbin/ppp/ppp/link.c index 57825fb3a4d..fa812d7fcb0 100644 --- a/usr.sbin/ppp/ppp/link.c +++ b/usr.sbin/ppp/ppp/link.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: link.c,v 1.6 1999/05/15 02:25:23 brian Exp $ + * $Id: link.c,v 1.7 1999/06/02 15:58:41 brian Exp $ * */ @@ -245,7 +245,7 @@ link_PullPacket(struct link *l, char *buf, size_t len, struct bundle *b) link_AddInOctets(l, len); memset(lbp, '\0', sizeof lbp); - lbp[0] = mbuf_Alloc(len, MB_ASYNC); + lbp[0] = mbuf_Alloc(len, MB_UNKNOWN); memcpy(MBUF_CTOP(lbp[0]), buf, len); lproto[0] = 0; layer = 0; diff --git a/usr.sbin/ppp/ppp/lqr.c b/usr.sbin/ppp/ppp/lqr.c index 6815c35dd09..813f9828fd2 100644 --- a/usr.sbin/ppp/ppp/lqr.c +++ b/usr.sbin/ppp/ppp/lqr.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: lqr.c,v 1.6 1999/05/14 09:35:27 brian Exp $ + * $Id: lqr.c,v 1.7 1999/06/02 15:58:41 brian Exp $ * * o LQR based on RFC1333 * @@ -75,7 +75,7 @@ SendEchoReq(struct lcp *lcp) echo.signature = htonl(SIGNATURE); echo.sequence = htonl(hdlc->lqm.echo.seq_sent); fsm_Output(&lcp->fsm, CODE_ECHOREQ, hdlc->lqm.echo.seq_sent++, - (u_char *)&echo, sizeof echo); + (u_char *)&echo, sizeof echo, MB_ECHOOUT); } struct mbuf * @@ -132,8 +132,13 @@ static void SendLqrData(struct lcp *lcp) { struct mbuf *bp; + int extra; - bp = mbuf_Alloc(sizeof(struct lqrdata), MB_LQR); + extra = proto_WrapperOctets(lcp, PROTO_LQR) + + acf_WrapperOctets(lcp, PROTO_LQR); + bp = mbuf_Alloc(sizeof(struct lqrdata) + extra, MB_LQROUT); + bp->cnt -= extra; + bp->offset += extra; link_PushPacket(lcp->fsm.link, bp, lcp->fsm.bundle, PRI_LINK, PROTO_LQR); } @@ -383,7 +388,7 @@ lqr_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp, p->hdlc.lqm.OutPackets++; if (*proto == PROTO_LQR) { - /* Overwrite the entire packet */ + /* Overwrite the entire packet (created in SendLqrData()) */ struct lqrdata lqr; lqr.MagicNumber = p->link.lcp.want_magic; @@ -414,9 +419,21 @@ lqr_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp, return bp; } +static struct mbuf * +lqr_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, u_short *proto) +{ + /* + * We mark the packet as ours but don't do anything 'till it's dispatched + * to lqr_Input() + */ + if (*proto == PROTO_LQR) + mbuf_SetType(bp, MB_LQRIN); + return bp; +} + /* * Statistics for pulled packets are recorded either in hdlc_PullPacket() * or sync_PullPacket() */ -struct layer lqrlayer = { LAYER_LQR, "lqr", lqr_LayerPush, NULL }; +struct layer lqrlayer = { LAYER_LQR, "lqr", lqr_LayerPush, lqr_LayerPull }; diff --git a/usr.sbin/ppp/ppp/mbuf.c b/usr.sbin/ppp/ppp/mbuf.c index 34fe4ff8b51..d1a4c732561 100644 --- a/usr.sbin/ppp/ppp/mbuf.c +++ b/usr.sbin/ppp/ppp/mbuf.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: mbuf.c,v 1.5 1999/05/09 20:04:02 brian Exp $ + * $Id: mbuf.c,v 1.6 1999/06/02 15:58:41 brian Exp $ * */ #include <sys/types.h> @@ -39,7 +39,7 @@ static struct memmap { struct mbuf *queue; int fragments, octets; -} MemMap[MB_MAX + 2]; +} MemMap[MB_MAX + 1]; static int totalalloced; static unsigned long long mbuf_Mallocs, mbuf_Frees; @@ -59,8 +59,10 @@ mbuf_Alloc(int cnt, int type) { struct mbuf *bp; - if (type > MB_MAX) + if (type > MB_MAX) { log_Printf(LogERROR, "Bad mbuf type %d\n", type); + type = MB_UNKNOWN; + } bp = malloc(sizeof(struct mbuf) + cnt); if (bp == NULL) { log_Printf(LogALERT, "failed to allocate memory: %ld\n", @@ -168,7 +170,7 @@ mbuf_Prepend(struct mbuf *bp, const void *ptr, size_t len, size_t extra) bp->offset = 0; } - head = mbuf_Alloc(len + extra, bp ? bp->type : MB_FSM); + head = mbuf_Alloc(len + extra, bp ? bp->type : MB_UNKNOWN); head->offset = extra; head->cnt -= extra; memcpy(MBUF_CTOP(head), ptr, len); @@ -219,18 +221,24 @@ mbuf_Show(struct cmdargs const *arg) { int i; static const char *mbuftype[] = { - "async", "fsm", "cbcp", "hdlcout", "ipin", "echo", "lqr", "vjcomp", - "ipq", "mp" }; + "ip in", "ip out", "alias in", "alias out", "mp in", "mp out", + "vj in", "vj out", "icompd in", "icompd out", "compd in", "compd out", + "lqr in", "lqr out", "echo in", "echo out", "proto in", "proto out", + "acf in", "acf out", "sync in", "sync out", "hdlc in", "hdlc out", + "async in", "async out", "cbcp in", "cbcp out", "chap in", "chap out", + "pap in", "pap out", "ccp in", "ccp out", "ipcp in", "ipcp out", + "lcp in", "lcp out", "unknown" + }; prompt_Printf(arg->prompt, "Fragments (octets) in use:\n"); - for (i = 1; i < MB_MAX; i += 2) + for (i = 0; i < MB_MAX; i += 2) prompt_Printf(arg->prompt, "%10.10s: %04d (%06d)\t%10.10s: %04d (%06d)\n", - mbuftype[i-1], MemMap[i].fragments, MemMap[i].octets, mbuftype[i], - MemMap[i+1].fragments, MemMap[i+1].octets); + mbuftype[i], MemMap[i].fragments, MemMap[i].octets, + mbuftype[i+1], MemMap[i+1].fragments, MemMap[i+1].octets); if (i == MB_MAX) prompt_Printf(arg->prompt, "%10.10s: %04d (%06d)\n", - mbuftype[i-1], MemMap[i].fragments, MemMap[i].octets); + mbuftype[i], MemMap[i].fragments, MemMap[i].octets); prompt_Printf(arg->prompt, "Mallocs: %qu, Frees: %qu\n", mbuf_Mallocs, mbuf_Frees); @@ -238,18 +246,6 @@ mbuf_Show(struct cmdargs const *arg) return 0; } -void -mbuf_Log() -{ - log_Printf(LogDEBUG, "mbuf_Log: mem alloced: %d\n", totalalloced); - log_Printf(LogDEBUG, "mbuf_Log: 1: %d 2: %d 3: %d 4: %d\n", - MemMap[1].octets, MemMap[2].octets, MemMap[3].octets, MemMap[4].octets); - log_Printf(LogDEBUG, "mbuf_Log: 5: %d 6: %d 7: %d 8: %d\n", - MemMap[5].octets, MemMap[6].octets, MemMap[7].octets, MemMap[8].octets); - log_Printf(LogDEBUG, "mbuf_Log: 9: %d 10: %d 11: %d\n", - MemMap[9].octets, MemMap[10].octets, MemMap[11].octets); -} - struct mbuf * mbuf_Dequeue(struct mqueue *q) { @@ -313,3 +309,16 @@ mbuf_Contiguous(struct mbuf *bp) return bp; } + +void +mbuf_SetType(struct mbuf *bp, int type) +{ + for (; bp; bp = bp->next) + if (type != bp->type) { + MemMap[bp->type].fragments--; + MemMap[bp->type].octets -= bp->size; + bp->type = type; + MemMap[type].fragments++; + MemMap[type].octets += bp->size; + } +} diff --git a/usr.sbin/ppp/ppp/mbuf.h b/usr.sbin/ppp/ppp/mbuf.h index e546e136941..095a9b2a9ed 100644 --- a/usr.sbin/ppp/ppp/mbuf.h +++ b/usr.sbin/ppp/ppp/mbuf.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: mbuf.h,v 1.5 1999/05/09 20:04:03 brian Exp $ + * $Id: mbuf.h,v 1.6 1999/06/02 15:58:41 brian Exp $ * * TODO: */ @@ -42,17 +42,46 @@ struct mqueue { #define CONST_MBUF_CTOP(bp) \ ((bp) ? (const u_char *)((bp)+1) + (bp)->offset : NULL) -#define MB_ASYNC 1 -#define MB_FSM 2 -#define MB_CBCP 3 -#define MB_HDLCOUT 4 -#define MB_IPIN 5 -#define MB_ECHO 6 -#define MB_LQR 7 -#define MB_VJCOMP 8 -#define MB_IPQ 9 -#define MB_MP 10 -#define MB_MAX MB_MP +#define MB_IPIN 0 +#define MB_IPOUT 1 +#define MB_ALIASIN 2 +#define MB_ALIASOUT 3 +#define MB_MPIN 4 +#define MB_MPOUT 5 +#define MB_VJIN 6 +#define MB_VJOUT 7 +#define MB_ICOMPDIN 8 +#define MB_ICOMPDOUT 9 +#define MB_COMPDIN 10 +#define MB_COMPDOUT 11 +#define MB_LQRIN 12 +#define MB_LQROUT 13 +#define MB_ECHOIN 14 +#define MB_ECHOOUT 15 +#define MB_PROTOIN 16 +#define MB_PROTOOUT 17 +#define MB_ACFIN 18 +#define MB_ACFOUT 19 +#define MB_SYNCIN 20 +#define MB_SYNCOUT 21 +#define MB_HDLCIN 22 +#define MB_HDLCOUT 23 +#define MB_ASYNCIN 24 +#define MB_ASYNCOUT 25 +#define MB_CBCPIN 26 +#define MB_CBCPOUT 27 +#define MB_CHAPIN 28 +#define MB_CHAPOUT 29 +#define MB_PAPIN 30 +#define MB_PAPOUT 31 +#define MB_CCPIN 32 +#define MB_CCPOUT 33 +#define MB_IPCPIN 34 +#define MB_IPCPOUT 35 +#define MB_LCPIN 36 +#define MB_LCPOUT 37 +#define MB_UNKNOWN 38 +#define MB_MAX MB_UNKNOWN struct cmdargs; @@ -65,8 +94,8 @@ extern struct mbuf *mbuf_Read(struct mbuf *, void *, size_t); extern size_t mbuf_View(struct mbuf *, void *, size_t); extern struct mbuf *mbuf_Prepend(struct mbuf *, const void *, size_t, size_t); extern struct mbuf *mbuf_Truncate(struct mbuf *, size_t); -extern void mbuf_Log(void); extern int mbuf_Show(struct cmdargs const *); extern void mbuf_Enqueue(struct mqueue *, struct mbuf *); extern struct mbuf *mbuf_Dequeue(struct mqueue *); extern struct mbuf *mbuf_Contiguous(struct mbuf *); +extern void mbuf_SetType(struct mbuf *, int); diff --git a/usr.sbin/ppp/ppp/mp.c b/usr.sbin/ppp/ppp/mp.c index 67168616821..b7d4136806b 100644 --- a/usr.sbin/ppp/ppp/mp.c +++ b/usr.sbin/ppp/ppp/mp.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp.c,v 1.7 1999/05/28 08:03:53 brian Exp $ + * $Id: mp.c,v 1.8 1999/06/02 15:58:41 brian Exp $ */ #include <sys/param.h> @@ -537,8 +537,10 @@ mp_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) if (p == NULL) { log_Printf(LogWARN, "DecodePacket: Can't do MP inside MP !\n"); mbuf_Free(bp); - } else + } else { + mbuf_SetType(bp, MB_MPIN); mp_Assemble(&bundle->ncp.mp, bp, p); + } return NULL; } @@ -550,7 +552,7 @@ mp_Output(struct mp *mp, struct bundle *bundle, struct link *l, struct mbuf *mo; /* Stuff an MP header on the front of our packet and send it */ - mo = mbuf_Alloc(4, MB_MP); + mo = mbuf_Alloc(4, MB_MPOUT); mo->next = m; if (mp->peer_is12bit) { u_int16_t val; @@ -639,8 +641,9 @@ mp_FillQueues(struct bundle *bundle) */ mo = m; end = 1; + mbuf_SetType(mo, MB_MPOUT); } else { - mo = mbuf_Alloc(dl->mp.weight, MB_MP); + mo = mbuf_Alloc(dl->mp.weight, MB_MPOUT); mo->cnt = dl->mp.weight; len -= mo->cnt; m = mbuf_Read(m, MBUF_CTOP(mo), mo->cnt); @@ -690,14 +693,28 @@ mp_ShowStatus(struct cmdargs const *arg) prompt_Printf(arg->prompt, "Multilink is %sactive\n", mp->active ? "" : "in"); if (mp->active) { - struct mbuf *m; + struct mbuf *m, *lm; int bufs = 0; prompt_Printf(arg->prompt, "Socket: %s\n", mp->server.socket.sun_path); - for (m = mp->inbufs; m; m = m->pnext) + for (m = mp->inbufs; m; m = m->pnext) { bufs++; - prompt_Printf(arg->prompt, "Pending frags: %d\n", bufs); + lm = m; + } + prompt_Printf(arg->prompt, "Pending frags: %d", bufs); + if (bufs) { + struct mp_header mh; + unsigned long first, last; + + first = mp_ReadHeader(mp, mp->inbufs, &mh) ? mh.seq : 0; + last = mp_ReadHeader(mp, lm, &mh) ? mh.seq : 0; + prompt_Printf(arg->prompt, " (Have %lu - %lu, want %lu, lowest %lu)", + first, last, (unsigned long)mp->seq.next_in, + (unsigned long)mp->seq.min_in); + prompt_Printf(arg->prompt, " first is %d, %d", mh.begin ? 1 : 0, mh.end ? 1 : 0); + } + prompt_Printf(arg->prompt, "\n"); } prompt_Printf(arg->prompt, "\nMy Side:\n"); diff --git a/usr.sbin/ppp/ppp/pap.c b/usr.sbin/ppp/ppp/pap.c index f137bee9dd6..9031315cd9d 100644 --- a/usr.sbin/ppp/ppp/pap.c +++ b/usr.sbin/ppp/ppp/pap.c @@ -18,7 +18,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: pap.c,v 1.8 1999/05/08 11:06:38 brian Exp $ + * $Id: pap.c,v 1.9 1999/06/02 15:58:41 brian Exp $ * * TODO: */ @@ -86,7 +86,7 @@ pap_Req(struct authinfo *authp) lh.code = PAP_REQUEST; lh.id = authp->id; lh.length = htons(plen + sizeof(struct fsmheader)); - bp = mbuf_Alloc(plen + sizeof(struct fsmheader), MB_FSM); + bp = mbuf_Alloc(plen + sizeof(struct fsmheader), MB_PAPOUT); memcpy(MBUF_CTOP(bp), &lh, sizeof(struct fsmheader)); cp = MBUF_CTOP(bp) + sizeof(struct fsmheader); *cp++ = namelen; @@ -110,7 +110,7 @@ SendPapCode(struct authinfo *authp, int code, const char *message) mlen = strlen(message); plen = mlen + 1; lh.length = htons(plen + sizeof(struct fsmheader)); - bp = mbuf_Alloc(plen + sizeof(struct fsmheader), MB_FSM); + bp = mbuf_Alloc(plen + sizeof(struct fsmheader), MB_PAPOUT); memcpy(MBUF_CTOP(bp), &lh, sizeof(struct fsmheader)); cp = MBUF_CTOP(bp) + sizeof(struct fsmheader); *cp++ = mlen; @@ -191,6 +191,7 @@ pap_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) mbuf_Free(bp); return NULL; } + mbuf_SetType(bp, MB_PAPIN); authp->id = authp->in.hdr.id; /* We respond with this id */ if (bp) { diff --git a/usr.sbin/ppp/ppp/pred.c b/usr.sbin/ppp/ppp/pred.c index 66bd51b0e14..adf391a4042 100644 --- a/usr.sbin/ppp/ppp/pred.c +++ b/usr.sbin/ppp/ppp/pred.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: pred.c,v 1.6 1999/05/09 20:04:03 brian Exp $ + * $Id: pred.c,v 1.7 1999/06/02 15:58:41 brian Exp $ */ #include <sys/types.h> @@ -180,7 +180,7 @@ Pred1Output(void *v, struct ccp *ccp, struct link *l, int pri, u_short *proto, u_short fcs; orglen = mbuf_Length(bp) + 2; /* add count of proto */ - mwp = mbuf_Alloc((orglen + 2) / 8 * 9 + 12, MB_HDLCOUT); + mwp = mbuf_Alloc((orglen + 2) / 8 * 9 + 12, MB_CCPOUT); hp = wp = MBUF_CTOP(mwp); cp = bufp; *wp++ = *cp++ = orglen >> 8; @@ -221,7 +221,7 @@ Pred1Input(void *v, struct ccp *ccp, u_short *proto, struct mbuf *bp) u_char *bufp; u_short fcs; - wp = mbuf_Alloc(MAX_MRU + 2, MB_IPIN); + wp = mbuf_Alloc(MAX_MRU + 2, MB_CCPIN); cp = MBUF_CTOP(bp); olen = mbuf_Length(bp); pp = bufp = MBUF_CTOP(wp); diff --git a/usr.sbin/ppp/ppp/proto.c b/usr.sbin/ppp/ppp/proto.c index 894fb4e1f4f..cdf43bd5906 100644 --- a/usr.sbin/ppp/ppp/proto.c +++ b/usr.sbin/ppp/ppp/proto.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: proto.c,v 1.2 1999/05/12 10:03:54 brian Exp $ + * $Id: proto.c,v 1.3 1999/06/02 15:58:41 brian Exp $ */ #include <sys/types.h> @@ -75,6 +75,7 @@ proto_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp, log_Printf(LogDEBUG, "proto_LayerPush: Using 0x%04x\n", *proto); bp = proto_Prepend(bp, *proto, l->lcp.his_protocomp, acf_WrapperOctets(&l->lcp, *proto)); + mbuf_SetType(bp, MB_PROTOOUT); link_ProtocolRecord(l, *proto, PROTO_OUT); return bp; @@ -104,7 +105,7 @@ proto_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, bp = mbuf_Read(bp, cp, 1); log_Printf(LogDEBUG, "proto_LayerPull: unknown -> 0x%04x\n", *proto); - + mbuf_SetType(bp, MB_PROTOIN); link_ProtocolRecord(l, *proto, PROTO_IN); return bp; diff --git a/usr.sbin/ppp/ppp/sync.c b/usr.sbin/ppp/ppp/sync.c index e6be247ffc2..de3a57fd470 100644 --- a/usr.sbin/ppp/ppp/sync.c +++ b/usr.sbin/ppp/ppp/sync.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sync.c,v 1.2 1999/05/12 10:03:54 brian Exp $ + * $Id: sync.c,v 1.3 1999/06/02 15:58:41 brian Exp $ */ #include <sys/types.h> @@ -53,6 +53,7 @@ sync_LayerPush(struct bundle *bundle, struct link *l, struct mbuf *bp, int pri, u_short *proto) { log_DumpBp(LogSYNC, "Write", bp); + mbuf_SetType(bp, MB_SYNCOUT); return bp; } @@ -70,6 +71,7 @@ sync_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, /* Either done here or by the HDLC layer */ p->hdlc.lqm.SaveInOctets += mbuf_Length(bp) + 1; p->hdlc.lqm.SaveInPackets++; + mbuf_SetType(bp, MB_SYNCIN); } return bp; diff --git a/usr.sbin/ppp/ppp/vjcomp.c b/usr.sbin/ppp/ppp/vjcomp.c index 413e6249d7f..6296dcf2846 100644 --- a/usr.sbin/ppp/ppp/vjcomp.c +++ b/usr.sbin/ppp/ppp/vjcomp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: vjcomp.c,v 1.7 1999/05/12 10:03:56 brian Exp $ + * $Id: vjcomp.c,v 1.8 1999/06/02 15:58:41 brian Exp $ * * TODO: */ @@ -81,11 +81,13 @@ vj_LayerPush(struct bundle *bundle, struct link *l, struct mbuf *bp, int pri, case TYPE_UNCOMPRESSED_TCP: *proto = PROTO_VJUNCOMP; log_Printf(LogDEBUG, "vj_LayerPush: PROTO_IP -> PROTO_VJUNCOMP\n"); + mbuf_SetType(bp, MB_VJOUT); break; case TYPE_COMPRESSED_TCP: *proto = PROTO_VJCOMP; log_Printf(LogDEBUG, "vj_LayerPush: PROTO_IP -> PROTO_VJUNCOMP\n"); + mbuf_SetType(bp, MB_VJOUT); break; default: @@ -119,7 +121,8 @@ VjUncompressTcp(struct ipcp *ipcp, struct mbuf *bp, u_char type) if (len <= 0) { mbuf_Free(bp); bp = NULL; - } + } else + mbuf_SetType(bp, MB_VJIN); return bp; } @@ -141,8 +144,9 @@ VjUncompressTcp(struct ipcp *ipcp, struct mbuf *bp, u_char type) } len -= olen; len += rlen; - nbp = mbuf_Alloc(len, MB_VJCOMP); + nbp = mbuf_Alloc(len, MB_VJIN); memcpy(MBUF_CTOP(nbp), bufp, len); + mbuf_SetType(bp, MB_VJIN); nbp->next = bp; return nbp; } |