The CCP layer now behaves as follows:
o If we've denied and disabled all compression protocols, stay in ST_INITIAL and do an LCP protocol reject if we receive any CCP packets. o If we've disabled all compression protocols, go to ST_STOPPED and wait for the other side to ask for something. o If we've got anything enabled, start REQing as soon as the auth layer is up. o If we're in multilink mode, than the link level CCP goes straight to ST_STOPPED irrespective of what's configured so that we never try to compress compressed stuff by default.
This commit is contained in:
parent
805c871967
commit
079249c72b
@ -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.35 1998/06/25 22:33:12 brian Exp $
|
||||
* $Id: ccp.c,v 1.36 1998/06/27 23:48:40 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Support other compression protocols
|
||||
@ -590,14 +590,22 @@ ccp_Proto(struct ccp *ccp)
|
||||
PROTO_COMPD : PROTO_ICOMPD;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
ccp_SetOpenMode(struct ccp *ccp)
|
||||
{
|
||||
int f;
|
||||
|
||||
for (f = 0; f < CCP_NEG_TOTAL; f++)
|
||||
if (ccp->cfg.neg[f])
|
||||
if (IsEnabled(ccp->cfg.neg[f])) {
|
||||
ccp->fsm.open_mode = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
ccp->fsm.open_mode = OPEN_PASSIVE; /* Go straight to ST_STOPPED */
|
||||
ccp->fsm.open_mode = OPEN_PASSIVE; /* Go straight to ST_STOPPED ? */
|
||||
|
||||
for (f = 0; f < CCP_NEG_TOTAL; f++)
|
||||
if (IsAccepted(ccp->cfg.neg[f]))
|
||||
return 1;
|
||||
|
||||
return 0; /* No CCP at all */
|
||||
}
|
||||
|
@ -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.17 1998/06/15 19:06:37 brian Exp $
|
||||
* $Id: ccp.h,v 1.18 1998/06/27 23:48:41 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -125,4 +125,4 @@ extern int ccp_Compress(struct ccp *, struct link *, int, u_short, struct mbuf *
|
||||
extern struct mbuf *ccp_Decompress(struct ccp *, u_short *, struct mbuf *);
|
||||
extern u_short ccp_Proto(struct ccp *);
|
||||
extern void ccp_SetupCallbacks(struct ccp *);
|
||||
extern void ccp_SetOpenMode(struct ccp *);
|
||||
extern int ccp_SetOpenMode(struct ccp *);
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: datalink.c,v 1.13 1998/06/25 22:33:17 brian Exp $
|
||||
* $Id: datalink.c,v 1.14 1998/06/27 14:18:04 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -460,7 +460,7 @@ datalink_GotAuthname(struct datalink *dl, const char *name, int len)
|
||||
void
|
||||
datalink_AuthOk(struct datalink *dl)
|
||||
{
|
||||
ccp_SetOpenMode(&dl->physical->link.ccp);
|
||||
int ccpok = ccp_SetOpenMode(&dl->physical->link.ccp);
|
||||
|
||||
if (dl->physical->link.lcp.want_mrru && dl->physical->link.lcp.his_mrru) {
|
||||
/* we've authenticated in multilink mode ! */
|
||||
@ -491,8 +491,10 @@ datalink_AuthOk(struct datalink *dl)
|
||||
auth_Select(dl->bundle, dl->peer.authname, dl->physical);
|
||||
}
|
||||
|
||||
fsm_Up(&dl->physical->link.ccp.fsm);
|
||||
fsm_Open(&dl->physical->link.ccp.fsm);
|
||||
if (ccpok) {
|
||||
fsm_Up(&dl->physical->link.ccp.fsm);
|
||||
fsm_Open(&dl->physical->link.ccp.fsm);
|
||||
}
|
||||
datalink_NewState(dl, DATALINK_OPEN);
|
||||
bundle_NewPhase(dl->bundle, PHASE_NETWORK);
|
||||
(*dl->parent->LayerUp)(dl->parent->object, &dl->physical->link.lcp.fsm);
|
||||
|
@ -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.33 1998/06/25 22:33:20 brian Exp $
|
||||
* $Id: fsm.c,v 1.34 1998/06/27 23:48:43 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -458,6 +458,21 @@ FsmRecvConfigReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
|
||||
*/
|
||||
switch (fp->state) {
|
||||
case ST_INITIAL:
|
||||
if (fp->proto == PROTO_CCP && fp->link->lcp.fsm.state == ST_OPENED) {
|
||||
/*
|
||||
* ccp_SetOpenMode() leaves us in initial if we're disabling
|
||||
* & denying everything. This is a bit smelly, we know that
|
||||
* ``bp'' really has ``fsmheader'' in front of it, and CCP_PROTO
|
||||
* in front of that. CCP_PROTO isn't compressed either 'cos it
|
||||
* doesn't begin with 0x00....
|
||||
*/
|
||||
bp->offset -= sizeof(struct fsmheader) + 2;
|
||||
bp->cnt += sizeof(struct fsmheader) + 2;
|
||||
lcp_SendProtoRej(&fp->link->lcp, MBUF_CTOP(bp), bp->cnt);
|
||||
mbuf_Free(bp);
|
||||
return;
|
||||
}
|
||||
/* Drop through */
|
||||
case ST_STARTING:
|
||||
log_Printf(fp->LogLevel, "%s: Oops, RCR in %s.\n",
|
||||
fp->link->name, State2Nam(fp->state));
|
||||
|
@ -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.10 1998/06/20 00:19:42 brian Exp $
|
||||
* $Id: mp.c,v 1.11 1998/06/24 19:33:34 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -272,9 +272,10 @@ mp_Up(struct mp *mp, struct datalink *dl)
|
||||
ipcp_SetLink(&mp->bundle->ncp.ipcp, &mp->link);
|
||||
|
||||
/* Our lcp's already up 'cos of the NULL parent */
|
||||
ccp_SetOpenMode(&mp->link.ccp);
|
||||
fsm_Up(&mp->link.ccp.fsm);
|
||||
fsm_Open(&mp->link.ccp.fsm);
|
||||
if (ccp_SetOpenMode(&mp->link.ccp)) {
|
||||
fsm_Up(&mp->link.ccp.fsm);
|
||||
fsm_Open(&mp->link.ccp.fsm);
|
||||
}
|
||||
|
||||
mp->active = 1;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user