diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c index 9bc22460b4e2..3be51298bae8 100644 --- a/usr.sbin/ppp/ccp.c +++ b/usr.sbin/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.30.2.8 1998/02/08 11:04:45 brian Exp $ + * $Id: ccp.c,v 1.30.2.9 1998/02/10 03:23:07 brian Exp $ * * TODO: * o Support other compression protocols @@ -452,23 +452,26 @@ CcpOutput(struct link *l, int pri, u_short proto, struct mbuf *m) } struct mbuf * -CompdInput(u_short *proto, struct mbuf *m) +ccp_Decompress(u_short *proto, struct mbuf *bp) { - /* Decompress incoming data */ - if (CcpInfo.reset_sent != -1) { - /* Send another REQ and put the packet in the bit bucket */ - LogPrintf(LogCCP, "ReSendResetReq(%d)\n", CcpInfo.reset_sent); - FsmOutput(&CcpInfo.fsm, CODE_RESETREQ, CcpInfo.reset_sent, NULL, 0); - pfree(m); - } else if (CcpInfo.in_init) - return (*algorithm[CcpInfo.in_algorithm]->i.Read)(proto, m); - return NULL; -} + /* + * If proto isn't PROTO_COMPD, we still want to pass it to the + * decompression routines so that the dictionary's updated + */ + if (CcpInfo.fsm.state == ST_OPENED) + if (*proto == PROTO_COMPD) { + /* Decompress incoming data */ + if (CcpInfo.reset_sent != -1) { + /* Send another REQ and put the packet in the bit bucket */ + LogPrintf(LogCCP, "ReSendResetReq(%d)\n", CcpInfo.reset_sent); + FsmOutput(&CcpInfo.fsm, CODE_RESETREQ, CcpInfo.reset_sent, NULL, 0); + } else if (CcpInfo.in_init) + return (*algorithm[CcpInfo.in_algorithm]->i.Read)(proto, bp); + pfree(bp); + bp = NULL; + } else if ((*proto & 0xfff1) == 0x21 && CcpInfo.in_init) + /* Add incoming Network Layer traffic to our dictionary */ + (*algorithm[CcpInfo.in_algorithm]->i.DictSetup)(*proto, bp); -void -CcpDictSetup(u_short proto, struct mbuf *m) -{ - /* Add incoming data to the dictionary */ - if (CcpInfo.in_init) - (*algorithm[CcpInfo.in_algorithm]->i.DictSetup)(proto, m); + return bp; } diff --git a/usr.sbin/ppp/ccp.h b/usr.sbin/ppp/ccp.h index b2379ddf4f12..8028eb99bb6b 100644 --- a/usr.sbin/ppp/ccp.h +++ b/usr.sbin/ppp/ccp.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ccp.h,v 1.14.2.7 1998/02/07 20:49:27 brian Exp $ + * $Id: ccp.h,v 1.14.2.8 1998/02/08 11:04:49 brian Exp $ * * TODO: */ @@ -93,5 +93,4 @@ extern void CcpInit(struct bundle *, struct link *); extern int ReportCcpStatus(struct cmdargs const *); extern void CcpResetInput(u_char); extern int CcpOutput(struct link *, int, u_short, struct mbuf *); -extern struct mbuf *CompdInput(u_short *, struct mbuf *); -extern void CcpDictSetup(u_short, struct mbuf *); +extern struct mbuf *ccp_Decompress(u_short *, struct mbuf *); diff --git a/usr.sbin/ppp/hdlc.c b/usr.sbin/ppp/hdlc.c index 96581660ed79..d751c35778cb 100644 --- a/usr.sbin/ppp/hdlc.c +++ b/usr.sbin/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.28.2.10 1998/02/18 19:35:17 brian Exp $ + * $Id: hdlc.c,v 1.28.2.11 1998/02/18 19:35:41 brian Exp $ * * TODO: */ @@ -364,16 +364,9 @@ DecodePacket(struct bundle *bundle, u_short proto, struct mbuf * bp, LogPrintf(LogDEBUG, "DecodePacket: proto = 0x%04x\n", proto); - /* - * If proto isn't PROTO_COMPD, we still want to pass it to the - * decompression routines so that the dictionary's updated - */ - if (CcpInfo.fsm.state == ST_OPENED) - if (proto == PROTO_COMPD) { - if ((bp = CompdInput(&proto, bp)) == NULL) - return; - } else if ((proto & 0xfff1) == 0x21) /* Network Layer protocol */ - CcpDictSetup(proto, bp); + /* decompress everything. CCP needs uncompressed data too */ + if ((bp = ccp_Decompress(&proto, bp)) == NULL) + return; switch (proto) { case PROTO_LCP: