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.
This commit is contained in:
Atsushi Murai 1995-07-08 17:46:56 +00:00
parent 6498e7d632
commit 60e218e470
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9448
5 changed files with 55 additions and 29 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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");

View File

@ -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

View File

@ -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);