diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2013-08-15 23:00:04 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2013-08-15 23:00:04 +0400 |
commit | 5bcadd662df06abc26de7a7259ecf33994d2ee05 (patch) | |
tree | 85d36cca34c42da30079e49ae1bbd0bba0112a91 | |
parent | 1289f64ef117e7fd2986bd42766e8a173bf06c6d (diff) | |
download | accel-ppp-5bcadd662df06abc26de7a7259ecf33994d2ee05.tar.gz accel-ppp-5bcadd662df06abc26de7a7259ecf33994d2ee05.zip |
shaper: implemented 'rate-multiplier' option to bring values to kilobits if radius sends in different basis
-rw-r--r-- | accel-pppd/accel-ppp.conf | 2 | ||||
-rw-r--r-- | accel-pppd/accel-ppp.conf.5 | 5 | ||||
-rw-r--r-- | accel-pppd/shaper/shaper.c | 15 |
3 files changed, 16 insertions, 6 deletions
diff --git a/accel-pppd/accel-ppp.conf b/accel-pppd/accel-ppp.conf index f8cc66de..ca90ea28 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 cb6156ac..607357fd 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 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); } |