*/
#ifndef lint
-static char rcsid[] = "$Id: lcp.c,v 1.22 1995/10/27 03:42:09 paulus Exp $";
+static char rcsid[] = "$Id: lcp.c,v 1.23 1995/12/18 03:45:32 paulus Exp $";
#endif
/*
#include "pppd.h"
#include "fsm.h"
#include "lcp.h"
-#include "magic.h"
#include "chap.h"
-#include "upap.h"
-#include "ipcp.h"
+#include "magic.h"
#ifdef _linux_ /* Needs ppp ioctls */
#include <net/if.h>
"LCP" /* String name of protocol */
};
+struct protent lcp_protent = {
+ PPP_LCP, lcp_init, lcp_input, lcp_protrej,
+ lcp_lowerup, lcp_lowerdown, lcp_open, lcp_close,
+ lcp_printpkt, NULL, 1, "LCP"
+};
+
int lcp_loopbackfail = DEFLOOPBACKFAIL;
/*
* lcp_close - Take LCP down.
*/
void
-lcp_close(unit)
+lcp_close(unit, reason)
int unit;
+ char *reason;
{
fsm *f = &lcp_fsm[unit];
lcp_finished(f);
} else
- fsm_close(&lcp_fsm[unit]);
+ fsm_close(&lcp_fsm[unit], reason);
}
#ifdef _linux_
delta = idle_time_limit - (u_long) ddinfo.recv_idle;
if (((int) delta <= 0L) && (f->state == OPENED)) {
syslog (LOG_NOTICE, "No IP frames received within idle time limit");
- lcp_close(f->unit); /* Reset connection */
+ lcp_close(f->unit, "Idle time limit expired"); /* Reset connection */
phase = PHASE_TERMINATE; /* Mark it down */
} else {
if ((int) delta <= 0L)
u_char *inp;
int len;
{
+ int i;
+ struct protent *protp;
u_short prot;
LCPDEBUG((LOG_INFO, "lcp_rprotrej."));
return;
}
- DEMUXPROTREJ(f->unit, prot); /* Inform protocol */
+ /*
+ * Upcall the proper Protocol-Reject routine.
+ */
+ for (i = 0; (protp = protocols[i]) != NULL; ++i)
+ if (protp->protocol == prot && protp->enabled_flag) {
+ (*protp->protrej)(f->unit);
+ return;
+ }
+
+ syslog(LOG_WARNING, "Protocol-Reject for unsupported protocol 0x%x",
+ prot);
}
if (looped_back) {
if (++try.numloops >= lcp_loopbackfail) {
syslog(LOG_NOTICE, "Serial line is looped back.");
- lcp_close(f->unit);
+ lcp_close(f->unit, "Loopback detected");
}
} else
try.numloops = 0;
/*
* lcp_up - LCP has come UP.
- *
- * Start UPAP, IPCP, etc.
*/
static void
lcp_up(f)
if (ho->neg_mru)
peer_mru[f->unit] = ho->mru;
- ChapLowerUp(f->unit); /* Enable CHAP */
- upap_lowerup(f->unit); /* Enable UPAP */
- ipcp_lowerup(f->unit); /* Enable IPCP */
- ccp_lowerup(f->unit); /* Enable CCP */
lcp_echo_lowerup(f->unit); /* Enable echo messages */
link_established(f->unit);
lcp_options *go = &lcp_gotoptions[f->unit];
lcp_echo_lowerdown(f->unit);
- ccp_lowerdown(f->unit);
- ipcp_lowerdown(f->unit);
- ChapLowerDown(f->unit);
- upap_lowerdown(f->unit);
sifdown(f->unit);
ppp_send_config(f->unit, PPP_MRU, 0xffffffff, 0, 0);
GETSHORT(cishort, p);
switch (cishort) {
case PPP_PAP:
- printer(arg, "upap");
+ printer(arg, "pap");
break;
case PPP_CHAP:
printer(arg, "chap");
{
if (f->state == OPENED) {
syslog (LOG_NOTICE, "Excessive lack of response to LCP echo frames.");
- lcp_close(f->unit); /* Reset connection */
+ lcp_close(f->unit, "Peer not responding");
+ phase = PHASE_TERMINATE;
}
}