summaryrefslogtreecommitdiff
path: root/accel-pppd/shaper
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/shaper
parent1289f64ef117e7fd2986bd42766e8a173bf06c6d (diff)
downloadaccel-ppp-5bcadd662df06abc26de7a7259ecf33994d2ee05.tar.gz
accel-ppp-5bcadd662df06abc26de7a7259ecf33994d2ee05.zip
shaper: implemented 'rate-multiplier' option to bring values to kilobits if radius sends in different basis
Diffstat (limited to 'accel-pppd/shaper')
-rw-r--r--accel-pppd/shaper/shaper.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/accel-pppd/shaper/shaper.c b/accel-pppd/shaper/shaper.c
index 34a0988c..8b5e0a12 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);
}