Allow "set vj" for changing the default number of slots

and whether slot compression is requested.
Don't show current values with "show ipcp" if IPCP isn't
"opened".
This commit is contained in:
brian 1998-01-18 20:49:22 +00:00
parent 48792236bc
commit 32829424bc
5 changed files with 120 additions and 32 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.126 1998/01/10 21:51:31 brian Exp $
* $Id: command.c,v 1.127 1998/01/11 17:50:31 brian Exp $
*
*/
#include <sys/param.h>
@ -620,6 +620,10 @@ static struct cmdtab const ShowCommands[] = {
"Show modem setups", "show modem"},
{"mru", NULL, ShowInitialMRU, LOCAL_AUTH,
"Show Initial MRU", "show mru"},
#ifndef NOMSEXT
{"msext", NULL, ShowMSExt, LOCAL_AUTH,
"Show MS PPP extentions", "show msext"},
#endif
{"mtu", NULL, ShowPreferredMTU, LOCAL_AUTH,
"Show Preferred MTU", "show mtu"},
{"ofilter", NULL, ShowOfilter, LOCAL_AUTH,
@ -636,12 +640,10 @@ static struct cmdtab const ShowCommands[] = {
"Show Idle timeout", "show timeout"},
{"stopped", NULL, ShowStopped, LOCAL_AUTH,
"Show STOPPED timeout", "show stopped"},
#ifndef NOMSEXT
{"msext", NULL, ShowMSExt, LOCAL_AUTH,
"Show MS PPP extentions", "show msext"},
#endif
{"version", NULL, ShowVersion, LOCAL_NO_AUTH | LOCAL_AUTH,
"Show version string", "show version"},
{"vj", NULL, ShowInitVJ, LOCAL_AUTH,
"Show VJ values", "show vj"},
{"help", "?", HelpCommand, LOCAL_NO_AUTH | LOCAL_AUTH,
"Display this message", "show help|? [command]", ShowCommands},
{NULL, NULL, NULL},
@ -1448,6 +1450,12 @@ static struct cmdtab const SetCommands[] = {
"Set Initial MRU value", "set mru value"},
{"mtu", NULL, SetPreferredMTU, LOCAL_AUTH,
"Set Preferred MTU value", "set mtu value"},
#ifndef NOMSEXT
{"nbns", NULL, SetNBNS, LOCAL_AUTH,
"Set NetBIOS NameServer", "set nbns pri-addr [sec-addr]"},
{"ns", NULL, SetNS, LOCAL_AUTH,
"Set NameServer", "set ns pri-addr [sec-addr]"},
#endif
{"ofilter", NULL, SetOfilter, LOCAL_AUTH,
"Set output filter", "set ofilter ..."},
{"openmode", NULL, SetOpenMode, LOCAL_AUTH,
@ -1468,12 +1476,8 @@ static struct cmdtab const SetCommands[] = {
"Set modem speed", "set speed value"},
{"timeout", NULL, SetIdleTimeout, LOCAL_AUTH,
"Set Idle timeout", "set timeout value"},
#ifndef NOMSEXT
{"ns", NULL, SetNS, LOCAL_AUTH,
"Set NameServer", "set ns pri-addr [sec-addr]"},
{"nbns", NULL, SetNBNS, LOCAL_AUTH,
"Set NetBIOS NameServer", "set nbns pri-addr [sec-addr]"},
#endif
{"vj", NULL, SetInitVJ, LOCAL_AUTH,
"Set vj values", "set vj slots|slotcomp"},
{"help", "?", HelpCommand, LOCAL_AUTH | LOCAL_NO_AUTH,
"Display this message", "set help|? [command]", SetCommands},
{NULL, NULL, NULL},

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: ipcp.c,v 1.46 1997/12/27 13:45:50 brian Exp $
* $Id: ipcp.c,v 1.47 1998/01/05 01:35:18 brian Exp $
*
* TODO:
* o More RFC1772 backwoard compatibility
@ -32,6 +32,7 @@
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
@ -146,10 +147,12 @@ ReportIpcpStatus(struct cmdargs const *arg)
if (!VarTerm)
return 1;
fprintf(VarTerm, "%s [%s]\n", fp->name, StateNames[fp->state]);
fprintf(VarTerm, " his side: %s, %s\n",
inet_ntoa(IpcpInfo.his_ipaddr), vj2asc(IpcpInfo.his_compproto));
fprintf(VarTerm, " my side: %s, %s\n",
inet_ntoa(IpcpInfo.want_ipaddr), vj2asc(IpcpInfo.want_compproto));
if (IpcpFsm.state == ST_OPENED) {
fprintf(VarTerm, " his side: %s, %s\n",
inet_ntoa(IpcpInfo.his_ipaddr), vj2asc(IpcpInfo.his_compproto));
fprintf(VarTerm, " my side: %s, %s\n",
inet_ntoa(IpcpInfo.want_ipaddr), vj2asc(IpcpInfo.want_compproto));
}
fprintf(VarTerm, "Defaults:\n");
fprintf(VarTerm, " My Address: %s/%d\n",
@ -188,6 +191,44 @@ IpcpDefAddress()
}
}
static int VJInitSlots = MAX_STATES;
static int VJInitComp = 1;
int
SetInitVJ(struct cmdargs const *args)
{
if (args->argc != 2)
return -1;
if (!strcasecmp(args->argv[0], "slots")) {
int slots;
slots = atoi(args->argv[1]);
if (slots < 4 || slots > 16)
return 1;
VJInitSlots = slots;
return 0;
} else if (!strcasecmp(args->argv[0], "slotcomp")) {
if (!strcasecmp(args->argv[1], "on"))
VJInitComp = 1;
else if (!strcasecmp(args->argv[1], "off"))
VJInitComp = 0;
else
return 2;
return 0;
}
return -1;
}
int
ShowInitVJ(struct cmdargs const *args)
{
if (VarTerm) {
fprintf(VarTerm, "Initial slots: %d\n", VJInitSlots);
fprintf(VarTerm, "Initial compression: %s\n", VJInitComp ? "on" : "off");
}
return 0;
}
void
IpcpInit()
{
@ -212,7 +253,8 @@ IpcpInit()
LogPrintf(LogIPCP, "Using trigger address %s\n", inet_ntoa(TriggerAddress));
}
if (Enabled(ConfVjcomp))
IpcpInfo.want_compproto = (PROTO_VJCOMP << 16) | ((MAX_STATES - 1) << 8) | 1;
IpcpInfo.want_compproto = (PROTO_VJCOMP << 16) | ((VJInitSlots - 1) << 8) |
VJInitComp;
else
IpcpInfo.want_compproto = 0;
IpcpInfo.heis1172 = 0;

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: ipcp.h,v 1.16 1998/01/05 01:35:19 brian Exp $
* $Id: ipcp.h,v 1.17 1998/01/11 17:50:33 brian Exp $
*
* TODO:
*/
@ -79,3 +79,5 @@ extern void IpcpInput(struct mbuf *);
extern void IpcpAddInOctets(int);
extern void IpcpAddOutOctets(int);
extern int UseHisaddr(const char *, int);
extern int SetInitVJ(struct cmdargs const *);
extern int ShowInitVJ(struct cmdargs const *);

View File

@ -1,4 +1,4 @@
.\" $Id: ppp.8,v 1.93 1998/01/04 21:28:49 brian Exp $
.\" $Id: ppp.8,v 1.94 1998/01/05 01:35:20 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@ -2248,6 +2248,12 @@ The default MTU is 1500. This may be increased by the MRU specified
by the peer. It may only be subsequently decreased by this option.
Increasing it is not valid as the peer is not necessarily able to
receive the increased packet size.
.It set ns x.x.x.x y.y.y.y
This option allows the setting of the Microsoft DNS servers that
will be negotiated.
.It set nbns x.x.x.x y.y.y.y
This option allows the setting of the Microsoft NetBIOS DNS servers that
will be negotiated.
.It set openmode active|passive
By default,
.Ar openmode
@ -2370,12 +2376,26 @@ This sets the speed of the serial device.
.It set timeout Idle [ lqr [ retry ] ]
This command allows the setting of the idle timer, the LQR timer (if
enabled) and the retry timer.
.It set ns x.x.x.x y.y.y.y
This option allows the setting of the Microsoft DNS servers that
will be negotiated.
.It set nbns x.x.x.x y.y.y.y
This option allows the setting of the Microsoft NetBIOS DNS servers that
will be negotiated.
.It set vj slots nslots
This command sets the initial number of
.Ar slots
that
.Nm
will try to negotiate with the peer when VJ compression is enabled (see the
.Sq enable
command above). It defaults to a value of 16.
.Ar Nslots
must be between
.Ar 4
and
.Ar 16
inclusive.
.It set vj slotcomp on|off
This command tells
.Nm
whether it should attempt to negotiate VJ slot compression. By default,
slot compression is turned
.Ar on .
.It set help|?
This command gives a summary of available set commands.
.El

View File

@ -1,4 +1,4 @@
.\" $Id: ppp.8,v 1.93 1998/01/04 21:28:49 brian Exp $
.\" $Id: ppp.8,v 1.94 1998/01/05 01:35:20 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@ -2248,6 +2248,12 @@ The default MTU is 1500. This may be increased by the MRU specified
by the peer. It may only be subsequently decreased by this option.
Increasing it is not valid as the peer is not necessarily able to
receive the increased packet size.
.It set ns x.x.x.x y.y.y.y
This option allows the setting of the Microsoft DNS servers that
will be negotiated.
.It set nbns x.x.x.x y.y.y.y
This option allows the setting of the Microsoft NetBIOS DNS servers that
will be negotiated.
.It set openmode active|passive
By default,
.Ar openmode
@ -2370,12 +2376,26 @@ This sets the speed of the serial device.
.It set timeout Idle [ lqr [ retry ] ]
This command allows the setting of the idle timer, the LQR timer (if
enabled) and the retry timer.
.It set ns x.x.x.x y.y.y.y
This option allows the setting of the Microsoft DNS servers that
will be negotiated.
.It set nbns x.x.x.x y.y.y.y
This option allows the setting of the Microsoft NetBIOS DNS servers that
will be negotiated.
.It set vj slots nslots
This command sets the initial number of
.Ar slots
that
.Nm
will try to negotiate with the peer when VJ compression is enabled (see the
.Sq enable
command above). It defaults to a value of 16.
.Ar Nslots
must be between
.Ar 4
and
.Ar 16
inclusive.
.It set vj slotcomp on|off
This command tells
.Nm
whether it should attempt to negotiate VJ slot compression. By default,
slot compression is turned
.Ar on .
.It set help|?
This command gives a summary of available set commands.
.El