mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
PPP, CCP, reworked to our ppp_pcb* pointer and ppp_pcb->ccp* data field
This commit is contained in:
parent
7174578ac3
commit
1dcd4cc220
@ -168,19 +168,19 @@ static option_t ccp_option_list[] = {
|
|||||||
/*
|
/*
|
||||||
* Protocol entry points from main code.
|
* Protocol entry points from main code.
|
||||||
*/
|
*/
|
||||||
static void ccp_init (int unit);
|
static void ccp_init(ppp_pcb *pcb);
|
||||||
static void ccp_open (int unit);
|
static void ccp_open(ppp_pcb *pcb);
|
||||||
static void ccp_close (int unit, const char *);
|
static void ccp_close(ppp_pcb *pcb, const char *reason);
|
||||||
static void ccp_lowerup (int unit);
|
static void ccp_lowerup(ppp_pcb *pcb);
|
||||||
static void ccp_lowerdown (int);
|
static void ccp_lowerdown(ppp_pcb *pcb);
|
||||||
static void ccp_input (int unit, u_char *pkt, int len);
|
static void ccp_input(ppp_pcb *pcb, u_char *pkt, int len);
|
||||||
static void ccp_protrej (int unit);
|
static void ccp_protrej(ppp_pcb *pcb);
|
||||||
#if PRINTPKT_SUPPORT
|
#if PRINTPKT_SUPPORT
|
||||||
static int ccp_printpkt (u_char *pkt, int len,
|
static int ccp_printpkt (u_char *pkt, int len,
|
||||||
void (*printer) (void *, char *, ...),
|
void (*printer) (void *, char *, ...),
|
||||||
void *arg);
|
void *arg);
|
||||||
#endif /* PRINTPKT_SUPPORT */
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
static void ccp_datainput (int unit, u_char *pkt, int len);
|
static void ccp_datainput(ppp_pcb *pcb, u_char *pkt, int len);
|
||||||
|
|
||||||
const struct protent ccp_protent = {
|
const struct protent ccp_protent = {
|
||||||
PPP_CCP,
|
PPP_CCP,
|
||||||
@ -355,57 +355,57 @@ setdeflate(argv)
|
|||||||
/*
|
/*
|
||||||
* ccp_init - initialize CCP.
|
* ccp_init - initialize CCP.
|
||||||
*/
|
*/
|
||||||
static void
|
static void ccp_init(ppp_pcb *pcb) {
|
||||||
ccp_init(unit)
|
fsm *f = &pcb->ccp_fsm;
|
||||||
int unit;
|
ccp_options *wo = &pcb->ccp_wantoptions;
|
||||||
{
|
ccp_options *go = &pcb->ccp_gotoptions;
|
||||||
fsm *f = &ccp_fsm[unit];
|
ccp_options *ao = &pcb->ccp_allowoptions;
|
||||||
|
ccp_options *ho = &pcb->ccp_hisoptions;
|
||||||
|
|
||||||
f->unit = unit;
|
f->pcb = pcb;
|
||||||
f->protocol = PPP_CCP;
|
f->protocol = PPP_CCP;
|
||||||
f->callbacks = &ccp_callbacks;
|
f->callbacks = &ccp_callbacks;
|
||||||
fsm_init(f);
|
fsm_init(f);
|
||||||
|
|
||||||
memset(&ccp_wantoptions[unit], 0, sizeof(ccp_options));
|
/* FIXME: useless, everything is cleared in ppp_clear() */
|
||||||
memset(&ccp_gotoptions[unit], 0, sizeof(ccp_options));
|
memset(wo, 0, sizeof(*wo));
|
||||||
memset(&ccp_allowoptions[unit], 0, sizeof(ccp_options));
|
memset(go, 0, sizeof(*go));
|
||||||
memset(&ccp_hisoptions[unit], 0, sizeof(ccp_options));
|
memset(ao, 0, sizeof(*ao));
|
||||||
|
memset(ho, 0, sizeof(*ho));
|
||||||
|
|
||||||
ccp_wantoptions[0].deflate = 1;
|
wo->deflate = 1;
|
||||||
ccp_wantoptions[0].deflate_size = DEFLATE_MAX_SIZE;
|
wo->deflate_size = DEFLATE_MAX_SIZE;
|
||||||
ccp_wantoptions[0].deflate_correct = 1;
|
wo->deflate_correct = 1;
|
||||||
ccp_wantoptions[0].deflate_draft = 1;
|
wo->deflate_draft = 1;
|
||||||
ccp_allowoptions[0].deflate = 1;
|
ao->deflate = 1;
|
||||||
ccp_allowoptions[0].deflate_size = DEFLATE_MAX_SIZE;
|
ao->deflate_size = DEFLATE_MAX_SIZE;
|
||||||
ccp_allowoptions[0].deflate_correct = 1;
|
ao->deflate_correct = 1;
|
||||||
ccp_allowoptions[0].deflate_draft = 1;
|
ao->deflate_draft = 1;
|
||||||
|
|
||||||
ccp_wantoptions[0].bsd_compress = 1;
|
wo->bsd_compress = 1;
|
||||||
ccp_wantoptions[0].bsd_bits = BSD_MAX_BITS;
|
wo->bsd_bits = BSD_MAX_BITS;
|
||||||
ccp_allowoptions[0].bsd_compress = 1;
|
ao->bsd_compress = 1;
|
||||||
ccp_allowoptions[0].bsd_bits = BSD_MAX_BITS;
|
ao->bsd_bits = BSD_MAX_BITS;
|
||||||
|
|
||||||
ccp_allowoptions[0].predictor_1 = 1;
|
ao->predictor_1 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ccp_open - CCP is allowed to come up.
|
* ccp_open - CCP is allowed to come up.
|
||||||
*/
|
*/
|
||||||
static void
|
static void ccp_open(ppp_pcb *pcb) {
|
||||||
ccp_open(unit)
|
fsm *f = &pcb->ccp_fsm;
|
||||||
int unit;
|
ccp_options *go = &pcb->ccp_gotoptions;
|
||||||
{
|
|
||||||
fsm *f = &ccp_fsm[unit];
|
|
||||||
|
|
||||||
if (f->state != PPP_FSM_OPENED)
|
if (f->state != PPP_FSM_OPENED)
|
||||||
ccp_flags_set(unit, 1, 0);
|
ccp_flags_set(pcb, 1, 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find out which compressors the kernel supports before
|
* Find out which compressors the kernel supports before
|
||||||
* deciding whether to open in silent mode.
|
* deciding whether to open in silent mode.
|
||||||
*/
|
*/
|
||||||
ccp_resetci(f);
|
ccp_resetci(f);
|
||||||
if (!ANY_COMPRESS(ccp_gotoptions[unit]))
|
if (!ANY_COMPRESS(go))
|
||||||
f->flags |= OPT_SILENT;
|
f->flags |= OPT_SILENT;
|
||||||
|
|
||||||
fsm_open(f);
|
fsm_open(f);
|
||||||
@ -414,45 +414,34 @@ ccp_open(unit)
|
|||||||
/*
|
/*
|
||||||
* ccp_close - Terminate CCP.
|
* ccp_close - Terminate CCP.
|
||||||
*/
|
*/
|
||||||
static void
|
static void ccp_close(ppp_pcb *pcb, const char *reason) {
|
||||||
ccp_close(unit, reason)
|
fsm *f = &pcb->ccp_fsm;
|
||||||
int unit;
|
ccp_flags_set(pcb, 0, 0);
|
||||||
const char *reason;
|
fsm_close(f, reason);
|
||||||
{
|
|
||||||
ccp_flags_set(unit, 0, 0);
|
|
||||||
fsm_close(&ccp_fsm[unit], reason);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ccp_lowerup - we may now transmit CCP packets.
|
* ccp_lowerup - we may now transmit CCP packets.
|
||||||
*/
|
*/
|
||||||
static void
|
static void ccp_lowerup(ppp_pcb *pcb) {
|
||||||
ccp_lowerup(unit)
|
fsm *f = &pcb->ccp_fsm;
|
||||||
int unit;
|
fsm_lowerup(f);
|
||||||
{
|
|
||||||
fsm_lowerup(&ccp_fsm[unit]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ccp_lowerdown - we may not transmit CCP packets.
|
* ccp_lowerdown - we may not transmit CCP packets.
|
||||||
*/
|
*/
|
||||||
static void
|
static void ccp_lowerdown(ppp_pcb *pcb) {
|
||||||
ccp_lowerdown(unit)
|
fsm *f = &pcb->ccp_fsm;
|
||||||
int unit;
|
fsm_lowerdown(f);
|
||||||
{
|
|
||||||
fsm_lowerdown(&ccp_fsm[unit]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ccp_input - process a received CCP packet.
|
* ccp_input - process a received CCP packet.
|
||||||
*/
|
*/
|
||||||
static void
|
static void ccp_input(ppp_pcb *pcb, u_char *p, int len) {
|
||||||
ccp_input(unit, p, len)
|
fsm *f = &pcb->ccp_fsm;
|
||||||
int unit;
|
ccp_options *go = &pcb->ccp_gotoptions;
|
||||||
u_char *p;
|
|
||||||
int len;
|
|
||||||
{
|
|
||||||
fsm *f = &ccp_fsm[unit];
|
|
||||||
int oldstate;
|
int oldstate;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -463,9 +452,9 @@ ccp_input(unit, p, len)
|
|||||||
if (oldstate == PPP_FSM_OPENED && p[0] == TERMREQ && f->state != PPP_FSM_OPENED) {
|
if (oldstate == PPP_FSM_OPENED && p[0] == TERMREQ && f->state != PPP_FSM_OPENED) {
|
||||||
notice("Compression disabled by peer.");
|
notice("Compression disabled by peer.");
|
||||||
#ifdef MPPE
|
#ifdef MPPE
|
||||||
if (ccp_gotoptions[unit].mppe) {
|
if (go->mppe) {
|
||||||
error("MPPE disabled, closing LCP");
|
error("MPPE disabled, closing LCP");
|
||||||
lcp_close(unit, "MPPE disabled by peer");
|
lcp_close(pcb, "MPPE disabled by peer");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -475,20 +464,16 @@ ccp_input(unit, p, len)
|
|||||||
* close CCP.
|
* close CCP.
|
||||||
*/
|
*/
|
||||||
if (oldstate == PPP_FSM_REQSENT && p[0] == TERMACK
|
if (oldstate == PPP_FSM_REQSENT && p[0] == TERMACK
|
||||||
&& !ANY_COMPRESS(ccp_gotoptions[unit]))
|
&& !ANY_COMPRESS(go))
|
||||||
ccp_close(unit, "No compression negotiated");
|
ccp_close(pcb, "No compression negotiated");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle a CCP-specific code.
|
* Handle a CCP-specific code.
|
||||||
*/
|
*/
|
||||||
static int
|
static int ccp_extcode(fsm *f, int code, int id, u_char *p, int len) {
|
||||||
ccp_extcode(f, code, id, p, len)
|
ppp_pcb *pcb = f->pcb;
|
||||||
fsm *f;
|
|
||||||
int code, id;
|
|
||||||
u_char *p;
|
|
||||||
int len;
|
|
||||||
{
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case CCP_RESETREQ:
|
case CCP_RESETREQ:
|
||||||
if (f->state != PPP_FSM_OPENED)
|
if (f->state != PPP_FSM_OPENED)
|
||||||
@ -499,8 +484,8 @@ ccp_extcode(f, code, id, p, len)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CCP_RESETACK:
|
case CCP_RESETACK:
|
||||||
if (ccp_localstate[f->unit] & RACK_PENDING && id == f->reqid) {
|
if ((pcb->ccp_localstate & RACK_PENDING) && id == f->reqid) {
|
||||||
ccp_localstate[f->unit] &= ~(RACK_PENDING | RREQ_REPEAT);
|
pcb->ccp_localstate &= ~(RACK_PENDING | RREQ_REPEAT);
|
||||||
UNTIMEOUT(ccp_rack_timeout, f);
|
UNTIMEOUT(ccp_rack_timeout, f);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -515,17 +500,17 @@ ccp_extcode(f, code, id, p, len)
|
|||||||
/*
|
/*
|
||||||
* ccp_protrej - peer doesn't talk CCP.
|
* ccp_protrej - peer doesn't talk CCP.
|
||||||
*/
|
*/
|
||||||
static void
|
static void ccp_protrej(ppp_pcb *pcb) {
|
||||||
ccp_protrej(unit)
|
fsm *f = &pcb->ccp_fsm;
|
||||||
int unit;
|
ccp_options *go = &pcb->ccp_gotoptions;
|
||||||
{
|
|
||||||
ccp_flags_set(unit, 0, 0);
|
ccp_flags_set(pcb, 0, 0);
|
||||||
fsm_lowerdown(&ccp_fsm[unit]);
|
fsm_lowerdown(f);
|
||||||
|
|
||||||
#ifdef MPPE
|
#ifdef MPPE
|
||||||
if (ccp_gotoptions[unit].mppe) {
|
if (go->mppe) {
|
||||||
error("MPPE required but peer negotiation failed");
|
error("MPPE required but peer negotiation failed");
|
||||||
lcp_close(unit, "MPPE required but peer negotiation failed");
|
lcp_close(pcb, "MPPE required but peer negotiation failed");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -534,20 +519,19 @@ ccp_protrej(unit)
|
|||||||
/*
|
/*
|
||||||
* ccp_resetci - initialize at start of negotiation.
|
* ccp_resetci - initialize at start of negotiation.
|
||||||
*/
|
*/
|
||||||
static void
|
static void ccp_resetci(fsm *f) {
|
||||||
ccp_resetci(f)
|
ppp_pcb *pcb = f->pcb;
|
||||||
fsm *f;
|
ccp_options *go = &pcb->ccp_gotoptions;
|
||||||
{
|
ccp_options *wo = &pcb->ccp_wantoptions;
|
||||||
ccp_options *go = &ccp_gotoptions[f->unit];
|
|
||||||
u_char opt_buf[CCP_MAX_OPTION_LENGTH];
|
u_char opt_buf[CCP_MAX_OPTION_LENGTH];
|
||||||
|
|
||||||
*go = ccp_wantoptions[f->unit];
|
*go = *wo;
|
||||||
all_rejected[f->unit] = 0;
|
pcb->all_rejected = 0;
|
||||||
|
|
||||||
#ifdef MPPE
|
#ifdef MPPE
|
||||||
if (go->mppe) {
|
if (go->mppe) {
|
||||||
ccp_options *ao = &ccp_allowoptions[f->unit];
|
ccp_options *ao = &pcb->ccp_allowoptions;
|
||||||
int auth_mschap_bits = auth_done[f->unit];
|
int auth_mschap_bits = pcb->auth_done;
|
||||||
int numbits;
|
int numbits;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -572,12 +556,12 @@ ccp_resetci(f)
|
|||||||
} while (auth_mschap_bits);
|
} while (auth_mschap_bits);
|
||||||
if (numbits > 1) {
|
if (numbits > 1) {
|
||||||
error("MPPE required, but auth done in both directions.");
|
error("MPPE required, but auth done in both directions.");
|
||||||
lcp_close(f->unit, "MPPE required but not available");
|
lcp_close(pcb, "MPPE required but not available");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!numbits) {
|
if (!numbits) {
|
||||||
error("MPPE required, but MS-CHAP[v2] auth not performed.");
|
error("MPPE required, but MS-CHAP[v2] auth not performed.");
|
||||||
lcp_close(f->unit, "MPPE required but not available");
|
lcp_close(pcb, "MPPE required but not available");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -585,17 +569,17 @@ ccp_resetci(f)
|
|||||||
if (!mppe_keys_set) {
|
if (!mppe_keys_set) {
|
||||||
error("MPPE required, but keys are not available. "
|
error("MPPE required, but keys are not available. "
|
||||||
"Possible plugin problem?");
|
"Possible plugin problem?");
|
||||||
lcp_close(f->unit, "MPPE required but not available");
|
lcp_close(pcb, "MPPE required but not available");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LM auth not supported for MPPE */
|
/* LM auth not supported for MPPE */
|
||||||
if (auth_done[f->unit] & (CHAP_MS_WITHPEER | CHAP_MS_PEER)) {
|
if (pcb->auth_done & (CHAP_MS_WITHPEER | CHAP_MS_PEER)) {
|
||||||
/* This might be noise */
|
/* This might be noise */
|
||||||
if (go->mppe & MPPE_OPT_40) {
|
if (go->mppe & MPPE_OPT_40) {
|
||||||
notice("Disabling 40-bit MPPE; MS-CHAP LM not supported");
|
notice("Disabling 40-bit MPPE; MS-CHAP LM not supported");
|
||||||
go->mppe &= ~MPPE_OPT_40;
|
go->mppe &= ~MPPE_OPT_40;
|
||||||
ccp_wantoptions[f->unit].mppe &= ~MPPE_OPT_40;
|
wo->mppe &= ~MPPE_OPT_40;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -603,7 +587,7 @@ ccp_resetci(f)
|
|||||||
if (!(go->mppe & (MPPE_OPT_40 | MPPE_OPT_128))) {
|
if (!(go->mppe & (MPPE_OPT_40 | MPPE_OPT_128))) {
|
||||||
/* Could be misconfig, could be 40-bit disabled above. */
|
/* Could be misconfig, could be 40-bit disabled above. */
|
||||||
error("MPPE required, but both 40-bit and 128-bit disabled.");
|
error("MPPE required, but both 40-bit and 128-bit disabled.");
|
||||||
lcp_close(f->unit, "MPPE required but not available");
|
lcp_close(pcb, "MPPE required but not available");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -627,9 +611,9 @@ ccp_resetci(f)
|
|||||||
opt_buf[1] = CILEN_MPPE;
|
opt_buf[1] = CILEN_MPPE;
|
||||||
MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]);
|
MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]);
|
||||||
/* Key material unimportant here. */
|
/* Key material unimportant here. */
|
||||||
if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0) {
|
if (ccp_test(pcb, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0) {
|
||||||
error("MPPE required, but kernel has no support.");
|
error("MPPE required, but kernel has no support.");
|
||||||
lcp_close(f->unit, "MPPE required but not available");
|
lcp_close(pcb, "MPPE required but not available");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -637,7 +621,7 @@ ccp_resetci(f)
|
|||||||
opt_buf[0] = CI_BSD_COMPRESS;
|
opt_buf[0] = CI_BSD_COMPRESS;
|
||||||
opt_buf[1] = CILEN_BSD_COMPRESS;
|
opt_buf[1] = CILEN_BSD_COMPRESS;
|
||||||
opt_buf[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION, BSD_MIN_BITS);
|
opt_buf[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION, BSD_MIN_BITS);
|
||||||
if (ccp_test(f->unit, opt_buf, CILEN_BSD_COMPRESS, 0) <= 0)
|
if (ccp_test(pcb, opt_buf, CILEN_BSD_COMPRESS, 0) <= 0)
|
||||||
go->bsd_compress = 0;
|
go->bsd_compress = 0;
|
||||||
}
|
}
|
||||||
if (go->deflate) {
|
if (go->deflate) {
|
||||||
@ -646,7 +630,7 @@ ccp_resetci(f)
|
|||||||
opt_buf[1] = CILEN_DEFLATE;
|
opt_buf[1] = CILEN_DEFLATE;
|
||||||
opt_buf[2] = DEFLATE_MAKE_OPT(DEFLATE_MIN_WORKS);
|
opt_buf[2] = DEFLATE_MAKE_OPT(DEFLATE_MIN_WORKS);
|
||||||
opt_buf[3] = DEFLATE_CHK_SEQUENCE;
|
opt_buf[3] = DEFLATE_CHK_SEQUENCE;
|
||||||
if (ccp_test(f->unit, opt_buf, CILEN_DEFLATE, 0) <= 0)
|
if (ccp_test(pcb, opt_buf, CILEN_DEFLATE, 0) <= 0)
|
||||||
go->deflate_correct = 0;
|
go->deflate_correct = 0;
|
||||||
}
|
}
|
||||||
if (go->deflate_draft) {
|
if (go->deflate_draft) {
|
||||||
@ -654,7 +638,7 @@ ccp_resetci(f)
|
|||||||
opt_buf[1] = CILEN_DEFLATE;
|
opt_buf[1] = CILEN_DEFLATE;
|
||||||
opt_buf[2] = DEFLATE_MAKE_OPT(DEFLATE_MIN_WORKS);
|
opt_buf[2] = DEFLATE_MAKE_OPT(DEFLATE_MIN_WORKS);
|
||||||
opt_buf[3] = DEFLATE_CHK_SEQUENCE;
|
opt_buf[3] = DEFLATE_CHK_SEQUENCE;
|
||||||
if (ccp_test(f->unit, opt_buf, CILEN_DEFLATE, 0) <= 0)
|
if (ccp_test(pcb, opt_buf, CILEN_DEFLATE, 0) <= 0)
|
||||||
go->deflate_draft = 0;
|
go->deflate_draft = 0;
|
||||||
}
|
}
|
||||||
if (!go->deflate_correct && !go->deflate_draft)
|
if (!go->deflate_correct && !go->deflate_draft)
|
||||||
@ -663,13 +647,13 @@ ccp_resetci(f)
|
|||||||
if (go->predictor_1) {
|
if (go->predictor_1) {
|
||||||
opt_buf[0] = CI_PREDICTOR_1;
|
opt_buf[0] = CI_PREDICTOR_1;
|
||||||
opt_buf[1] = CILEN_PREDICTOR_1;
|
opt_buf[1] = CILEN_PREDICTOR_1;
|
||||||
if (ccp_test(f->unit, opt_buf, CILEN_PREDICTOR_1, 0) <= 0)
|
if (ccp_test(pcb, opt_buf, CILEN_PREDICTOR_1, 0) <= 0)
|
||||||
go->predictor_1 = 0;
|
go->predictor_1 = 0;
|
||||||
}
|
}
|
||||||
if (go->predictor_2) {
|
if (go->predictor_2) {
|
||||||
opt_buf[0] = CI_PREDICTOR_2;
|
opt_buf[0] = CI_PREDICTOR_2;
|
||||||
opt_buf[1] = CILEN_PREDICTOR_2;
|
opt_buf[1] = CILEN_PREDICTOR_2;
|
||||||
if (ccp_test(f->unit, opt_buf, CILEN_PREDICTOR_2, 0) <= 0)
|
if (ccp_test(pcb, opt_buf, CILEN_PREDICTOR_2, 0) <= 0)
|
||||||
go->predictor_2 = 0;
|
go->predictor_2 = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -677,11 +661,9 @@ ccp_resetci(f)
|
|||||||
/*
|
/*
|
||||||
* ccp_cilen - Return total length of our configuration info.
|
* ccp_cilen - Return total length of our configuration info.
|
||||||
*/
|
*/
|
||||||
static int
|
static int ccp_cilen(fsm *f) {
|
||||||
ccp_cilen(f)
|
ppp_pcb *pcb = f->pcb;
|
||||||
fsm *f;
|
ccp_options *go = &pcb->ccp_gotoptions;
|
||||||
{
|
|
||||||
ccp_options *go = &ccp_gotoptions[f->unit];
|
|
||||||
|
|
||||||
return (go->bsd_compress? CILEN_BSD_COMPRESS: 0)
|
return (go->bsd_compress? CILEN_BSD_COMPRESS: 0)
|
||||||
+ (go->deflate? CILEN_DEFLATE: 0)
|
+ (go->deflate? CILEN_DEFLATE: 0)
|
||||||
@ -693,14 +675,10 @@ ccp_cilen(f)
|
|||||||
/*
|
/*
|
||||||
* ccp_addci - put our requests in a packet.
|
* ccp_addci - put our requests in a packet.
|
||||||
*/
|
*/
|
||||||
static void
|
static void ccp_addci(fsm *f, u_char *p, int *lenp) {
|
||||||
ccp_addci(f, p, lenp)
|
|
||||||
fsm *f;
|
|
||||||
u_char *p;
|
|
||||||
int *lenp;
|
|
||||||
{
|
|
||||||
int res;
|
int res;
|
||||||
ccp_options *go = &ccp_gotoptions[f->unit];
|
ppp_pcb *pcb = f->pcb;
|
||||||
|
ccp_options *go = &pcb->ccp_gotoptions;
|
||||||
u_char *p0 = p;
|
u_char *p0 = p;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -717,12 +695,12 @@ ccp_addci(f, p, lenp)
|
|||||||
MPPE_OPTS_TO_CI(go->mppe, &p[2]);
|
MPPE_OPTS_TO_CI(go->mppe, &p[2]);
|
||||||
MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]);
|
MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]);
|
||||||
MEMCPY(&opt_buf[CILEN_MPPE], mppe_recv_key, MPPE_MAX_KEY_LEN);
|
MEMCPY(&opt_buf[CILEN_MPPE], mppe_recv_key, MPPE_MAX_KEY_LEN);
|
||||||
res = ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0);
|
res = ccp_test(pcb, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0);
|
||||||
if (res > 0)
|
if (res > 0)
|
||||||
p += CILEN_MPPE;
|
p += CILEN_MPPE;
|
||||||
else
|
else
|
||||||
/* This shouldn't happen, we've already tested it! */
|
/* This shouldn't happen, we've already tested it! */
|
||||||
lcp_close(f->unit, "MPPE required but not available in kernel");
|
lcp_close(pcb, "MPPE required but not available in kernel");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (go->deflate) {
|
if (go->deflate) {
|
||||||
@ -738,7 +716,7 @@ ccp_addci(f, p, lenp)
|
|||||||
go->deflate = 0;
|
go->deflate = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
res = ccp_test(f->unit, p, CILEN_DEFLATE, 0);
|
res = ccp_test(pcb, p, CILEN_DEFLATE, 0);
|
||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
p += CILEN_DEFLATE;
|
p += CILEN_DEFLATE;
|
||||||
break;
|
break;
|
||||||
@ -770,7 +748,7 @@ ccp_addci(f, p, lenp)
|
|||||||
go->bsd_compress = 0;
|
go->bsd_compress = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
res = ccp_test(f->unit, p, CILEN_BSD_COMPRESS, 0);
|
res = ccp_test(pcb, p, CILEN_BSD_COMPRESS, 0);
|
||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
p += CILEN_BSD_COMPRESS;
|
p += CILEN_BSD_COMPRESS;
|
||||||
break;
|
break;
|
||||||
@ -787,7 +765,7 @@ ccp_addci(f, p, lenp)
|
|||||||
if (go->predictor_1) {
|
if (go->predictor_1) {
|
||||||
p[0] = CI_PREDICTOR_1;
|
p[0] = CI_PREDICTOR_1;
|
||||||
p[1] = CILEN_PREDICTOR_1;
|
p[1] = CILEN_PREDICTOR_1;
|
||||||
if (p == p0 && ccp_test(f->unit, p, CILEN_PREDICTOR_1, 0) <= 0) {
|
if (p == p0 && ccp_test(pcb, p, CILEN_PREDICTOR_1, 0) <= 0) {
|
||||||
go->predictor_1 = 0;
|
go->predictor_1 = 0;
|
||||||
} else {
|
} else {
|
||||||
p += CILEN_PREDICTOR_1;
|
p += CILEN_PREDICTOR_1;
|
||||||
@ -796,7 +774,7 @@ ccp_addci(f, p, lenp)
|
|||||||
if (go->predictor_2) {
|
if (go->predictor_2) {
|
||||||
p[0] = CI_PREDICTOR_2;
|
p[0] = CI_PREDICTOR_2;
|
||||||
p[1] = CILEN_PREDICTOR_2;
|
p[1] = CILEN_PREDICTOR_2;
|
||||||
if (p == p0 && ccp_test(f->unit, p, CILEN_PREDICTOR_2, 0) <= 0) {
|
if (p == p0 && ccp_test(pcb, p, CILEN_PREDICTOR_2, 0) <= 0) {
|
||||||
go->predictor_2 = 0;
|
go->predictor_2 = 0;
|
||||||
} else {
|
} else {
|
||||||
p += CILEN_PREDICTOR_2;
|
p += CILEN_PREDICTOR_2;
|
||||||
@ -812,13 +790,9 @@ ccp_addci(f, p, lenp)
|
|||||||
* ccp_ackci - process a received configure-ack, and return
|
* ccp_ackci - process a received configure-ack, and return
|
||||||
* 1 iff the packet was OK.
|
* 1 iff the packet was OK.
|
||||||
*/
|
*/
|
||||||
static int
|
static int ccp_ackci(fsm *f, u_char *p, int len) {
|
||||||
ccp_ackci(f, p, len)
|
ppp_pcb *pcb = f->pcb;
|
||||||
fsm *f;
|
ccp_options *go = &pcb->ccp_gotoptions;
|
||||||
u_char *p;
|
|
||||||
int len;
|
|
||||||
{
|
|
||||||
ccp_options *go = &ccp_gotoptions[f->unit];
|
|
||||||
u_char *p0 = p;
|
u_char *p0 = p;
|
||||||
|
|
||||||
#ifdef MPPE
|
#ifdef MPPE
|
||||||
@ -901,14 +875,9 @@ ccp_ackci(f, p, len)
|
|||||||
* ccp_nakci - process received configure-nak.
|
* ccp_nakci - process received configure-nak.
|
||||||
* Returns 1 iff the nak was OK.
|
* Returns 1 iff the nak was OK.
|
||||||
*/
|
*/
|
||||||
static int
|
static int ccp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
|
||||||
ccp_nakci(f, p, len, treat_as_reject)
|
ppp_pcb *pcb = f->pcb;
|
||||||
fsm *f;
|
ccp_options *go = &pcb->ccp_gotoptions;
|
||||||
u_char *p;
|
|
||||||
int len;
|
|
||||||
int treat_as_reject;
|
|
||||||
{
|
|
||||||
ccp_options *go = &ccp_gotoptions[f->unit];
|
|
||||||
ccp_options no; /* options we've seen already */
|
ccp_options no; /* options we've seen already */
|
||||||
ccp_options try; /* options to ask for next time */
|
ccp_options try; /* options to ask for next time */
|
||||||
|
|
||||||
@ -934,7 +903,7 @@ ccp_nakci(f, p, len, treat_as_reject)
|
|||||||
|
|
||||||
if (!try.mppe) {
|
if (!try.mppe) {
|
||||||
error("MPPE required but peer negotiation failed");
|
error("MPPE required but peer negotiation failed");
|
||||||
lcp_close(f->unit, "MPPE required but peer negotiation failed");
|
lcp_close(pcb, "MPPE required but peer negotiation failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* MPPE */
|
#endif /* MPPE */
|
||||||
@ -991,13 +960,9 @@ ccp_nakci(f, p, len, treat_as_reject)
|
|||||||
/*
|
/*
|
||||||
* ccp_rejci - reject some of our suggested compression methods.
|
* ccp_rejci - reject some of our suggested compression methods.
|
||||||
*/
|
*/
|
||||||
static int
|
static int ccp_rejci(fsm *f, u_char *p, int len) {
|
||||||
ccp_rejci(f, p, len)
|
ppp_pcb *pcb = f->pcb;
|
||||||
fsm *f;
|
ccp_options *go = &pcb->ccp_gotoptions;
|
||||||
u_char *p;
|
|
||||||
int len;
|
|
||||||
{
|
|
||||||
ccp_options *go = &ccp_gotoptions[f->unit];
|
|
||||||
ccp_options try; /* options to request next time */
|
ccp_options try; /* options to request next time */
|
||||||
|
|
||||||
try = *go;
|
try = *go;
|
||||||
@ -1006,14 +971,14 @@ ccp_rejci(f, p, len)
|
|||||||
* Cope with empty configure-rejects by ceasing to send
|
* Cope with empty configure-rejects by ceasing to send
|
||||||
* configure-requests.
|
* configure-requests.
|
||||||
*/
|
*/
|
||||||
if (len == 0 && all_rejected[f->unit])
|
if (len == 0 && pcb->all_rejected)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
#ifdef MPPE
|
#ifdef MPPE
|
||||||
if (go->mppe && len >= CILEN_MPPE
|
if (go->mppe && len >= CILEN_MPPE
|
||||||
&& p[0] == CI_MPPE && p[1] == CILEN_MPPE) {
|
&& p[0] == CI_MPPE && p[1] == CILEN_MPPE) {
|
||||||
error("MPPE required but peer refused");
|
error("MPPE required but peer refused");
|
||||||
lcp_close(f->unit, "MPPE required but peer refused");
|
lcp_close(pcb, "MPPE required but peer refused");
|
||||||
p += CILEN_MPPE;
|
p += CILEN_MPPE;
|
||||||
len -= CILEN_MPPE;
|
len -= CILEN_MPPE;
|
||||||
}
|
}
|
||||||
@ -1073,19 +1038,13 @@ ccp_rejci(f, p, len)
|
|||||||
* Returns CONFACK, CONFNAK or CONFREJ and the packet modified
|
* Returns CONFACK, CONFNAK or CONFREJ and the packet modified
|
||||||
* appropriately.
|
* appropriately.
|
||||||
*/
|
*/
|
||||||
static int
|
static int ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak) {
|
||||||
ccp_reqci(f, p, lenp, dont_nak)
|
ppp_pcb *pcb = f->pcb;
|
||||||
fsm *f;
|
ccp_options *ho = &pcb->ccp_hisoptions;
|
||||||
u_char *p;
|
ccp_options *ao = &pcb->ccp_allowoptions;
|
||||||
int *lenp;
|
|
||||||
int dont_nak;
|
|
||||||
{
|
|
||||||
ppp_pcb *pcb = &ppp_pcb_list[f->unit];
|
|
||||||
int ret, newret, res;
|
int ret, newret, res;
|
||||||
u_char *p0, *retp;
|
u_char *p0, *retp;
|
||||||
int len, clen, type, nb;
|
int len, clen, type, nb;
|
||||||
ccp_options *ho = &ccp_hisoptions[f->unit];
|
|
||||||
ccp_options *ao = &ccp_allowoptions[f->unit];
|
|
||||||
#ifdef MPPE
|
#ifdef MPPE
|
||||||
bool rej_for_ci_mppe = 1; /* Are we rejecting based on a bad/missing */
|
bool rej_for_ci_mppe = 1; /* Are we rejecting based on a bad/missing */
|
||||||
/* CI_MPPE, or due to other options? */
|
/* CI_MPPE, or due to other options? */
|
||||||
@ -1184,11 +1143,11 @@ ccp_reqci(f, p, lenp, dont_nak)
|
|||||||
MEMCPY(opt_buf, p, CILEN_MPPE);
|
MEMCPY(opt_buf, p, CILEN_MPPE);
|
||||||
MEMCPY(&opt_buf[CILEN_MPPE], mppe_send_key,
|
MEMCPY(&opt_buf[CILEN_MPPE], mppe_send_key,
|
||||||
MPPE_MAX_KEY_LEN);
|
MPPE_MAX_KEY_LEN);
|
||||||
if (ccp_test(f->unit, opt_buf,
|
if (ccp_test(pcb, opt_buf,
|
||||||
CILEN_MPPE + MPPE_MAX_KEY_LEN, 1) <= 0) {
|
CILEN_MPPE + MPPE_MAX_KEY_LEN, 1) <= 0) {
|
||||||
/* This shouldn't happen, we've already tested it! */
|
/* This shouldn't happen, we've already tested it! */
|
||||||
error("MPPE required, but kernel has no support.");
|
error("MPPE required, but kernel has no support.");
|
||||||
lcp_close(f->unit, "MPPE required but not available");
|
lcp_close(pcb, "MPPE required but not available");
|
||||||
newret = CONFREJ;
|
newret = CONFREJ;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1243,7 +1202,7 @@ ccp_reqci(f, p, lenp, dont_nak)
|
|||||||
*/
|
*/
|
||||||
if (p == p0) {
|
if (p == p0) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
res = ccp_test(f->unit, p, CILEN_DEFLATE, 1);
|
res = ccp_test(pcb, p, CILEN_DEFLATE, 1);
|
||||||
if (res > 0)
|
if (res > 0)
|
||||||
break; /* it's OK now */
|
break; /* it's OK now */
|
||||||
if (res < 0 || nb == DEFLATE_MIN_WORKS || dont_nak) {
|
if (res < 0 || nb == DEFLATE_MIN_WORKS || dont_nak) {
|
||||||
@ -1284,7 +1243,7 @@ ccp_reqci(f, p, lenp, dont_nak)
|
|||||||
*/
|
*/
|
||||||
if (p == p0) {
|
if (p == p0) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
res = ccp_test(f->unit, p, CILEN_BSD_COMPRESS, 1);
|
res = ccp_test(pcb, p, CILEN_BSD_COMPRESS, 1);
|
||||||
if (res > 0)
|
if (res > 0)
|
||||||
break;
|
break;
|
||||||
if (res < 0 || nb == BSD_MIN_BITS || dont_nak) {
|
if (res < 0 || nb == BSD_MIN_BITS || dont_nak) {
|
||||||
@ -1308,7 +1267,7 @@ ccp_reqci(f, p, lenp, dont_nak)
|
|||||||
|
|
||||||
ho->predictor_1 = 1;
|
ho->predictor_1 = 1;
|
||||||
if (p == p0
|
if (p == p0
|
||||||
&& ccp_test(f->unit, p, CILEN_PREDICTOR_1, 1) <= 0) {
|
&& ccp_test(pcb, p, CILEN_PREDICTOR_1, 1) <= 0) {
|
||||||
newret = CONFREJ;
|
newret = CONFREJ;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1321,7 +1280,7 @@ ccp_reqci(f, p, lenp, dont_nak)
|
|||||||
|
|
||||||
ho->predictor_2 = 1;
|
ho->predictor_2 = 1;
|
||||||
if (p == p0
|
if (p == p0
|
||||||
&& ccp_test(f->unit, p, CILEN_PREDICTOR_2, 1) <= 0) {
|
&& ccp_test(pcb, p, CILEN_PREDICTOR_2, 1) <= 0) {
|
||||||
newret = CONFREJ;
|
newret = CONFREJ;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1349,14 +1308,14 @@ ccp_reqci(f, p, lenp, dont_nak)
|
|||||||
|
|
||||||
if (ret != CONFACK) {
|
if (ret != CONFACK) {
|
||||||
if (ret == CONFREJ && *lenp == retp - p0)
|
if (ret == CONFREJ && *lenp == retp - p0)
|
||||||
all_rejected[f->unit] = 1;
|
pcb->all_rejected = 1;
|
||||||
else
|
else
|
||||||
*lenp = retp - p0;
|
*lenp = retp - p0;
|
||||||
}
|
}
|
||||||
#ifdef MPPE
|
#ifdef MPPE
|
||||||
if (ret == CONFREJ && ao->mppe && rej_for_ci_mppe) {
|
if (ret == CONFREJ && ao->mppe && rej_for_ci_mppe) {
|
||||||
error("MPPE required but peer negotiation failed");
|
error("MPPE required but peer negotiation failed");
|
||||||
lcp_close(f->unit, "MPPE required but peer negotiation failed");
|
lcp_close(pcb, "MPPE required but peer negotiation failed");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
@ -1365,10 +1324,7 @@ ccp_reqci(f, p, lenp, dont_nak)
|
|||||||
/*
|
/*
|
||||||
* Make a string name for a compression method (or 2).
|
* Make a string name for a compression method (or 2).
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *method_name(ccp_options *opt, ccp_options *opt2) {
|
||||||
method_name(opt, opt2)
|
|
||||||
ccp_options *opt, *opt2;
|
|
||||||
{
|
|
||||||
static char result[64];
|
static char result[64];
|
||||||
|
|
||||||
if (!ANY_COMPRESS(*opt))
|
if (!ANY_COMPRESS(*opt))
|
||||||
@ -1430,15 +1386,13 @@ method_name(opt, opt2)
|
|||||||
/*
|
/*
|
||||||
* CCP has come up - inform the kernel driver and log a message.
|
* CCP has come up - inform the kernel driver and log a message.
|
||||||
*/
|
*/
|
||||||
static void
|
static void ccp_up(fsm *f) {
|
||||||
ccp_up(f)
|
ppp_pcb *pcb = f->pcb;
|
||||||
fsm *f;
|
ccp_options *go = &pcb->ccp_gotoptions;
|
||||||
{
|
ccp_options *ho = &pcb->ccp_hisoptions;
|
||||||
ccp_options *go = &ccp_gotoptions[f->unit];
|
|
||||||
ccp_options *ho = &ccp_hisoptions[f->unit];
|
|
||||||
char method1[64];
|
char method1[64];
|
||||||
|
|
||||||
ccp_flags_set(f->unit, 1, 1);
|
ccp_flags_set(pcb, 1, 1);
|
||||||
if (ANY_COMPRESS(*go)) {
|
if (ANY_COMPRESS(*go)) {
|
||||||
if (ANY_COMPRESS(*ho)) {
|
if (ANY_COMPRESS(*ho)) {
|
||||||
if (go->method == ho->method) {
|
if (go->method == ho->method) {
|
||||||
@ -1456,7 +1410,7 @@ ccp_up(f)
|
|||||||
if (go->mppe) {
|
if (go->mppe) {
|
||||||
BZERO(mppe_recv_key, MPPE_MAX_KEY_LEN);
|
BZERO(mppe_recv_key, MPPE_MAX_KEY_LEN);
|
||||||
BZERO(mppe_send_key, MPPE_MAX_KEY_LEN);
|
BZERO(mppe_send_key, MPPE_MAX_KEY_LEN);
|
||||||
continue_networks(f->unit); /* Bring up IP et al */
|
continue_networks(pcb); /* Bring up IP et al */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1464,21 +1418,21 @@ ccp_up(f)
|
|||||||
/*
|
/*
|
||||||
* CCP has gone down - inform the kernel driver.
|
* CCP has gone down - inform the kernel driver.
|
||||||
*/
|
*/
|
||||||
static void
|
static void ccp_down(fsm *f) {
|
||||||
ccp_down(f)
|
ppp_pcb *pcb = f->pcb;
|
||||||
fsm *f;
|
ccp_options *go = &pcb->ccp_gotoptions;
|
||||||
{
|
|
||||||
if (ccp_localstate[f->unit] & RACK_PENDING)
|
if (pcb->ccp_localstate & RACK_PENDING)
|
||||||
UNTIMEOUT(ccp_rack_timeout, f);
|
UNTIMEOUT(ccp_rack_timeout, f);
|
||||||
ccp_localstate[f->unit] = 0;
|
pcb->ccp_localstate = 0;
|
||||||
ccp_flags_set(f->unit, 1, 0);
|
ccp_flags_set(pcb, 1, 0);
|
||||||
#ifdef MPPE
|
#ifdef MPPE
|
||||||
if (ccp_gotoptions[f->unit].mppe) {
|
if (go->mppe) {
|
||||||
ccp_gotoptions[f->unit].mppe = 0;
|
go->mppe = 0;
|
||||||
if (lcp_fsm[f->unit].state == OPENED) {
|
if (pcb->lcp_fsm.state == PPP_FSM_OPENED) {
|
||||||
/* If LCP is not already going down, make sure it does. */
|
/* If LCP is not already going down, make sure it does. */
|
||||||
error("MPPE disabled");
|
error("MPPE disabled");
|
||||||
lcp_close(f->unit, "MPPE disabled");
|
lcp_close(pcb, "MPPE disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1495,13 +1449,7 @@ static char *ccp_codenames[] = {
|
|||||||
"ResetReq", "ResetAck",
|
"ResetReq", "ResetAck",
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int ccp_printpkt(u_char *p, u_char plen, void (*printer) (void *, char *, ...), void *arg) {
|
||||||
ccp_printpkt(p, plen, printer, arg)
|
|
||||||
u_char *p;
|
|
||||||
int plen;
|
|
||||||
void (*printer) (void *, char *, ...);
|
|
||||||
void *arg;
|
|
||||||
{
|
|
||||||
u_char *p0, *optend;
|
u_char *p0, *optend;
|
||||||
int code, id, len;
|
int code, id, len;
|
||||||
int optlen;
|
int optlen;
|
||||||
@ -1629,29 +1577,25 @@ ccp_printpkt(p, plen, printer, arg)
|
|||||||
* decompression; if it was, we take CCP down, thus disabling
|
* decompression; if it was, we take CCP down, thus disabling
|
||||||
* compression :-(, otherwise we issue the reset-request.
|
* compression :-(, otherwise we issue the reset-request.
|
||||||
*/
|
*/
|
||||||
static void
|
static void ccp_datainput(ppp_pcb *pcb, u_char *pkt, int len) {
|
||||||
ccp_datainput(unit, pkt, len)
|
|
||||||
int unit;
|
|
||||||
u_char *pkt;
|
|
||||||
int len;
|
|
||||||
{
|
|
||||||
fsm *f;
|
fsm *f;
|
||||||
|
ccp_options *go = &pcb->ccp_gotoptions;
|
||||||
|
|
||||||
f = &ccp_fsm[unit];
|
f = &pcb->ccp_fsm;
|
||||||
if (f->state == PPP_FSM_OPENED) {
|
if (f->state == PPP_FSM_OPENED) {
|
||||||
if (ccp_fatal_error(unit)) {
|
if (ccp_fatal_error(pcb)) {
|
||||||
/*
|
/*
|
||||||
* Disable compression by taking CCP down.
|
* Disable compression by taking CCP down.
|
||||||
*/
|
*/
|
||||||
error("Lost compression sync: disabling compression");
|
error("Lost compression sync: disabling compression");
|
||||||
ccp_close(unit, "Lost compression sync");
|
ccp_close(pcb, "Lost compression sync");
|
||||||
#ifdef MPPE
|
#ifdef MPPE
|
||||||
/*
|
/*
|
||||||
* If we were doing MPPE, we must also take the link down.
|
* If we were doing MPPE, we must also take the link down.
|
||||||
*/
|
*/
|
||||||
if (ccp_gotoptions[unit].mppe) {
|
if (go->mppe) {
|
||||||
error("Too many MPPE errors, closing LCP");
|
error("Too many MPPE errors, closing LCP");
|
||||||
lcp_close(unit, "Too many MPPE errors");
|
lcp_close(pcb, "Too many MPPE errors");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
@ -1660,12 +1604,12 @@ ccp_datainput(unit, pkt, len)
|
|||||||
* We don't do that if we are still waiting for an
|
* We don't do that if we are still waiting for an
|
||||||
* acknowledgement to a previous reset-request.
|
* acknowledgement to a previous reset-request.
|
||||||
*/
|
*/
|
||||||
if (!(ccp_localstate[f->unit] & RACK_PENDING)) {
|
if (!(pcb->ccp_localstate & RACK_PENDING)) {
|
||||||
fsm_sdata(f, CCP_RESETREQ, f->reqid = ++f->id, NULL, 0);
|
fsm_sdata(f, CCP_RESETREQ, f->reqid = ++f->id, NULL, 0);
|
||||||
TIMEOUT(ccp_rack_timeout, f, RACKTIMEOUT);
|
TIMEOUT(ccp_rack_timeout, f, RACKTIMEOUT);
|
||||||
ccp_localstate[f->unit] |= RACK_PENDING;
|
pcb->ccp_localstate |= RACK_PENDING;
|
||||||
} else
|
} else
|
||||||
ccp_localstate[f->unit] |= RREQ_REPEAT;
|
pcb->ccp_localstate |= RREQ_REPEAT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1673,18 +1617,16 @@ ccp_datainput(unit, pkt, len)
|
|||||||
/*
|
/*
|
||||||
* Timeout waiting for reset-ack.
|
* Timeout waiting for reset-ack.
|
||||||
*/
|
*/
|
||||||
static void
|
static void ccp_rack_timeout(void *arg) {
|
||||||
ccp_rack_timeout(arg)
|
fsm *f = (fsm*)arg;
|
||||||
void *arg;
|
ppp_pcb *pcb = f->pcb;
|
||||||
{
|
|
||||||
fsm *f = arg;
|
|
||||||
|
|
||||||
if (f->state == PPP_FSM_OPENED && ccp_localstate[f->unit] & RREQ_REPEAT) {
|
if (f->state == PPP_FSM_OPENED && (pcb->ccp_localstate & RREQ_REPEAT)) {
|
||||||
fsm_sdata(f, CCP_RESETREQ, f->reqid, NULL, 0);
|
fsm_sdata(f, CCP_RESETREQ, f->reqid, NULL, 0);
|
||||||
TIMEOUT(ccp_rack_timeout, f, RACKTIMEOUT);
|
TIMEOUT(ccp_rack_timeout, f, RACKTIMEOUT);
|
||||||
ccp_localstate[f->unit] &= ~RREQ_REPEAT;
|
pcb->ccp_localstate &= ~RREQ_REPEAT;
|
||||||
} else
|
} else
|
||||||
ccp_localstate[f->unit] &= ~RACK_PENDING;
|
pcb->ccp_localstate &= ~RACK_PENDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* PPP_SUPPORT && CCP_SUPPORT */
|
#endif /* PPP_SUPPORT && CCP_SUPPORT */
|
||||||
|
Loading…
Reference in New Issue
Block a user