summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp
diff options
context:
space:
mode:
authoramurai <amurai@FreeBSD.org>1995-07-08 17:46:56 +0000
committeramurai <amurai@FreeBSD.org>1995-07-08 17:46:56 +0000
commit5ee68349c4316bd077cf580e17de6a718d5298c2 (patch)
tree8c1da7cfa30dc64d7fe9c9118832aae669085969 /usr.sbin/ppp
parentf4c8f572ca1004d258d5288dc644af11101e42d7 (diff)
downloadFreeBSD-src-5ee68349c4316bd077cf580e17de6a718d5298c2.zip
FreeBSD-src-5ee68349c4316bd077cf580e17de6a718d5298c2.tar.gz
1. Clean up log message.
2. Optimize ModemQlen. 3. Sending ProtoReject for Unknow protocol (i.e. IPX) 4. Avoid select looping by reading tun under the high system load. 5. Adding Local version String for maintenance. 6. Just more speak rather silent ignore if you type invalid key words.
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r--usr.sbin/ppp/command.c5
-rw-r--r--usr.sbin/ppp/hdlc.c13
-rw-r--r--usr.sbin/ppp/main.c22
-rw-r--r--usr.sbin/ppp/modem.c12
-rw-r--r--usr.sbin/ppp/vars.c32
5 files changed, 55 insertions, 29 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index ff80847..ee2754c 100644
--- a/usr.sbin/ppp/command.c
+++ b/usr.sbin/ppp/command.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: command.c,v 1.6 1995/06/16 07:07:56 phk Exp $
+ * $Id: command.c,v 1.7 1995/07/08 08:28:00 amurai Exp $
*
*/
#include <ctype.h>
@@ -244,8 +244,9 @@ static int ShowAuthKey()
static int ShowVersion()
{
extern char *VarVersion[];
+ extern char *VarLocalVersion[];
- printf("%s\n", VarVersion);
+ printf("%s - %s \n", VarVersion, VarLocalVersion);
return(1);
}
diff --git a/usr.sbin/ppp/hdlc.c b/usr.sbin/ppp/hdlc.c
index f1de57e..72938dc 100644
--- a/usr.sbin/ppp/hdlc.c
+++ b/usr.sbin/ppp/hdlc.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: hdlc.c,v 1.2 1995/02/26 12:17:30 amurai Exp $
+ * $Id: hdlc.c,v 1.3 1995/05/30 03:50:33 rgrimes Exp $
*
* TODO:
*/
@@ -203,6 +203,8 @@ struct mbuf *bp;
#ifdef DEBUG
logprintf("proto = %04x\n", proto);
#endif
+ u_char *cp;
+
switch (proto) {
case PROTO_LCP:
LcpInput(bp);
@@ -237,10 +239,11 @@ struct mbuf *bp;
Pred1Input(bp);
break;
default:
- logprintf("Unknown protocol 0x%04x\n", proto);
- /*
- * XXX: Should send protocol reject.
- */
+ LogPrintf(LOG_PHASE, "Unknown protocol 0x%04x\n", proto);
+ bp->offset -= 2;
+ bp->cnt += 2;
+ cp = MBUF_CTOP(bp);
+ LcpSendProtoRej(cp, bp->cnt);
HisLqrSave.SaveInDiscards++;
HdlcStat.unknownproto++;
pfree(bp);
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c
index 79bcdfd..e6aae6e 100644
--- a/usr.sbin/ppp/main.c
+++ b/usr.sbin/ppp/main.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: main.c,v 1.5 1995/05/30 03:50:47 rgrimes Exp $
+ * $Id: main.c,v 1.6 1995/07/06 02:58:57 asami Exp $
*
* TODO:
* o Add commands for traffic summary, version display, etc.
@@ -553,10 +553,11 @@ DoLoop()
u_char *cp;
u_char rbuff[MAX_MRU];
int dial_up;
+ int qlen;
if (mode & MODE_DIRECT) {
modem = OpenModem(mode);
- fprintf(stderr, "Packet mode enabled\n");
+ LogPrintf(LOG_PHASE, "Packet mode enabled\n");
PacketMode();
} else if (mode & MODE_DEDICATED) {
if (!modem)
@@ -602,10 +603,11 @@ DoLoop()
}
}
}
+ qlen = ModemQlen();
if (modem) {
FD_SET(modem, &rfds);
FD_SET(modem, &efds);
- if (ModemQlen() > 0) {
+ if (qlen > 0) {
FD_SET(modem, &wfds);
}
}
@@ -622,8 +624,12 @@ DoLoop()
usleep(TICKUNIT);
TimerService();
#endif
-
- FD_SET(tun_in, &rfds);
+ if ( qlen < 20 ) {
+ /*
+ * If there are many packets queued, wait until they are drained.
+ */
+ FD_SET(tun_in, &rfds);
+ }
if (netfd > -1) {
FD_SET(netfd, &rfds);
FD_SET(netfd, &efds);
@@ -742,12 +748,6 @@ DoLoop()
}
if (FD_ISSET(tun_in, &rfds)) { /* something to read from tun */
- /*
- * If there are many packets queued, wait until they are drained.
- */
- if (ModemQlen() > 5)
- continue;
-
n = read(tun_in, rbuff, sizeof(rbuff));
if (n < 0) {
perror("read from tun");
diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c
index e2de707..917c083 100644
--- a/usr.sbin/ppp/modem.c
+++ b/usr.sbin/ppp/modem.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: modem.c,v 1.6 1995/05/30 03:50:51 rgrimes Exp $
+ * $Id: modem.c,v 1.7 1995/06/30 19:53:04 dfr Exp $
*
* TODO:
*/
@@ -645,16 +645,16 @@ struct mbuf *bp;
int
ModemQlen()
{
- struct mbuf *bp;
+ struct mqueue *queue;
int len = 0;
int i;
- for (i = PRI_NORMAL; i <= PRI_URGENT; i++) {
- for (bp = OutputQueues[i].top; bp; bp = bp->pnext)
- len++;
+ for ( i = PRI_NORMAL; i <= PRI_URGENT; i ++ ) {
+ queue = &OutputQueues[i];
+ len += queue->qlen;
}
-
return(len);
+
}
void
diff --git a/usr.sbin/ppp/vars.c b/usr.sbin/ppp/vars.c
index ef5c796..32168b2 100644
--- a/usr.sbin/ppp/vars.c
+++ b/usr.sbin/ppp/vars.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: vars.c,v 1.2 1995/02/26 12:18:05 amurai Exp $
+ * $Id: vars.c,v 1.3 1995/05/30 03:51:01 rgrimes Exp $
*
*/
#include "fsm.h"
@@ -26,8 +26,10 @@
#include "termios.h"
#include "vars.h"
#include "auth.h"
+#include "defs.h"
char VarVersion[] = "Version 0.94";
+char VarLocalVersion[] = "$Date$";
/*
* Order of conf option is important. See vars.h.
@@ -71,6 +73,7 @@ int argc;
char **argv;
{
struct confdesc *vp;
+ int found = FALSE;
if (argc < 1) {
printf("disable what?\n");
@@ -78,9 +81,13 @@ char **argv;
}
do {
for (vp = pppConfs; vp->name; vp++) {
- if (strcasecmp(vp->name, *argv) == 0)
+ if (strcasecmp(vp->name, *argv) == 0) {
vp->myside = CONF_DISABLE;
+ found = TRUE;
+ }
}
+ if ( found == FALSE )
+ printf("%s - No such key word\n", *argv );
argc--; argv++;
} while (argc > 0);
return(1);
@@ -93,6 +100,7 @@ int argc;
char **argv;
{
struct confdesc *vp;
+ int found = FALSE;
if (argc < 1) {
printf("enable what?\n");
@@ -100,9 +108,13 @@ char **argv;
}
do {
for (vp = pppConfs; vp->name; vp++) {
- if (strcasecmp(vp->name, *argv) == 0)
+ if (strcasecmp(vp->name, *argv) == 0) {
vp->myside = CONF_ENABLE;
+ found = TRUE;
+ }
}
+ if ( found == FALSE )
+ printf("%s - No such key word\n", *argv );
argc--; argv++;
} while (argc > 0);
return(1);
@@ -115,6 +127,7 @@ int argc;
char **argv;
{
struct confdesc *vp;
+ int found = FALSE;
if (argc < 1) {
printf("accept what?\n");
@@ -122,9 +135,13 @@ char **argv;
}
do {
for (vp = pppConfs; vp->name; vp++) {
- if (strcasecmp(vp->name, *argv) == 0)
+ if (strcasecmp(vp->name, *argv) == 0) {
vp->hisside = CONF_ACCEPT;
+ found = TRUE;
+ }
}
+ if ( found == FALSE )
+ printf("%s - No such key word\n", *argv );
argc--; argv++;
} while (argc > 0);
return(1);
@@ -137,6 +154,7 @@ int argc;
char **argv;
{
struct confdesc *vp;
+ int found = FALSE;
if (argc < 1) {
printf("enable what?\n");
@@ -144,9 +162,13 @@ char **argv;
}
do {
for (vp = pppConfs; vp->name; vp++) {
- if (strcasecmp(vp->name, *argv) == 0)
+ if (strcasecmp(vp->name, *argv) == 0) {
vp->hisside = CONF_DENY;
+ found = TRUE;
+ }
}
+ if ( found == FALSE )
+ printf("%s - No such key word\n", *argv );
argc--; argv++;
} while (argc > 0);
return(1);
OpenPOWER on IntegriCloud