o Bring global/static data into LcpInfo.
o Parameterise LcpReportTime(). o Don't obscure the hard-coded use of LcpInfo. o Comment on the data elements of LcpInfo.
This commit is contained in:
parent
e675fb2392
commit
c8ee0d78b6
@ -17,7 +17,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: chap.c,v 1.28 1997/12/24 09:28:53 brian Exp $
|
* $Id: chap.c,v 1.28.2.1 1998/01/29 00:49:13 brian Exp $
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
*/
|
*/
|
||||||
@ -266,14 +266,13 @@ RecvChapResult(struct fsmheader *chp, struct mbuf *bp,
|
|||||||
struct physical *physical)
|
struct physical *physical)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
struct lcpstate *lcp = &LcpInfo;
|
|
||||||
|
|
||||||
len = ntohs(chp->length);
|
len = ntohs(chp->length);
|
||||||
LogPrintf(LogDEBUG, "RecvChapResult: length: %d\n", len);
|
LogPrintf(LogDEBUG, "RecvChapResult: length: %d\n", len);
|
||||||
if (chp->code == CHAP_SUCCESS) {
|
if (chp->code == CHAP_SUCCESS) {
|
||||||
if (lcp->auth_iwait == PROTO_CHAP) {
|
if (LcpInfo.auth_iwait == PROTO_CHAP) {
|
||||||
lcp->auth_iwait = 0;
|
LcpInfo.auth_iwait = 0;
|
||||||
if (lcp->auth_ineed == 0)
|
if (LcpInfo.auth_ineed == 0)
|
||||||
NewPhase(physical, PHASE_NETWORK);
|
NewPhase(physical, PHASE_NETWORK);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: deflate.c,v 1.6 1998/01/10 01:55:09 brian Exp $
|
* $Id: deflate.c,v 1.6.4.1 1998/01/29 00:49:16 brian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -40,10 +40,10 @@
|
|||||||
#include "loadalias.h"
|
#include "loadalias.h"
|
||||||
#include "vars.h"
|
#include "vars.h"
|
||||||
#include "hdlc.h"
|
#include "hdlc.h"
|
||||||
|
#include "timer.h"
|
||||||
#include "lcp.h"
|
#include "lcp.h"
|
||||||
#include "ccp.h"
|
#include "ccp.h"
|
||||||
#include "lcpproto.h"
|
#include "lcpproto.h"
|
||||||
#include "timer.h"
|
|
||||||
#include "fsm.h"
|
#include "fsm.h"
|
||||||
#include "deflate.h"
|
#include "deflate.h"
|
||||||
|
|
||||||
|
@ -17,10 +17,9 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: lcp.c,v 1.55.2.1 1998/01/29 00:49:24 brian Exp $
|
* $Id: lcp.c,v 1.55.2.2 1998/01/29 23:11:38 brian Exp $
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
* o Validate magic number received from peer.
|
|
||||||
* o Limit data field length by MRU
|
* o Limit data field length by MRU
|
||||||
*/
|
*/
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -143,28 +142,27 @@ struct fsm LcpFsm = {
|
|||||||
LcpDecodeConfig,
|
LcpDecodeConfig,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct pppTimer LcpReportTimer;
|
|
||||||
static int LcpFailedMagic;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
LcpReportTime(void *data)
|
LcpReportTime(void *data)
|
||||||
{
|
{
|
||||||
|
struct pppTimer *me = (struct pppTimer *)data;
|
||||||
|
|
||||||
if (LogIsKept(LogDEBUG)) {
|
if (LogIsKept(LogDEBUG)) {
|
||||||
time_t t;
|
time_t t;
|
||||||
|
|
||||||
time(&t);
|
time(&t);
|
||||||
LogPrintf(LogDEBUG, "LcpReportTime: %s\n", ctime(&t));
|
LogPrintf(LogDEBUG, "LcpReportTime: %s\n", ctime(&t));
|
||||||
}
|
}
|
||||||
StopTimer(&LcpReportTimer);
|
|
||||||
LcpReportTimer.state = TIMER_STOPPED;
|
StopTimer(me);
|
||||||
StartTimer(&LcpReportTimer);
|
me->state = TIMER_STOPPED;
|
||||||
|
StartTimer(me);
|
||||||
HdlcErrorCheck();
|
HdlcErrorCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ReportLcpStatus(struct cmdargs const *arg)
|
ReportLcpStatus(struct cmdargs const *arg)
|
||||||
{
|
{
|
||||||
struct lcpstate *lcp = &LcpInfo;
|
|
||||||
struct fsm *fp = &LcpFsm;
|
struct fsm *fp = &LcpFsm;
|
||||||
|
|
||||||
if (!VarTerm)
|
if (!VarTerm)
|
||||||
@ -174,13 +172,13 @@ ReportLcpStatus(struct cmdargs const *arg)
|
|||||||
fprintf(VarTerm,
|
fprintf(VarTerm,
|
||||||
" his side: MRU %d, ACCMAP %08lx, PROTOCOMP %d, ACFCOMP %d,\n"
|
" his side: MRU %d, ACCMAP %08lx, PROTOCOMP %d, ACFCOMP %d,\n"
|
||||||
" MAGIC %08lx, REJECT %04x\n",
|
" MAGIC %08lx, REJECT %04x\n",
|
||||||
lcp->his_mru, (u_long)lcp->his_accmap, lcp->his_protocomp,
|
LcpInfo.his_mru, (u_long)LcpInfo.his_accmap, LcpInfo.his_protocomp,
|
||||||
lcp->his_acfcomp, (u_long)lcp->his_magic, lcp->his_reject);
|
LcpInfo.his_acfcomp, (u_long)LcpInfo.his_magic, LcpInfo.his_reject);
|
||||||
fprintf(VarTerm,
|
fprintf(VarTerm,
|
||||||
" my side: MRU %d, ACCMAP %08lx, PROTOCOMP %d, ACFCOMP %d,\n"
|
" my side: MRU %d, ACCMAP %08lx, PROTOCOMP %d, ACFCOMP %d,\n"
|
||||||
" MAGIC %08lx, REJECT %04x\n",
|
" MAGIC %08lx, REJECT %04x\n",
|
||||||
lcp->want_mru, (u_long)lcp->want_accmap, lcp->want_protocomp,
|
LcpInfo.want_mru, (u_long)LcpInfo.want_accmap, LcpInfo.want_protocomp,
|
||||||
lcp->want_acfcomp, (u_long)lcp->want_magic, lcp->my_reject);
|
LcpInfo.want_acfcomp, (u_long)LcpInfo.want_magic, LcpInfo.my_reject);
|
||||||
fprintf(VarTerm, "\nDefaults: MRU = %d, ACCMAP = %08lx\t",
|
fprintf(VarTerm, "\nDefaults: MRU = %d, ACCMAP = %08lx\t",
|
||||||
VarMRU, (u_long)VarAccmap);
|
VarMRU, (u_long)VarAccmap);
|
||||||
fprintf(VarTerm, "Open Mode: %s",
|
fprintf(VarTerm, "Open Mode: %s",
|
||||||
@ -204,28 +202,25 @@ GenerateMagic(void)
|
|||||||
void
|
void
|
||||||
LcpInit(struct physical *physical)
|
LcpInit(struct physical *physical)
|
||||||
{
|
{
|
||||||
struct lcpstate *lcp = &LcpInfo;
|
|
||||||
|
|
||||||
FsmInit(&LcpFsm, physical);
|
FsmInit(&LcpFsm, physical);
|
||||||
HdlcInit();
|
HdlcInit();
|
||||||
|
memset(&LcpInfo, '\0', sizeof LcpInfo);
|
||||||
memset(lcp, '\0', sizeof(struct lcpstate));
|
LcpInfo.want_mru = VarMRU;
|
||||||
lcp->want_mru = VarMRU;
|
LcpInfo.his_mru = DEF_MRU;
|
||||||
lcp->his_mru = DEF_MRU;
|
LcpInfo.his_accmap = 0xffffffff;
|
||||||
lcp->his_accmap = 0xffffffff;
|
LcpInfo.want_accmap = VarAccmap;
|
||||||
lcp->want_accmap = VarAccmap;
|
LcpInfo.want_magic = GenerateMagic();
|
||||||
lcp->want_magic = GenerateMagic();
|
LcpInfo.want_auth = LcpInfo.his_auth = 0;
|
||||||
lcp->want_auth = lcp->his_auth = 0;
|
|
||||||
if (Enabled(ConfChap))
|
if (Enabled(ConfChap))
|
||||||
lcp->want_auth = PROTO_CHAP;
|
LcpInfo.want_auth = PROTO_CHAP;
|
||||||
else if (Enabled(ConfPap))
|
else if (Enabled(ConfPap))
|
||||||
lcp->want_auth = PROTO_PAP;
|
LcpInfo.want_auth = PROTO_PAP;
|
||||||
if (Enabled(ConfLqr))
|
if (Enabled(ConfLqr))
|
||||||
lcp->want_lqrperiod = VarLqrTimeout * 100;
|
LcpInfo.want_lqrperiod = VarLqrTimeout * 100;
|
||||||
if (Enabled(ConfAcfcomp))
|
if (Enabled(ConfAcfcomp))
|
||||||
lcp->want_acfcomp = 1;
|
LcpInfo.want_acfcomp = 1;
|
||||||
if (Enabled(ConfProtocomp))
|
if (Enabled(ConfProtocomp))
|
||||||
lcp->want_protocomp = 1;
|
LcpInfo.want_protocomp = 1;
|
||||||
LcpFsm.maxconfig = 10;
|
LcpFsm.maxconfig = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,32 +313,31 @@ static void
|
|||||||
LcpSendConfigReq(struct fsm * fp)
|
LcpSendConfigReq(struct fsm * fp)
|
||||||
{
|
{
|
||||||
u_char *cp;
|
u_char *cp;
|
||||||
struct lcpstate *lcp = &LcpInfo;
|
|
||||||
struct lcp_opt o;
|
struct lcp_opt o;
|
||||||
|
|
||||||
LogPrintf(LogLCP, "LcpSendConfigReq\n");
|
LogPrintf(LogLCP, "LcpSendConfigReq\n");
|
||||||
cp = ReqBuff;
|
cp = ReqBuff;
|
||||||
if (!Physical_IsSync(fp->physical)) {
|
if (!Physical_IsSync(fp->physical)) {
|
||||||
if (lcp->want_acfcomp && !REJECTED(lcp, TY_ACFCOMP))
|
if (LcpInfo.want_acfcomp && !REJECTED(&LcpInfo, TY_ACFCOMP))
|
||||||
PUTN(TY_ACFCOMP);
|
PUTN(TY_ACFCOMP);
|
||||||
|
|
||||||
if (lcp->want_protocomp && !REJECTED(lcp, TY_PROTOCOMP))
|
if (LcpInfo.want_protocomp && !REJECTED(&LcpInfo, TY_PROTOCOMP))
|
||||||
PUTN(TY_PROTOCOMP);
|
PUTN(TY_PROTOCOMP);
|
||||||
|
|
||||||
if (!REJECTED(lcp, TY_ACCMAP))
|
if (!REJECTED(&LcpInfo, TY_ACCMAP))
|
||||||
PUTACCMAP(lcp->want_accmap);
|
PUTACCMAP(LcpInfo.want_accmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!REJECTED(lcp, TY_MRU))
|
if (!REJECTED(&LcpInfo, TY_MRU))
|
||||||
PUTMRU(lcp->want_mru);
|
PUTMRU(LcpInfo.want_mru);
|
||||||
|
|
||||||
if (lcp->want_magic && !REJECTED(lcp, TY_MAGICNUM))
|
if (LcpInfo.want_magic && !REJECTED(&LcpInfo, TY_MAGICNUM))
|
||||||
PUTMAGIC(lcp->want_magic);
|
PUTMAGIC(LcpInfo.want_magic);
|
||||||
|
|
||||||
if (lcp->want_lqrperiod && !REJECTED(lcp, TY_QUALPROTO))
|
if (LcpInfo.want_lqrperiod && !REJECTED(&LcpInfo, TY_QUALPROTO))
|
||||||
PUTLQR(lcp->want_lqrperiod);
|
PUTLQR(LcpInfo.want_lqrperiod);
|
||||||
|
|
||||||
switch (lcp->want_auth) {
|
switch (LcpInfo.want_auth) {
|
||||||
case PROTO_PAP:
|
case PROTO_PAP:
|
||||||
PUTPAP();
|
PUTPAP();
|
||||||
break;
|
break;
|
||||||
@ -372,7 +366,7 @@ LcpSendProtoRej(u_char * option, int count)
|
|||||||
static void
|
static void
|
||||||
LcpSendTerminateReq(struct fsm * fp)
|
LcpSendTerminateReq(struct fsm * fp)
|
||||||
{
|
{
|
||||||
/* Most thins are done in fsm layer. Nothing to to. */
|
/* Fsm has just send a terminate request */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -392,7 +386,7 @@ LcpLayerStart(struct fsm * fp)
|
|||||||
static void
|
static void
|
||||||
StopAllTimers(void)
|
StopAllTimers(void)
|
||||||
{
|
{
|
||||||
StopTimer(&LcpReportTimer);
|
StopTimer(&LcpInfo.ReportTimer);
|
||||||
StopIdleTimer();
|
StopIdleTimer();
|
||||||
StopTimer(&AuthPapInfo.authtimer);
|
StopTimer(&AuthPapInfo.authtimer);
|
||||||
StopTimer(&AuthChapInfo.authtimer);
|
StopTimer(&AuthChapInfo.authtimer);
|
||||||
@ -423,11 +417,12 @@ LcpLayerUp(struct fsm * fp)
|
|||||||
NewPhase(fp->physical, PHASE_AUTHENTICATE);
|
NewPhase(fp->physical, PHASE_AUTHENTICATE);
|
||||||
|
|
||||||
StartLqm(fp->physical);
|
StartLqm(fp->physical);
|
||||||
StopTimer(&LcpReportTimer);
|
StopTimer(&LcpInfo.ReportTimer);
|
||||||
LcpReportTimer.state = TIMER_STOPPED;
|
LcpInfo.ReportTimer.state = TIMER_STOPPED;
|
||||||
LcpReportTimer.load = 60 * SECTICKS;
|
LcpInfo.ReportTimer.load = 60 * SECTICKS;
|
||||||
LcpReportTimer.func = LcpReportTime;
|
LcpInfo.ReportTimer.arg = &LcpInfo.ReportTimer;
|
||||||
StartTimer(&LcpReportTimer);
|
LcpInfo.ReportTimer.func = LcpReportTime;
|
||||||
|
StartTimer(&LcpInfo.ReportTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -446,13 +441,13 @@ void
|
|||||||
LcpUp()
|
LcpUp()
|
||||||
{
|
{
|
||||||
FsmUp(&LcpFsm);
|
FsmUp(&LcpFsm);
|
||||||
LcpFailedMagic = 0;
|
LcpInfo.LcpFailedMagic = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LcpDown()
|
LcpDown()
|
||||||
{ /* Sudden death */
|
{ /* Sudden death */
|
||||||
LcpFailedMagic = 0;
|
LcpInfo.LcpFailedMagic = 0;
|
||||||
FsmDown(&LcpFsm);
|
FsmDown(&LcpFsm);
|
||||||
/* FsmDown() results in a LcpLayerDown() if we're currently open. */
|
/* FsmDown() results in a LcpLayerDown() if we're currently open. */
|
||||||
LcpLayerFinish(&LcpFsm);
|
LcpLayerFinish(&LcpFsm);
|
||||||
@ -462,7 +457,7 @@ void
|
|||||||
LcpOpen(int open_mode)
|
LcpOpen(int open_mode)
|
||||||
{
|
{
|
||||||
LcpFsm.open_mode = open_mode;
|
LcpFsm.open_mode = open_mode;
|
||||||
LcpFailedMagic = 0;
|
LcpInfo.LcpFailedMagic = 0;
|
||||||
FsmOpen(&LcpFsm);
|
FsmOpen(&LcpFsm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,7 +467,7 @@ LcpClose(struct fsm *fp)
|
|||||||
NewPhase(fp->physical, PHASE_TERMINATE);
|
NewPhase(fp->physical, PHASE_TERMINATE);
|
||||||
OsInterfaceDown(0);
|
OsInterfaceDown(0);
|
||||||
FsmClose(fp);
|
FsmClose(fp);
|
||||||
LcpFailedMagic = 0;
|
LcpInfo.LcpFailedMagic = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -697,17 +692,17 @@ LcpDecodeConfig(u_char *cp, int plen, int mode_type)
|
|||||||
/* Validate magic number */
|
/* Validate magic number */
|
||||||
if (magic == LcpInfo.want_magic) {
|
if (magic == LcpInfo.want_magic) {
|
||||||
LogPrintf(LogLCP, "Magic is same (%08lx) - %d times\n",
|
LogPrintf(LogLCP, "Magic is same (%08lx) - %d times\n",
|
||||||
(u_long)magic, ++LcpFailedMagic);
|
(u_long)magic, ++LcpInfo.LcpFailedMagic);
|
||||||
LcpInfo.want_magic = GenerateMagic();
|
LcpInfo.want_magic = GenerateMagic();
|
||||||
memcpy(nakp, cp, 6);
|
memcpy(nakp, cp, 6);
|
||||||
nakp += 6;
|
nakp += 6;
|
||||||
ualarm(TICKUNIT * (4 + 4 * LcpFailedMagic), 0);
|
ualarm(TICKUNIT * (4 + 4 * LcpInfo.LcpFailedMagic), 0);
|
||||||
sigpause(0);
|
sigpause(0);
|
||||||
} else {
|
} else {
|
||||||
LcpInfo.his_magic = magic;
|
LcpInfo.his_magic = magic;
|
||||||
memcpy(ackp, cp, length);
|
memcpy(ackp, cp, length);
|
||||||
ackp += length;
|
ackp += length;
|
||||||
LcpFailedMagic = 0;
|
LcpInfo.LcpFailedMagic = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LcpInfo.my_reject |= (1 << type);
|
LcpInfo.my_reject |= (1 << type);
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: lcp.h,v 1.16 1998/01/11 17:50:38 brian Exp $
|
* $Id: lcp.h,v 1.16.2.1 1998/01/29 00:49:25 brian Exp $
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
*/
|
*/
|
||||||
@ -23,27 +23,30 @@
|
|||||||
#define REJECTED(p, x) ((p)->his_reject & (1<<(x)))
|
#define REJECTED(p, x) ((p)->his_reject & (1<<(x)))
|
||||||
|
|
||||||
struct lcpstate {
|
struct lcpstate {
|
||||||
u_int16_t his_mru;
|
u_int16_t his_mru; /* Peers maximum packet size */
|
||||||
u_int32_t his_accmap;
|
u_int32_t his_accmap; /* Peeers async char control map */
|
||||||
u_int32_t his_magic;
|
u_int32_t his_magic; /* Peers magic number */
|
||||||
u_int32_t his_lqrperiod;
|
u_int32_t his_lqrperiod; /* Peers LQR frequency */
|
||||||
u_char his_protocomp;
|
int his_protocomp : 1; /* Does peer do Protocol field compression */
|
||||||
u_char his_acfcomp;
|
int his_acfcomp : 1; /* Does peer do addr & cntrl fld compression */
|
||||||
u_short his_auth;
|
u_short his_auth; /* Peer wants this type of authentication */
|
||||||
|
|
||||||
u_short want_mru;
|
u_short want_mru; /* Our maximum packet size */
|
||||||
u_int32_t want_accmap;
|
u_int32_t want_accmap; /* Our async char control map */
|
||||||
u_int32_t want_magic;
|
u_int32_t want_magic; /* Our magic number */
|
||||||
u_int32_t want_lqrperiod;
|
u_int32_t want_lqrperiod; /* Our LQR frequency */
|
||||||
u_char want_protocomp;
|
int want_protocomp : 1; /* Do we do protocol field compression */
|
||||||
u_char want_acfcomp;
|
int want_acfcomp : 1; /* Do we do addr & cntrl fld compression */
|
||||||
u_short want_auth;
|
u_short want_auth; /* We want this type of authentication */
|
||||||
|
|
||||||
u_int32_t his_reject; /* Request codes rejected by peer */
|
u_int32_t his_reject; /* Request codes rejected by peer */
|
||||||
u_int32_t my_reject; /* Request codes I have rejected */
|
u_int32_t my_reject; /* Request codes I have rejected */
|
||||||
|
|
||||||
u_short auth_iwait;
|
u_short auth_iwait; /* I must authenticate to the peer */
|
||||||
u_short auth_ineed;
|
u_short auth_ineed; /* I require that the peer authenticates */
|
||||||
|
|
||||||
|
int LcpFailedMagic; /* Number of `magic is same' errors */
|
||||||
|
struct pppTimer ReportTimer; /* Moan about hdlc errors every 60 seconds */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LCP_MAXCODE CODE_DISCREQ
|
#define LCP_MAXCODE CODE_DISCREQ
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: lqr.c,v 1.22 1998/01/21 02:15:19 brian Exp $
|
* $Id: lqr.c,v 1.22.2.1 1998/01/29 00:49:25 brian Exp $
|
||||||
*
|
*
|
||||||
* o LQR based on RFC1333
|
* o LQR based on RFC1333
|
||||||
*
|
*
|
||||||
@ -198,7 +198,6 @@ LqrInput(struct physical *physical, struct mbuf * bp)
|
|||||||
void
|
void
|
||||||
StartLqm(struct physical *physical)
|
StartLqm(struct physical *physical)
|
||||||
{
|
{
|
||||||
struct lcpstate *lcp = &LcpInfo;
|
|
||||||
int period;
|
int period;
|
||||||
|
|
||||||
lqrsendcnt = 0; /* start waiting all over for ECHOs */
|
lqrsendcnt = 0; /* start waiting all over for ECHOs */
|
||||||
@ -211,12 +210,13 @@ StartLqm(struct physical *physical)
|
|||||||
StopTimer(&LqrTimer);
|
StopTimer(&LqrTimer);
|
||||||
LogPrintf(LogLQM, "LQM method = %d\n", lqmmethod);
|
LogPrintf(LogLQM, "LQM method = %d\n", lqmmethod);
|
||||||
|
|
||||||
if (lcp->his_lqrperiod || lcp->want_lqrperiod) {
|
if (LcpInfo.his_lqrperiod || LcpInfo.want_lqrperiod) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We need to run timer. Let's figure out period.
|
* We need to run timer. Let's figure out period.
|
||||||
*/
|
*/
|
||||||
period = lcp->his_lqrperiod ? lcp->his_lqrperiod : lcp->want_lqrperiod;
|
period = LcpInfo.his_lqrperiod ?
|
||||||
|
LcpInfo.his_lqrperiod : LcpInfo.want_lqrperiod;
|
||||||
StopTimer(&LqrTimer);
|
StopTimer(&LqrTimer);
|
||||||
LqrTimer.state = TIMER_STOPPED;
|
LqrTimer.state = TIMER_STOPPED;
|
||||||
LqrTimer.load = period * SECTICKS / 100;
|
LqrTimer.load = period * SECTICKS / 100;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: pap.c,v 1.20 1997/12/24 09:29:11 brian Exp $
|
* $Id: pap.c,v 1.20.2.1 1998/01/29 00:49:27 brian Exp $
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
*/
|
*/
|
||||||
@ -149,7 +149,6 @@ PapInput(struct mbuf * bp, struct physical *physical)
|
|||||||
{
|
{
|
||||||
int len = plength(bp);
|
int len = plength(bp);
|
||||||
struct fsmheader *php;
|
struct fsmheader *php;
|
||||||
struct lcpstate *lcp = &LcpInfo;
|
|
||||||
u_char *cp;
|
u_char *cp;
|
||||||
|
|
||||||
if (len >= sizeof(struct fsmheader)) {
|
if (len >= sizeof(struct fsmheader)) {
|
||||||
@ -164,8 +163,8 @@ PapInput(struct mbuf * bp, struct physical *physical)
|
|||||||
cp = (u_char *) (php + 1);
|
cp = (u_char *) (php + 1);
|
||||||
if (PapValidate(cp, cp + *cp + 1, physical)) {
|
if (PapValidate(cp, cp + *cp + 1, physical)) {
|
||||||
SendPapCode(php->id, PAP_ACK, "Greetings!!", physical);
|
SendPapCode(php->id, PAP_ACK, "Greetings!!", physical);
|
||||||
lcp->auth_ineed = 0;
|
LcpInfo.auth_ineed = 0;
|
||||||
if (lcp->auth_iwait == 0) {
|
if (LcpInfo.auth_iwait == 0) {
|
||||||
if ((mode & MODE_DIRECT) && Physical_IsATTY(physical) &&
|
if ((mode & MODE_DIRECT) && Physical_IsATTY(physical) &&
|
||||||
Enabled(ConfUtmp))
|
Enabled(ConfUtmp))
|
||||||
if (Utmp)
|
if (Utmp)
|
||||||
@ -196,9 +195,9 @@ PapInput(struct mbuf * bp, struct physical *physical)
|
|||||||
len = *cp++;
|
len = *cp++;
|
||||||
cp[len] = 0;
|
cp[len] = 0;
|
||||||
LogPrintf(LogPHASE, "Received PAP_ACK (%s)\n", cp);
|
LogPrintf(LogPHASE, "Received PAP_ACK (%s)\n", cp);
|
||||||
if (lcp->auth_iwait == PROTO_PAP) {
|
if (LcpInfo.auth_iwait == PROTO_PAP) {
|
||||||
lcp->auth_iwait = 0;
|
LcpInfo.auth_iwait = 0;
|
||||||
if (lcp->auth_ineed == 0)
|
if (LcpInfo.auth_ineed == 0)
|
||||||
NewPhase(physical, PHASE_NETWORK);
|
NewPhase(physical, PHASE_NETWORK);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: phase.c,v 1.6.4.1 1998/01/29 00:49:28 brian Exp $
|
* $Id: phase.c,v 1.6.4.2 1998/01/29 23:11:41 brian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -34,9 +34,9 @@
|
|||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "mbuf.h"
|
#include "mbuf.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "timer.h"
|
||||||
#include "lcp.h"
|
#include "lcp.h"
|
||||||
#include "lcpproto.h"
|
#include "lcpproto.h"
|
||||||
#include "timer.h"
|
|
||||||
#include "auth.h"
|
#include "auth.h"
|
||||||
#include "pap.h"
|
#include "pap.h"
|
||||||
#include "chap.h"
|
#include "chap.h"
|
||||||
@ -73,21 +73,19 @@ Auth2Nam(u_short auth)
|
|||||||
void
|
void
|
||||||
NewPhase(struct physical *physical, int new)
|
NewPhase(struct physical *physical, int new)
|
||||||
{
|
{
|
||||||
struct lcpstate *lcp = &LcpInfo;
|
|
||||||
|
|
||||||
phase = new;
|
phase = new;
|
||||||
LogPrintf(LogPHASE, "NewPhase: %s\n", PhaseNames[phase]);
|
LogPrintf(LogPHASE, "NewPhase: %s\n", PhaseNames[phase]);
|
||||||
switch (phase) {
|
switch (phase) {
|
||||||
case PHASE_AUTHENTICATE:
|
case PHASE_AUTHENTICATE:
|
||||||
lcp->auth_ineed = lcp->want_auth;
|
LcpInfo.auth_ineed = LcpInfo.want_auth;
|
||||||
lcp->auth_iwait = lcp->his_auth;
|
LcpInfo.auth_iwait = LcpInfo.his_auth;
|
||||||
if (lcp->his_auth || lcp->want_auth) {
|
if (LcpInfo.his_auth || LcpInfo.want_auth) {
|
||||||
LogPrintf(LogPHASE, " his = %s, mine = %s\n",
|
LogPrintf(LogPHASE, " his = %s, mine = %s\n",
|
||||||
Auth2Nam(lcp->his_auth), Auth2Nam(lcp->want_auth));
|
Auth2Nam(LcpInfo.his_auth), Auth2Nam(LcpInfo.want_auth));
|
||||||
/* XXX-ML AuthPapInfo and AuthChapInfo must be allocated! */
|
/* XXX-ML AuthPapInfo and AuthChapInfo must be allocated! */
|
||||||
if (lcp->his_auth == PROTO_PAP)
|
if (LcpInfo.his_auth == PROTO_PAP)
|
||||||
StartAuthChallenge(&AuthPapInfo, physical);
|
StartAuthChallenge(&AuthPapInfo, physical);
|
||||||
if (lcp->want_auth == PROTO_CHAP)
|
if (LcpInfo.want_auth == PROTO_CHAP)
|
||||||
StartAuthChallenge(&AuthChapInfo, physical);
|
StartAuthChallenge(&AuthChapInfo, physical);
|
||||||
} else
|
} else
|
||||||
NewPhase(physical, PHASE_NETWORK);
|
NewPhase(physical, PHASE_NETWORK);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user