o Allocate new CCP protocol options if they've been

enabled since we first REQ'd.
o Delete the allocated options when CCP is down (TLF).
o Clean the IPCP interface on the way down when we're
  *not* in auto mode (rather than when we are) - typo.
o Don't produce two similar IpcpLayerUp messages.
This commit is contained in:
Brian Somers 1998-04-19 03:41:01 +00:00
parent 8d9b9867cc
commit ba081e4360
4 changed files with 25 additions and 22 deletions

View File

@ -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.34 1998/04/16 00:25:50 brian Exp $
* $Id: ccp.c,v 1.30.2.35 1998/04/19 02:23:15 brian Exp $
*
* TODO:
* o Support other compression protocols
@ -216,21 +216,19 @@ CcpSendConfigReq(struct fsm *fp)
for (f = 0; f < NALGORITHMS; f++)
if (IsEnabled(ccp->cfg.neg[algorithm[f]->Neg]) &&
!REJECTED(ccp, algorithm[f]->id)) {
if (alloc) {
if (!alloc)
for (o = &ccp->out.opt; *o != NULL; o = &(*o)->next)
if ((*o)->val.id == algorithm[f]->id && (*o)->algorithm == f)
break;
if (alloc || *o == NULL) {
*o = (struct ccp_opt *)malloc(sizeof(struct ccp_opt));
(*o)->val.id = algorithm[f]->id;
(*o)->val.len = 2;
(*o)->next = NULL;
(*o)->algorithm = f;
(*algorithm[f]->o.OptInit)(&(*o)->val, &ccp->cfg);
} else {
for (o = &ccp->out.opt; *o != NULL; o = &(*o)->next)
if ((*o)->val.id == algorithm[f]->id && (*o)->algorithm == f)
break;
if (*o == NULL) {
LogPrintf(LogERROR, "CCP REQ buffer lost !\n");
break;
}
}
if (cp + (*o)->val.len > buff + sizeof buff) {
@ -295,6 +293,8 @@ CcpLayerFinish(struct fsm *fp)
{
/* We're now down */
struct ccp *ccp = fsm2ccp(fp);
struct ccp_opt *next;
LogPrintf(LogCCP, "CcpLayerFinish.\n");
if (ccp->in.state != NULL) {
(*algorithm[ccp->in.algorithm]->i.Term)(ccp->in.state);
@ -307,6 +307,12 @@ CcpLayerFinish(struct fsm *fp)
ccp->out.algorithm = -1;
}
ccp->his_reject = ccp->my_reject = 0;
while (ccp->out.opt) {
next = ccp->out.opt->next;
free(ccp->out.opt);
ccp->out.opt = next;
}
}
static void

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: command.c,v 1.131.2.64 1998/04/18 01:01:17 brian Exp $
* $Id: command.c,v 1.131.2.65 1998/04/19 02:23:18 brian Exp $
*
*/
#include <sys/types.h>
@ -503,7 +503,7 @@ static int
ShowVersion(struct cmdargs const *arg)
{
static char VarVersion[] = "PPP Version 2.0-beta";
static char VarLocalVersion[] = "$Date: 1998/04/18 01:01:17 $";
static char VarLocalVersion[] = "$Date: 1998/04/19 02:23:18 $";
prompt_Printf(arg->prompt, "%s - %s \n", VarVersion, VarLocalVersion);
return 0;
@ -1747,7 +1747,7 @@ static struct cmdtab const NegotiateCommands[] = {
{"pap", NULL, NegotiateSet, LOCAL_AUTH | LOCAL_CX,
"Password Authentication protocol", "accept|deny|disable|enable",
(const void *)NEG_PAP},
{"pred1", NULL, NegotiateSet, LOCAL_AUTH | LOCAL_CX_OPT,
{"pred1", "predictor1", NegotiateSet, LOCAL_AUTH | LOCAL_CX_OPT,
"Predictor 1 compression", "accept|deny|disable|enable",
(const void *)NEG_PRED1},
{"protocomp", NULL, NegotiateSet, LOCAL_AUTH | LOCAL_CX,

View File

@ -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.50.2.37 1998/04/16 00:26:00 brian Exp $
* $Id: ipcp.c,v 1.50.2.38 1998/04/17 22:05:25 brian Exp $
*
* TODO:
* o More RFC1772 backwoard compatibility
@ -673,7 +673,7 @@ IpcpLayerDown(struct fsm *fp)
} else
SelectSystem(fp->bundle, "MYADDR", LINKDOWNFILE, NULL);
if (ipcp->fsm.bundle->phys_type & PHYS_DEMAND)
if (!(ipcp->fsm.bundle->phys_type & PHYS_DEMAND))
IpcpCleanInterface(ipcp);
}
@ -692,8 +692,7 @@ IpcpLayerUp(struct fsm *fp)
if (ipcp->peer_compproto >> 16 == PROTO_VJCOMP)
sl_compress_init(&ipcp->vj.cslc, (ipcp->peer_compproto >> 8) & 255);
if (ipcp_SetIPaddress(fp->bundle, ipcp->my_ip,
ipcp->peer_ip, 0) < 0) {
if (ipcp_SetIPaddress(fp->bundle, ipcp->my_ip, ipcp->peer_ip, 0) < 0) {
LogPrintf(LogERROR, "IpcpLayerUp: unable to set ip address\n");
return;
}
@ -703,9 +702,6 @@ IpcpLayerUp(struct fsm *fp)
(*PacketAlias.SetAddress)(ipcp->my_ip);
#endif
LogPrintf(LogIsKept(LogLINK) ? LogLINK : LogIPCP, "IpcpLayerUp: %s\n",
inet_ntoa(ipcp->peer_ifip));
/*
* XXX this stuff should really live in the FSM. Our config should
* associate executable sections in files with events.

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: route.c,v 1.42.2.16 1998/04/06 09:12:35 brian Exp $
* $Id: route.c,v 1.42.2.17 1998/04/07 00:54:16 brian Exp $
*
*/
@ -384,7 +384,8 @@ DeleteIfRoutes(struct bundle *bundle, int all)
* We do 2 passes. The first deletes all cloned routes. The second
* deletes all non-cloned routes. This is necessary to avoid
* potential errors from trying to delete route X after route Y where
* route X was cloned from route Y (which is no longer there).
* route X was cloned from route Y (and is no longer there 'cos it
* may have gone with route Y).
*/
if (RTF_WASCLONED == 0 && pass == 0)
/* So we can't tell ! */