* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
* OR MODIFICATIONS.
*
- * $Id: ccp.h,v 1.5 1995/10/27 03:43:11 paulus Exp $
+ * $Id: ccp.h,v 1.6 1995/12/18 03:44:41 paulus Exp $
*/
typedef struct ccp_options {
void ccp_init __P((int unit));
void ccp_open __P((int unit));
-void ccp_close __P((int unit));
+void ccp_close __P((int unit, char *));
void ccp_lowerup __P((int unit));
void ccp_lowerdown __P((int));
void ccp_input __P((int unit, u_char *pkt, int len));
void (*printer) __P((void *, char *, ...)),
void *arg));
void ccp_datainput __P((int unit, u_char *pkt, int len));
+
+extern struct protent ccp_protent;
*/
#ifndef lint
-static char rcsid[] = "$Id: fsm.c,v 1.9 1995/10/27 03:43:46 paulus Exp $";
+static char rcsid[] = "$Id: fsm.c,v 1.10 1995/12/18 03:44:42 paulus Exp $";
#endif
/*
f->maxconfreqtransmits = DEFMAXCONFREQS;
f->maxtermtransmits = DEFMAXTERMREQS;
f->maxnakloops = DEFMAXNAKLOOPS;
+ f->term_reason_len = 0;
}
* the CLOSED state.
*/
void
-fsm_close(f)
+fsm_close(f, reason)
fsm *f;
+ char *reason;
{
+ f->term_reason = reason;
+ f->term_reason_len = (reason == NULL? 0: strlen(reason));
switch( f->state ){
case STARTING:
f->state = INITIAL;
/* Init restart counter, send Terminate-Request */
f->retransmits = f->maxtermtransmits;
- fsm_sdata(f, TERMREQ, f->reqid = ++f->id, NULL, 0);
+ fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
+ (u_char *) f->term_reason, f->term_reason_len);
TIMEOUT(fsm_timeout, (caddr_t) f, f->timeouttime);
--f->retransmits;
(*f->callbacks->finished)(f);
} else {
/* Send Terminate-Request */
- fsm_sdata(f, TERMREQ, f->reqid = ++f->id, NULL, 0);
+ fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
+ (u_char *) f->term_reason, f->term_reason_len);
TIMEOUT(fsm_timeout, (caddr_t) f, f->timeouttime);
--f->retransmits;
}
/* Init restart counter, send Terminate-Request */
f->retransmits = f->maxtermtransmits;
- fsm_sdata(f, TERMREQ, f->reqid = ++f->id, NULL, 0);
+ fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
+ (u_char *) f->term_reason, f->term_reason_len);
TIMEOUT(fsm_timeout, (caddr_t) f, f->timeouttime);
--f->retransmits;
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: fsm.h,v 1.5 1995/05/19 03:17:35 paulus Exp $
+ * $Id: fsm.h,v 1.6 1995/12/18 03:44:44 paulus Exp $
*/
/*
int nakloops; /* Number of nak loops since last ack */
int maxnakloops; /* Maximum number of nak loops tolerated */
fsm_callbacks *callbacks; /* Callback routines */
+ char *term_reason; /* Reason for closing protocol */
+ int term_reason_len; /* Length of term_reason */
} fsm;
void fsm_lowerup __P((fsm *));
void fsm_lowerdown __P((fsm *));
void fsm_open __P((fsm *));
-void fsm_close __P((fsm *));
+void fsm_close __P((fsm *, char *));
void fsm_input __P((fsm *, u_char *, int));
void fsm_protreject __P((fsm *));
void fsm_sdata __P((fsm *, int, int, u_char *, int));
*/
#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;
}
}
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: lcp.h,v 1.8 1995/06/12 11:22:47 paulus Exp $
+ * $Id: lcp.h,v 1.9 1995/12/18 03:45:17 paulus Exp $
*/
/*
void lcp_init __P((int));
void lcp_open __P((int));
-void lcp_close __P((int));
+void lcp_close __P((int, char *));
void lcp_lowerup __P((int));
void lcp_lowerdown __P((int));
void lcp_input __P((int, u_char *, int));
int lcp_printpkt __P((u_char *, int,
void (*) __P((void *, char *, ...)), void *));
+extern struct protent lcp_protent;
+
/* Default number of times we receive our magic number from the peer
before deciding the link is looped-back. */
#define DEFLOOPBACKFAIL 5