summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian <brian@cvs.openbsd.org>1998-01-18 20:47:22 +0000
committerbrian <brian@cvs.openbsd.org>1998-01-18 20:47:22 +0000
commit20599d642889c6d7738ab57f1d643790003649d3 (patch)
tree1aea91bb7b310ef56617c5c6b26d3991a65c262e
parent760b2b7e1a556619d53cc47fcb92c6abd541e8da (diff)
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".
-rw-r--r--usr.sbin/ppp/command.c26
-rw-r--r--usr.sbin/ppp/ipcp.c54
-rw-r--r--usr.sbin/ppp/ipcp.h4
-rw-r--r--usr.sbin/ppp/ppp.834
4 files changed, 93 insertions, 25 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index f91d4f468d6..0b7c0698f29 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.22 1998/01/11 17:54:46 brian Exp $
+ * $Id: command.c,v 1.23 1998/01/18 20:47:19 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},
diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c
index e5652171066..f0ba334a9c2 100644
--- a/usr.sbin/ppp/ipcp.c
+++ b/usr.sbin/ppp/ipcp.c
@@ -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.10 1998/01/05 01:39:04 brian Exp $
+ * $Id: ipcp.c,v 1.11 1998/01/18 20:47:20 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;
diff --git a/usr.sbin/ppp/ipcp.h b/usr.sbin/ppp/ipcp.h
index 142905efeb9..b5d23687cd0 100644
--- a/usr.sbin/ppp/ipcp.h
+++ b/usr.sbin/ppp/ipcp.h
@@ -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.4 1998/01/11 17:54:46 brian Exp $
+ * $Id: ipcp.h,v 1.5 1998/01/18 20:47:20 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 *);
diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8
index 8014fec5449..8d0e77281b8 100644
--- a/usr.sbin/ppp/ppp.8
+++ b/usr.sbin/ppp/ppp.8
@@ -1,4 +1,4 @@
-.\" $Id: ppp.8,v 1.14 1998/01/05 01:39:05 brian Exp $
+.\" $Id: ppp.8,v 1.15 1998/01/18 20:47:21 brian Exp $
.Dd 20 September 1995
.Os OpenBSD
.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