mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-05 09:14:03 +00:00
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:
parent
6498e7d632
commit
60e218e470
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9448
@ -17,7 +17,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* 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>
|
#include <ctype.h>
|
||||||
@ -244,8 +244,9 @@ static int ShowAuthKey()
|
|||||||
static int ShowVersion()
|
static int ShowVersion()
|
||||||
{
|
{
|
||||||
extern char *VarVersion[];
|
extern char *VarVersion[];
|
||||||
|
extern char *VarLocalVersion[];
|
||||||
|
|
||||||
printf("%s\n", VarVersion);
|
printf("%s - %s \n", VarVersion, VarLocalVersion);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* 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:
|
* TODO:
|
||||||
*/
|
*/
|
||||||
@ -203,6 +203,8 @@ struct mbuf *bp;
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
logprintf("proto = %04x\n", proto);
|
logprintf("proto = %04x\n", proto);
|
||||||
#endif
|
#endif
|
||||||
|
u_char *cp;
|
||||||
|
|
||||||
switch (proto) {
|
switch (proto) {
|
||||||
case PROTO_LCP:
|
case PROTO_LCP:
|
||||||
LcpInput(bp);
|
LcpInput(bp);
|
||||||
@ -237,10 +239,11 @@ struct mbuf *bp;
|
|||||||
Pred1Input(bp);
|
Pred1Input(bp);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
logprintf("Unknown protocol 0x%04x\n", proto);
|
LogPrintf(LOG_PHASE, "Unknown protocol 0x%04x\n", proto);
|
||||||
/*
|
bp->offset -= 2;
|
||||||
* XXX: Should send protocol reject.
|
bp->cnt += 2;
|
||||||
*/
|
cp = MBUF_CTOP(bp);
|
||||||
|
LcpSendProtoRej(cp, bp->cnt);
|
||||||
HisLqrSave.SaveInDiscards++;
|
HisLqrSave.SaveInDiscards++;
|
||||||
HdlcStat.unknownproto++;
|
HdlcStat.unknownproto++;
|
||||||
pfree(bp);
|
pfree(bp);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* 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:
|
* TODO:
|
||||||
* o Add commands for traffic summary, version display, etc.
|
* o Add commands for traffic summary, version display, etc.
|
||||||
@ -553,10 +553,11 @@ DoLoop()
|
|||||||
u_char *cp;
|
u_char *cp;
|
||||||
u_char rbuff[MAX_MRU];
|
u_char rbuff[MAX_MRU];
|
||||||
int dial_up;
|
int dial_up;
|
||||||
|
int qlen;
|
||||||
|
|
||||||
if (mode & MODE_DIRECT) {
|
if (mode & MODE_DIRECT) {
|
||||||
modem = OpenModem(mode);
|
modem = OpenModem(mode);
|
||||||
fprintf(stderr, "Packet mode enabled\n");
|
LogPrintf(LOG_PHASE, "Packet mode enabled\n");
|
||||||
PacketMode();
|
PacketMode();
|
||||||
} else if (mode & MODE_DEDICATED) {
|
} else if (mode & MODE_DEDICATED) {
|
||||||
if (!modem)
|
if (!modem)
|
||||||
@ -602,10 +603,11 @@ DoLoop()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
qlen = ModemQlen();
|
||||||
if (modem) {
|
if (modem) {
|
||||||
FD_SET(modem, &rfds);
|
FD_SET(modem, &rfds);
|
||||||
FD_SET(modem, &efds);
|
FD_SET(modem, &efds);
|
||||||
if (ModemQlen() > 0) {
|
if (qlen > 0) {
|
||||||
FD_SET(modem, &wfds);
|
FD_SET(modem, &wfds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -622,8 +624,12 @@ DoLoop()
|
|||||||
usleep(TICKUNIT);
|
usleep(TICKUNIT);
|
||||||
TimerService();
|
TimerService();
|
||||||
#endif
|
#endif
|
||||||
|
if ( qlen < 20 ) {
|
||||||
FD_SET(tun_in, &rfds);
|
/*
|
||||||
|
* If there are many packets queued, wait until they are drained.
|
||||||
|
*/
|
||||||
|
FD_SET(tun_in, &rfds);
|
||||||
|
}
|
||||||
if (netfd > -1) {
|
if (netfd > -1) {
|
||||||
FD_SET(netfd, &rfds);
|
FD_SET(netfd, &rfds);
|
||||||
FD_SET(netfd, &efds);
|
FD_SET(netfd, &efds);
|
||||||
@ -742,12 +748,6 @@ DoLoop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (FD_ISSET(tun_in, &rfds)) { /* something to read from tun */
|
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));
|
n = read(tun_in, rbuff, sizeof(rbuff));
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
perror("read from tun");
|
perror("read from tun");
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* 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:
|
* TODO:
|
||||||
*/
|
*/
|
||||||
@ -645,16 +645,16 @@ struct mbuf *bp;
|
|||||||
int
|
int
|
||||||
ModemQlen()
|
ModemQlen()
|
||||||
{
|
{
|
||||||
struct mbuf *bp;
|
struct mqueue *queue;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = PRI_NORMAL; i <= PRI_URGENT; i++) {
|
for ( i = PRI_NORMAL; i <= PRI_URGENT; i ++ ) {
|
||||||
for (bp = OutputQueues[i].top; bp; bp = bp->pnext)
|
queue = &OutputQueues[i];
|
||||||
len++;
|
len += queue->qlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(len);
|
return(len);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* 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"
|
#include "fsm.h"
|
||||||
@ -26,8 +26,10 @@
|
|||||||
#include "termios.h"
|
#include "termios.h"
|
||||||
#include "vars.h"
|
#include "vars.h"
|
||||||
#include "auth.h"
|
#include "auth.h"
|
||||||
|
#include "defs.h"
|
||||||
|
|
||||||
char VarVersion[] = "Version 0.94";
|
char VarVersion[] = "Version 0.94";
|
||||||
|
char VarLocalVersion[] = "$Date$";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Order of conf option is important. See vars.h.
|
* Order of conf option is important. See vars.h.
|
||||||
@ -71,6 +73,7 @@ int argc;
|
|||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
struct confdesc *vp;
|
struct confdesc *vp;
|
||||||
|
int found = FALSE;
|
||||||
|
|
||||||
if (argc < 1) {
|
if (argc < 1) {
|
||||||
printf("disable what?\n");
|
printf("disable what?\n");
|
||||||
@ -78,9 +81,13 @@ char **argv;
|
|||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
for (vp = pppConfs; vp->name; vp++) {
|
for (vp = pppConfs; vp->name; vp++) {
|
||||||
if (strcasecmp(vp->name, *argv) == 0)
|
if (strcasecmp(vp->name, *argv) == 0) {
|
||||||
vp->myside = CONF_DISABLE;
|
vp->myside = CONF_DISABLE;
|
||||||
|
found = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if ( found == FALSE )
|
||||||
|
printf("%s - No such key word\n", *argv );
|
||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
} while (argc > 0);
|
} while (argc > 0);
|
||||||
return(1);
|
return(1);
|
||||||
@ -93,6 +100,7 @@ int argc;
|
|||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
struct confdesc *vp;
|
struct confdesc *vp;
|
||||||
|
int found = FALSE;
|
||||||
|
|
||||||
if (argc < 1) {
|
if (argc < 1) {
|
||||||
printf("enable what?\n");
|
printf("enable what?\n");
|
||||||
@ -100,9 +108,13 @@ char **argv;
|
|||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
for (vp = pppConfs; vp->name; vp++) {
|
for (vp = pppConfs; vp->name; vp++) {
|
||||||
if (strcasecmp(vp->name, *argv) == 0)
|
if (strcasecmp(vp->name, *argv) == 0) {
|
||||||
vp->myside = CONF_ENABLE;
|
vp->myside = CONF_ENABLE;
|
||||||
|
found = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if ( found == FALSE )
|
||||||
|
printf("%s - No such key word\n", *argv );
|
||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
} while (argc > 0);
|
} while (argc > 0);
|
||||||
return(1);
|
return(1);
|
||||||
@ -115,6 +127,7 @@ int argc;
|
|||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
struct confdesc *vp;
|
struct confdesc *vp;
|
||||||
|
int found = FALSE;
|
||||||
|
|
||||||
if (argc < 1) {
|
if (argc < 1) {
|
||||||
printf("accept what?\n");
|
printf("accept what?\n");
|
||||||
@ -122,9 +135,13 @@ char **argv;
|
|||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
for (vp = pppConfs; vp->name; vp++) {
|
for (vp = pppConfs; vp->name; vp++) {
|
||||||
if (strcasecmp(vp->name, *argv) == 0)
|
if (strcasecmp(vp->name, *argv) == 0) {
|
||||||
vp->hisside = CONF_ACCEPT;
|
vp->hisside = CONF_ACCEPT;
|
||||||
|
found = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if ( found == FALSE )
|
||||||
|
printf("%s - No such key word\n", *argv );
|
||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
} while (argc > 0);
|
} while (argc > 0);
|
||||||
return(1);
|
return(1);
|
||||||
@ -137,6 +154,7 @@ int argc;
|
|||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
struct confdesc *vp;
|
struct confdesc *vp;
|
||||||
|
int found = FALSE;
|
||||||
|
|
||||||
if (argc < 1) {
|
if (argc < 1) {
|
||||||
printf("enable what?\n");
|
printf("enable what?\n");
|
||||||
@ -144,9 +162,13 @@ char **argv;
|
|||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
for (vp = pppConfs; vp->name; vp++) {
|
for (vp = pppConfs; vp->name; vp++) {
|
||||||
if (strcasecmp(vp->name, *argv) == 0)
|
if (strcasecmp(vp->name, *argv) == 0) {
|
||||||
vp->hisside = CONF_DENY;
|
vp->hisside = CONF_DENY;
|
||||||
|
found = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if ( found == FALSE )
|
||||||
|
printf("%s - No such key word\n", *argv );
|
||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
} while (argc > 0);
|
} while (argc > 0);
|
||||||
return(1);
|
return(1);
|
||||||
|
Loading…
Reference in New Issue
Block a user