summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/command.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-08-05 10:32:16 +0000
committerbrian <brian@FreeBSD.org>1999-08-05 10:32:16 +0000
commit75000c38838f6ae4afe9de4dd06bd3fde6120e1b (patch)
tree26404e4742c87264dac32602be9ec171a2100df1 /usr.sbin/ppp/command.c
parentc32597f76112e043f5178c1c2237ad6d753da072 (diff)
downloadFreeBSD-src-75000c38838f6ae4afe9de4dd06bd3fde6120e1b.zip
FreeBSD-src-75000c38838f6ae4afe9de4dd06bd3fde6120e1b.tar.gz
o Obsolete the undocumented ``set weight'' command.
o If we're using RADIUS and the RADIUS mtu is less than our peers mru/mrru, reduce our mtu to this value for NetBSD too. o Make struct throughput's sample period dynamic and tweak the ppp version number to reflect the extra stuff being passed through the local domain socket as a result (MP mode). o Measure the current throughput based on the number of samples actually taken rather than on the full sample period. o Keep the throughput statisics persistent while being passed to another ppp invocation through the local domain socket. o When showing throughput statistics after the timer has stopped, use the stopped time for overall calculations, not the current time. Also show the stopped time and how long the current throughput has been sampled for. o Use time() consistently in throughput.c o Tighten up the ``show bundle'' output. o Introduce the ``set bandwidth'' command. o Rewrite the ``set autoload'' command. It now takes three arguments and works based on a rolling bundle throughput average compared against the theoretical bundle bandwidth over a given period (read: it's now functional).
Diffstat (limited to 'usr.sbin/ppp/command.c')
-rw-r--r--usr.sbin/ppp/command.c55
1 files changed, 39 insertions, 16 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index 8a94c81..a10cc6b 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.203 1999/06/23 16:48:19 brian Exp $
+ * $Id: command.c,v 1.204 1999/08/02 21:45:35 brian Exp $
*
*/
#include <sys/param.h>
@@ -143,8 +143,8 @@
#define NEG_SHORTSEQ 52
#define NEG_VJCOMP 53
-const char Version[] = "2.22";
-const char VersionDate[] = "$Date: 1999/06/23 16:48:19 $";
+const char Version[] = "2.23";
+const char VersionDate[] = "$Date: 1999/08/02 21:45:35 $";
static int ShowCommand(struct cmdargs const *);
static int TerminalCommand(struct cmdargs const *);
@@ -1428,19 +1428,42 @@ SetVariable(struct cmdargs const *arg)
break;
case VAR_AUTOLOAD:
- if (arg->argc == arg->argn + 2 || arg->argc == arg->argn + 4) {
- arg->bundle->autoload.running = 1;
- arg->bundle->cfg.autoload.max.timeout = atoi(arg->argv[arg->argn]);
- arg->bundle->cfg.autoload.max.packets = atoi(arg->argv[arg->argn + 1]);
- if (arg->argc == arg->argn + 4) {
- arg->bundle->cfg.autoload.min.timeout = atoi(arg->argv[arg->argn + 2]);
- arg->bundle->cfg.autoload.min.packets = atoi(arg->argv[arg->argn + 3]);
- } else {
- arg->bundle->cfg.autoload.min.timeout = 0;
- arg->bundle->cfg.autoload.min.packets = 0;
+ if (arg->argc == arg->argn + 3) {
+ int v1, v2, v3;
+ char *end;
+
+ v1 = strtol(arg->argv[arg->argn], &end, 0);
+ if (v1 < 0 || *end) {
+ log_Printf(LogWARN, "autoload: %s: Invalid min percentage\n",
+ arg->argv[arg->argn]);
+ return 1;
+ }
+
+ v2 = strtol(arg->argv[arg->argn + 1], &end, 0);
+ if (v2 < 0 || *end) {
+ log_Printf(LogWARN, "autoload: %s: Invalid max percentage\n",
+ arg->argv[arg->argn + 1]);
+ return 1;
}
+ if (v2 < v1) {
+ v3 = v1;
+ v1 = v2;
+ v2 = v3;
+ }
+
+ v3 = strtol(arg->argv[arg->argn + 2], &end, 0);
+ if (v3 <= 0 || *end) {
+ log_Printf(LogWARN, "autoload: %s: Invalid throughput period\n",
+ arg->argv[arg->argn + 2]);
+ return 1;
+ }
+
+ arg->bundle->ncp.mp.cfg.autoload.min = v1;
+ arg->bundle->ncp.mp.cfg.autoload.max = v2;
+ arg->bundle->ncp.mp.cfg.autoload.period = v3;
+ mp_RestartAutoloadTimer(&arg->bundle->ncp.mp);
} else {
- err = "Set autoload requires two or four arguments\n";
+ err = "Set autoload requires three arguments\n";
log_Printf(LogWARN, err);
}
break;
@@ -1873,8 +1896,8 @@ static struct cmdtab const SetCommands[] = {
"set timeout idletime", (const void *)VAR_IDLETIMEOUT},
{"vj", NULL, ipcp_vjset, LOCAL_AUTH,
"vj values", "set vj slots|slotcomp [value]"},
- {"weight", NULL, mp_SetDatalinkWeight, LOCAL_AUTH | LOCAL_CX,
- "datalink weighting", "set weight n"},
+ {"bandwidth", NULL, mp_SetDatalinkBandwidth, LOCAL_AUTH | LOCAL_CX,
+ "datalink bandwidth", "set bandwidth value"},
{"help", "?", HelpCommand, LOCAL_AUTH | LOCAL_NO_AUTH,
"Display this message", "set help|? [command]", SetCommands},
{NULL, NULL, NULL},
OpenPOWER on IntegriCloud