Implement "set mtu" command to allow the client to

reduce the interface mtu.
Allow max mru spec of 16k.
Add "show m[rt]u" ability.
This commit is contained in:
Brian Somers 1997-06-01 01:13:04 +00:00
parent b93b7486b9
commit da2b73b1ee
5 changed files with 69 additions and 14 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.51 1997/05/29 02:29:12 brian Exp $
* $Id: command.c,v 1.52 1997/05/31 16:37:19 brian Exp $
*
*/
#include <sys/types.h>
@ -372,6 +372,21 @@ static int ShowLogList()
return(1);
}
static int ShowInitialMRU()
{
printf(" Initial MRU: %ld\n", VarMRU);
return(1);
}
static int ShowPreferredMTU()
{
if (VarPrefMTU)
printf(" Preferred MTU: %ld\n", VarPrefMTU);
else
printf(" Preferred MTU: unspecified\n");
return(1);
}
static int ShowReconnect()
{
printf(" Reconnect Timer: %d, %d tries\n",
@ -451,6 +466,10 @@ struct cmdtab const ShowCommands[] = {
"Show memory map", StrNull},
{ "modem", NULL, ShowModemStatus, LOCAL_AUTH,
"Show modem setups", StrNull},
{ "mru", NULL, ShowInitialMRU, LOCAL_AUTH,
"Show Initial MRU", StrNull},
{ "mtu", NULL, ShowPreferredMTU, LOCAL_AUTH,
"Show Preferred MTU", StrNull},
{ "ofilter", NULL, ShowOfilter, LOCAL_AUTH,
"Show Output filters", StrOption},
{ "proto", NULL, ReportProtStatus, LOCAL_AUTH,
@ -834,17 +853,43 @@ struct cmdtab *list;
int argc;
char **argv;
{
int mru;
long mru;
if (argc > 0) {
mru = atoi(*argv);
if (mru < 100)
printf("given value is too small.\n");
mru = atol(*argv);
if (mru < MIN_MRU)
printf("Given MRU value (%ld) is too small.\n", mru);
else if (mru > MAX_MRU)
printf("given value is too big.\n");
printf("Given MRU value (%ld) is too big.\n", mru);
else
VarMRU = mru;
}
} else
printf("Usage: %s %s\n", list->name, list->syntax);
return(1);
}
static int
SetPreferredMTU(list, argc, argv)
struct cmdtab *list;
int argc;
char **argv;
{
long mtu;
if (argc > 0) {
mtu = atol(*argv);
if (mtu == 0)
VarPrefMTU = 0;
else if (mtu < MIN_MTU)
printf("Given MTU value (%ld) is too small.\n", mtu);
else if (mtu > MAX_MTU)
printf("Given MTU value (%ld) is too big.\n", mtu);
else
VarPrefMTU = mtu;
} else
printf("Usage: %s %s\n", list->name, list->syntax);
return(1);
}
@ -1117,6 +1162,8 @@ struct cmdtab const SetCommands[] = {
"Set login script", StrChatStr, (void *)VAR_LOGIN },
{ "mru", NULL, SetInitialMRU, LOCAL_AUTH,
"Set Initial MRU value", StrValue },
{ "mtu", NULL, SetPreferredMTU, LOCAL_AUTH,
"Set Preferred MTU value", StrValue },
{ "ofilter", NULL, SetOfilter, LOCAL_AUTH,
"Set output filter", "..." },
{ "openmode", NULL, SetOpenMode, LOCAL_AUTH,

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id$
* $Id: hdlc.h,v 1.6 1997/02/22 16:10:17 peter Exp $
*
* TODO:
*/
@ -39,9 +39,13 @@
#define GOODFCS 0xf0b8 /* Good FCS value */
#define DEF_MRU 1500
#define MAX_MRU 2000
#define MAX_MRU 16384
#define MIN_MRU 296
#define DEF_MTU 0 /* whatever peer says */
#define MAX_MTU 16384
#define MIN_MTU 296
/*
* Output priority
*/

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: os.c,v 1.18 1997/05/24 17:32:41 brian Exp $
* $Id: os.c,v 1.19 1997/05/26 00:44:08 brian Exp $
*
*/
#include "fsm.h"
@ -263,6 +263,8 @@ int type, mtu, speed;
info.type = type;
info.mtu = mtu;
if (VarPrefMTU != 0 && VarPrefMTU < mtu)
info.mtu = VarPrefMTU;
info.baudrate = speed;
if (ioctl(tun_out, TUNSIFINFO, &info) < 0)
perror("TUNSIFINFO");

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.16 1997/05/17 16:08:48 brian Exp $
* $Id: vars.c,v 1.17 1997/05/26 00:44:09 brian Exp $
*
*/
#include "fsm.h"
@ -30,7 +30,7 @@
#include "defs.h"
char VarVersion[] = "Version 0.94";
char VarLocalVersion[] = "$Date: 1997/05/17 16:08:48 $";
char VarLocalVersion[] = "$Date: 1997/05/26 00:44:09 $";
/*
* Order of conf option is important. See vars.h.
@ -50,7 +50,7 @@ struct confdesc pppConfs[] = {
};
struct pppvars pppVars = {
DEF_MRU, 0, MODEM_SPEED, CS8, MODEM_CTSRTS, 180, 30, 3,
DEF_MRU, DEF_MTU, 0, MODEM_SPEED, CS8, MODEM_CTSRTS, 180, 30, 3,
RECONNECT_TIMER, RECONNECT_TRIES, REDIAL_PERIOD,
NEXT_REDIAL_PERIOD, 1, MODEM_DEV, BASE_MODEM_DEV,
OPEN_ACTIVE, LOCAL_NO_AUTH,

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: vars.h,v 1.15 1997/05/24 17:32:42 brian Exp $
* $Id: vars.h,v 1.16 1997/05/26 00:44:10 brian Exp $
*
* TODO:
*/
@ -55,6 +55,7 @@ extern struct confdesc pppConfs[MAXCONFS+1];
struct pppvars {
u_long var_mru; /* Initial MRU value */
u_long pref_mtu; /* Preferred MTU value */
int var_accmap; /* Initial ACCMAP value */
int modem_speed; /* Current modem speed */
int modem_parity; /* Parity setting */
@ -88,6 +89,7 @@ struct pppvars {
#define VarAccmap pppVars.var_accmap
#define VarMRU pppVars.var_mru
#define VarPrefMTU pppVars.pref_mtu
#define VarDevice pppVars.modem_dev
#define VarBaseDevice pppVars.base_modem_dev
#define VarSpeed pppVars.modem_speed