summaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2008-11-26 06:14:06 +0100
committerDavid S. Miller <davem@davemloft.net>2008-11-26 06:14:06 +0100
commitc1b56878fb68e9c14070939ea4537ad4db79ffae (patch)
tree589f890f81e075380493905509244a0970d942f8 /net/sched
parenttc: check for errors in gen_rate_estimator creation (diff)
downloadlinux-c1b56878fb68e9c14070939ea4537ad4db79ffae.tar.xz
linux-c1b56878fb68e9c14070939ea4537ad4db79ffae.zip
tc: policing requires a rate estimator
Found that while trying average rate policing, it was possible to request average rate policing without a rate estimator. This results in no policing which is harmless but incorrect. Since policing could be setup in two steps, need to check in the kernel. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/act_police.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index e19a0261144a..c39f60cea6ee 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -182,6 +182,12 @@ override:
R_tab = qdisc_get_rtab(&parm->rate, tb[TCA_POLICE_RATE]);
if (R_tab == NULL)
goto failure;
+
+ if (!est && !gen_estimator_active(&police->tcf_rate_est)) {
+ err = -EINVAL;
+ goto failure;
+ }
+
if (parm->peakrate.rate) {
P_tab = qdisc_get_rtab(&parm->peakrate,
tb[TCA_POLICE_PEAKRATE]);