summaryrefslogtreecommitdiffstats
path: root/net/sched/cls_api.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2009-09-04 06:41:15 +0000
committerDavid S. Miller <davem@davemloft.net>2009-09-06 02:06:12 -0700
commit71ebe5e91947392bc276af713827eab12b6db8e4 (patch)
tree198ff02e23f8606ff2a3bec51c7044ec408e19c4 /net/sched/cls_api.c
parentc9f1d0389b962521af1e2b699c8ee5e299d77b85 (diff)
downloadlinux-stable-71ebe5e91947392bc276af713827eab12b6db8e4.tar.gz
linux-stable-71ebe5e91947392bc276af713827eab12b6db8e4.tar.bz2
linux-stable-71ebe5e91947392bc276af713827eab12b6db8e4.zip
net_sched: make cls_ops->tcf_chain() optional
Some qdiscs don't support attaching filters. Handle this centrally in cls_api and return a proper errno code (EOPNOTSUPP) instead of EINVAL. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_api.c')
-rw-r--r--net/sched/cls_api.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 09cdcdfe7e91..bcfbdb4758c9 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -181,6 +181,9 @@ replay:
if ((cops = q->ops->cl_ops) == NULL)
return -EINVAL;
+ if (cops->tcf_chain == NULL)
+ return -EOPNOTSUPP;
+
/* Do we search for filter, attached to class? */
if (TC_H_MIN(parent)) {
cl = cops->get(q, parent);
@@ -433,6 +436,8 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
goto out;
if ((cops = q->ops->cl_ops) == NULL)
goto errout;
+ if (cops->tcf_chain == NULL)
+ goto errout;
if (TC_H_MIN(tcm->tcm_parent)) {
cl = cops->get(q, tcm->tcm_parent);
if (cl == 0)