summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2013-08-15 23:00:04 +0400
committerDmitry Kozlov <xeb@mail.ru>2013-08-15 23:00:04 +0400
commit5bcadd662df06abc26de7a7259ecf33994d2ee05 (patch)
tree85d36cca34c42da30079e49ae1bbd0bba0112a91 /accel-pppd
parent1289f64ef117e7fd2986bd42766e8a173bf06c6d (diff)
downloadaccel-ppp-xebd-5bcadd662df06abc26de7a7259ecf33994d2ee05.tar.gz
accel-ppp-xebd-5bcadd662df06abc26de7a7259ecf33994d2ee05.zip
shaper: implemented 'rate-multiplier' option to bring values to kilobits if radius sends in different basis
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/accel-ppp.conf2
-rw-r--r--accel-pppd/accel-ppp.conf.55
-rw-r--r--accel-pppd/shaper/shaper.c15
3 files changed, 16 insertions, 6 deletions
diff --git a/accel-pppd/accel-ppp.conf b/accel-pppd/accel-ppp.conf
index f8cc66d..ca90ea2 100644
--- a/accel-pppd/accel-ppp.conf
+++ b/accel-pppd/accel-ppp.conf
@@ -20,7 +20,6 @@ sigchld
pppd_compat
#shaper
-#shaper_tbf (obsolete)
#chap-secrets
#net-snmp
#logwtmp
@@ -194,6 +193,7 @@ gw-ip-address=192.168.100.1
up-limiter=police
down-limiter=tbf
#leaf-qdisc=sfq perturb 10
+#rate-multiplier=1
verbose=1
[cli]
diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5
index cb6156a..607357f 100644
--- a/accel-pppd/accel-ppp.conf.5
+++ b/accel-pppd/accel-ppp.conf.5
@@ -534,7 +534,7 @@ Specifies whether radius client should include Acct-Delay-Time attribute to acco
Append specified realm to username.
.TP
.BI "acct-on=" 0|1
-Specifies whether radius client should send Account-Request with Acct-Status-Type=Account-On on startup and Acct-Status-Type=Account-Off on shutdown.
+Specifies whether radius client should send Account-Request with Acct-Status-Type=Accounting-On on startup and Acct-Status-Type=Accounting-Off on shutdown.
.SH [log]
.br
Configuration of log and log_file modules.
@@ -754,6 +754,9 @@ Specifies downstream rate limiting method.
.BI "leaf-qdisc=" "qdisc parameters"
In case if htb is used as up-limiter or down-limiter specified leaf qdisc can be attached automaticaly.
At present only sfq qdisc is implemented. Parameters are same as for tc: [ limit NUMBER ] [ perturn SECS ] [ quantum BYTES ].
+.TP
+.BI "rate-multiplier=" n
+Due to accel-ppp operates with rates in kilobit basis if you send rates in different basis then you can use this option to bring your values to kilobits.
.SH [cli]
.br
Configuration of the command line interface.
diff --git a/accel-pppd/shaper/shaper.c b/accel-pppd/shaper/shaper.c
index 34a0988..8b5e0a1 100644
--- a/accel-pppd/shaper/shaper.c
+++ b/accel-pppd/shaper/shaper.c
@@ -40,6 +40,7 @@ int conf_quantum = 1500;
int conf_r2q = 10;
int conf_cburst = 1534;
int conf_ifb_ifindex;
+static double conf_multiplier = 1;
int conf_up_limiter = LIM_POLICE;
int conf_down_limiter = LIM_TBF;
@@ -178,7 +179,7 @@ static void parse_string(const char *str, int dir, int *speed, int *burst, int *
val = strtol(str, &endptr, 10);
if (*endptr == 0) {
- *speed = val;
+ *speed = conf_multiplier * val;
return;
}
if (*endptr == ',') {
@@ -186,14 +187,14 @@ static void parse_string(const char *str, int dir, int *speed, int *burst, int *
val = strtol(endptr + 1, &endptr, 10);
}
if (*endptr == 0) {
- *speed = val;
+ *speed = conf_multiplier * val;
return;
} else {
if (*endptr == '/' || *endptr == '\\' || *endptr == ':') {
if (dir == ATTR_DOWN)
- *speed = val;
+ *speed = conf_multiplier * val;
else
- *speed = strtol(endptr + 1, &endptr, 10);
+ *speed = conf_multiplier * strtol(endptr + 1, &endptr, 10);
}
}
}
@@ -897,6 +898,12 @@ static void load_config(void)
opt = conf_get_opt("shaper", "verbose");
if (opt && atoi(opt) >= 0)
conf_verbose = atoi(opt) > 0;
+
+ opt = conf_get_opt("shaper", "rate-multiplier");
+ if (opt && atoi(opt) >= 0)
+ conf_multiplier = atof(opt);
+ else
+ conf_multiplier = 1;
triton_context_call(&shaper_ctx, (triton_event_func)load_time_ranges, NULL);
}