diff options
author | brian <brian@FreeBSD.org> | 1998-06-30 23:04:17 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1998-06-30 23:04:17 +0000 |
commit | 079249c72b5c0fb2904b7a7047d32db6093792ee (patch) | |
tree | 42c0587c812526ccf54e9882ce1fc39a80e2f980 /usr.sbin | |
parent | 805c8719671543e774a7eb330ccd6b2d829a535a (diff) | |
download | FreeBSD-src-079249c72b5c0fb2904b7a7047d32db6093792ee.zip FreeBSD-src-079249c72b5c0fb2904b7a7047d32db6093792ee.tar.gz |
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.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ppp/ccp.c | 16 | ||||
-rw-r--r-- | usr.sbin/ppp/ccp.h | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/datalink.c | 10 | ||||
-rw-r--r-- | usr.sbin/ppp/fsm.c | 17 | ||||
-rw-r--r-- | usr.sbin/ppp/mp.c | 9 |
5 files changed, 41 insertions, 15 deletions
diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c index 62f4059..9141d77 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.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 ? */ + + for (f = 0; f < CCP_NEG_TOTAL; f++) + if (IsAccepted(ccp->cfg.neg[f])) + return 1; - ccp->fsm.open_mode = OPEN_PASSIVE; /* Go straight to ST_STOPPED */ + return 0; /* No CCP at all */ } diff --git a/usr.sbin/ppp/ccp.h b/usr.sbin/ppp/ccp.h index ca4ac82..b79fc27 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.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 *); diff --git a/usr.sbin/ppp/datalink.c b/usr.sbin/ppp/datalink.c index d3d6a34..fc2a841 100644 --- a/usr.sbin/ppp/datalink.c +++ b/usr.sbin/ppp/datalink.c @@ -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); diff --git a/usr.sbin/ppp/fsm.c b/usr.sbin/ppp/fsm.c index 289670a..4888e09 100644 --- a/usr.sbin/ppp/fsm.c +++ b/usr.sbin/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.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)); diff --git a/usr.sbin/ppp/mp.c b/usr.sbin/ppp/mp.c index 4c9ff8b..46a686e 100644 --- a/usr.sbin/ppp/mp.c +++ b/usr.sbin/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.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; |