*/
#ifndef lint
-static char rcsid[] = "$Id: lcp.c,v 1.28 1996/10/08 04:35:02 paulus Exp $";
+static char rcsid[] = "$Id: lcp.c,v 1.32 1998/05/13 05:49:19 paulus Exp $";
#endif
/*
static void lcp_echo_lowerup __P((int));
static void lcp_echo_lowerdown __P((int));
-static void LcpEchoTimeout __P((caddr_t));
+static void LcpEchoTimeout __P((void *));
static void lcp_received_echo_reply __P((fsm *, int, u_char *, int));
static void LcpSendEchoRequest __P((fsm *));
static void LcpLinkFailure __P((fsm *));
+static void LcpEchoCheck __P((fsm *));
static fsm_callbacks lcp_callbacks = { /* LCP callback routines */
lcp_resetci, /* Reset our Configuration Information */
{
fsm *f = &lcp_fsm[unit];
- phase = PHASE_TERMINATE;
+ if (phase != PHASE_DEAD)
+ phase = PHASE_TERMINATE;
if (f->state == STOPPED && f->flags & (OPT_PASSIVE|OPT_SILENT)) {
/*
* This action is not strictly according to the FSM in RFC1548,
*/
ppp_set_xaccm(unit, xmit_accm[unit]);
ppp_send_config(unit, PPP_MRU, 0xffffffff, 0, 0);
- ppp_recv_config(unit, PPP_MRU, 0x00000000,
+ ppp_recv_config(unit, PPP_MRU, 0xffffffff,
wo->neg_pcompression, wo->neg_accompression);
peer_mru[unit] = PPP_MRU;
lcp_allowoptions[unit].asyncmap = xmit_accm[unit][0];
*/
if (go->neg_mru && go->mru != DEFMRU) {
NAKCISHORT(CI_MRU, neg_mru,
- if (cishort <= wo->mru || cishort < DEFMRU)
+ if (cishort <= wo->mru || cishort <= DEFMRU)
try.mru = cishort;
);
}
switch (citype) {
case CI_MRU:
- if (go->neg_mru && go->mru != DEFMRU
+ if ((go->neg_mru && go->mru != DEFMRU)
|| no.neg_mru || cilen != CILEN_SHORT)
goto bad;
GETSHORT(cishort, p);
try.mru = cishort;
break;
case CI_ASYNCMAP:
- if (go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF
+ if ((go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF)
|| no.neg_asyncmap || cilen != CILEN_LONG)
goto bad;
break;
ppp_send_config(f->unit, MIN(ao->mru, (ho->neg_mru? ho->mru: PPP_MRU)),
(ho->neg_asyncmap? ho->asyncmap: 0xffffffff),
ho->neg_pcompression, ho->neg_accompression);
- /*
- * If the asyncmap hasn't been negotiated, we really should
- * set the receive asyncmap to ffffffff, but we set it to 0
- * for backwards contemptibility.
- */
ppp_recv_config(f->unit, (go->neg_mru? MAX(wo->mru, go->mru): PPP_MRU),
- (go->neg_asyncmap? go->asyncmap: 0x00000000),
+ (go->neg_asyncmap? go->asyncmap: 0xffffffff),
go->neg_pcompression, go->neg_accompression);
if (ho->neg_mru)
ppp_send_config(f->unit, PPP_MRU, 0xffffffff, 0, 0);
ppp_recv_config(f->unit, PPP_MRU,
- (go->neg_asyncmap? go->asyncmap: 0x00000000),
+ (go->neg_asyncmap? go->asyncmap: 0xffffffff),
go->neg_pcompression, go->neg_accompression);
peer_mru[f->unit] = PPP_MRU;
}
u_char *pstart, *optend;
u_short cishort;
u_int32_t cilong;
- int fascii;
if (plen < HEADERLEN)
return 0;
break;
case PPP_CHAP:
printer(arg, "chap");
+ if (p < optend) {
+ switch (*p) {
+ case CHAP_DIGEST_MD5:
+ printer(arg, " MD5");
+ ++p;
+ break;
+#ifdef CHAPMS
+ case CHAP_MICROSOFT:
+ printer(arg, " m$oft");
+ ++p;
+ break;
+#endif
+ }
+ }
break;
default:
printer(arg, "0x%x", cishort);
* Start the timer for the next interval.
*/
assert (lcp_echo_timer_running==0);
- TIMEOUT (LcpEchoTimeout, (caddr_t) f, lcp_echo_interval);
+ TIMEOUT (LcpEchoTimeout, f, lcp_echo_interval);
lcp_echo_timer_running = 1;
}
static void
LcpEchoTimeout (arg)
- caddr_t arg;
+ void *arg;
{
if (lcp_echo_timer_running != 0) {
lcp_echo_timer_running = 0;
* Detect the failure of the peer at this point.
*/
if (lcp_echo_fails != 0) {
- if (lcp_echos_pending++ >= lcp_echo_fails) {
+ if (lcp_echos_pending >= lcp_echo_fails) {
LcpLinkFailure(f);
lcp_echos_pending = 0;
}
pktp = pkt;
PUTLONG(lcp_magic, pktp);
fsm_sdata(f, ECHOREQ, lcp_echo_number++ & 0xFF, pkt, pktp - pkt);
+ ++lcp_echos_pending;
}
}
fsm *f = &lcp_fsm[unit];
if (lcp_echo_timer_running != 0) {
- UNTIMEOUT (LcpEchoTimeout, (caddr_t) f);
+ UNTIMEOUT (LcpEchoTimeout, f);
lcp_echo_timer_running = 0;
}
}