summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/ccp.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-06-09 03:27:43 +0000
committerbrian <brian@FreeBSD.org>1997-06-09 03:27:43 +0000
commit94d661ac8cb907e0a869759f76cd7134c9105e6c (patch)
tree5fa88c28cbdec0d4a0d3d118b33c1042dc49c526 /usr.sbin/ppp/ccp.c
parent328d28c6502cfec45b8ead98e18b2d8638499efb (diff)
downloadFreeBSD-src-94d661ac8cb907e0a869759f76cd7134c9105e6c.zip
FreeBSD-src-94d661ac8cb907e0a869759f76cd7134c9105e6c.tar.gz
Overhaul ppp:
o Use syslog o Remove references to stdout/stderr (incl perror()) o Introduce VarTerm - the interactive terminal or zero o Allow "set timeout" to affect current session o Change "set debug" to "set log" o Allow "set log [+|-]flag" o Make MSEXT and PASSWDAUTH stuff the default o Move all #ifdef DEBUG stuff into the code - this shouldn't be too much overhead. It's now controlled with "set log +debug" o Add "set log command, debug, tun, warn, error, alert" o Remove cdefs.h, and assume an ansi compiler. o Improve all diagnostic output o Don't trap SIGSEGV o SIGHUP now terminates again (log files are controlled by syslog) o Call CloseModem() when changing devices o Fix parsing of third arg of "delete" I think this fixes the "magic is same" problems that some people have been experiencing. The man page is being rewritten. It'll follow soon.
Diffstat (limited to 'usr.sbin/ppp/ccp.c')
-rw-r--r--usr.sbin/ppp/ccp.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c
index 5b11272..bee7131 100644
--- a/usr.sbin/ppp/ccp.c
+++ b/usr.sbin/ppp/ccp.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: ccp.c,v 1.11 1997/05/10 01:22:06 brian Exp $
+ * $Id: ccp.c,v 1.12 1997/05/26 00:43:56 brian Exp $
*
* TODO:
* o Support other compression protocols
@@ -30,19 +30,18 @@
#include "loadalias.h"
#include "vars.h"
#include "pred.h"
-#include "cdefs.h"
struct ccpstate CcpInfo;
-static void CcpSendConfigReq __P((struct fsm *));
-static void CcpSendTerminateReq __P((struct fsm *fp));
-static void CcpSendTerminateAck __P((struct fsm *fp));
-static void CcpDecodeConfig __P((u_char *cp, int flen, int mode));
-static void CcpLayerStart __P((struct fsm *));
-static void CcpLayerFinish __P((struct fsm *));
-static void CcpLayerUp __P((struct fsm *));
-static void CcpLayerDown __P((struct fsm *));
-static void CcpInitRestartCounter __P((struct fsm *));
+static void CcpSendConfigReq(struct fsm *);
+static void CcpSendTerminateReq(struct fsm *fp);
+static void CcpSendTerminateAck(struct fsm *fp);
+static void CcpDecodeConfig(u_char *cp, int flen, int mode);
+static void CcpLayerStart(struct fsm *);
+static void CcpLayerFinish(struct fsm *);
+static void CcpLayerUp(struct fsm *);
+static void CcpLayerDown(struct fsm *);
+static void CcpInitRestartCounter(struct fsm *);
#define REJECTED(p, x) (p->his_reject & (1<<x))
@@ -83,11 +82,13 @@ ReportCcpStatus()
struct ccpstate *icp = &CcpInfo;
struct fsm *fp = &CcpFsm;
- printf("%s [%s]\n", fp->name, StateNames[fp->state]);
- printf("myproto = %s, hisproto = %s\n",
- cftypes[icp->want_proto], cftypes[icp->his_proto]);
- printf("Input: %ld --> %ld, Output: %ld --> %ld\n",
- icp->orgin, icp->compin, icp->orgout, icp->compout);
+ if (VarTerm) {
+ fprintf(VarTerm, "%s [%s]\n", fp->name, StateNames[fp->state]);
+ fprintf(VarTerm, "myproto = %s, hisproto = %s\n",
+ cftypes[icp->want_proto], cftypes[icp->his_proto]);
+ fprintf(VarTerm, "Input: %ld --> %ld, Output: %ld --> %ld\n",
+ icp->orgin, icp->compin, icp->orgout, icp->compout);
+ }
return 0;
}
@@ -119,7 +120,7 @@ struct fsm *fp;
struct ccpstate *icp = &CcpInfo;
cp = ReqBuff;
- LogPrintf(LOG_LCP_BIT, "%s: SendConfigReq\n", fp->name);
+ LogPrintf(LogLCP, "CcpSendConfigReq\n");
if (icp->want_proto && !REJECTED(icp, TY_PRED1)) {
*cp++ = TY_PRED1; *cp++ = 2;
}
@@ -131,7 +132,7 @@ CcpSendResetReq(fp)
struct fsm *fp;
{
Pred1Init(1); /* Initialize Input part */
- LogPrintf(LOG_LCP_BIT, "%s: SendResetReq\n", fp->name);
+ LogPrintf(LogLCP, "CcpSendResetReq\n");
FsmOutput(fp, CODE_RESETREQ, fp->reqid, NULL, 0);
}
@@ -146,7 +147,7 @@ static void
CcpSendTerminateAck(fp)
struct fsm *fp;
{
- LogPrintf(LOG_LCP_BIT, " %s: SendTerminateAck\n", fp->name);
+ LogPrintf(LogLCP, "CcpSendTerminateAck\n");
FsmOutput(fp, CODE_TERMACK, fp->reqid++, NULL, 0);
}
@@ -161,21 +162,21 @@ static void
CcpLayerStart(fp)
struct fsm *fp;
{
- LogPrintf(LOG_LCP_BIT, "%s: LayerStart.\n", fp->name);
+ LogPrintf(LogLCP, "CcpLayerStart.\n");
}
static void
CcpLayerFinish(fp)
struct fsm *fp;
{
- LogPrintf(LOG_LCP_BIT, "%s: LayerFinish.\n", fp->name);
+ LogPrintf(LogLCP, "CcpLayerFinish.\n");
}
static void
CcpLayerDown(fp)
struct fsm *fp;
{
- LogPrintf(LOG_LCP_BIT, "%s: LayerDown.\n", fp->name);
+ LogPrintf(LogLCP, "CcpLayerDown.\n");
}
/*
@@ -185,11 +186,8 @@ static void
CcpLayerUp(fp)
struct fsm *fp;
{
-#ifdef VERBOSE
- fprintf(stderr, "%s: LayerUp(%d).\r\n", fp->name, fp->state);
-#endif
- LogPrintf(LOG_LCP_BIT, "%s: LayerUp.\n", fp->name);
- LogPrintf(LOG_LCP_BIT, "myproto = %d, hisproto = %d\n",
+ LogPrintf(LogLCP, "CcpLayerUp(%d).\n", fp->state);
+ LogPrintf(LogLCP, "myproto = %d, hisproto = %d\n",
CcpInfo.want_proto, CcpInfo.his_proto);
Pred1Init(3); /* Initialize Input and Output */
}
@@ -198,7 +196,7 @@ void
CcpUp()
{
FsmUp(&CcpFsm);
- LogPrintf(LOG_LCP_BIT, "CCP Up event!!\n");
+ LogPrintf(LogLCP, "CCP Up event!!\n");
}
void
@@ -231,7 +229,7 @@ int mode;
else
snprintf(tbuff, sizeof(tbuff), " ");
- LogPrintf(LOG_LCP_BIT, "%s\n", tbuff);
+ LogPrintf(LogLCP, "%s\n", tbuff);
switch (type) {
case TY_PRED1:
@@ -271,7 +269,7 @@ CcpInput(struct mbuf *bp)
if (phase == PHASE_NETWORK)
FsmInput(&CcpFsm, bp);
else {
- logprintf("ccp in phase %d\n", phase);
+ LogPrintf(LogERROR, "Unexpected CCP in phase %d\n", phase);
pfree(bp);
}
}
OpenPOWER on IntegriCloud