Netdev List
 help / color / mirror / Atom feed
* RFC: Fix "tc filter show" for basic filters
@ 2015-02-03 14:11 Ignacy Gawedzki
  2015-02-03 17:32 ` [PATCH net 0/1] " Ignacy Gawędzki
  2015-02-03 17:32 ` [PATCH net 1/1] cls_api.c: Fix dumping of non-existing actions' stats Ignacy Gawędzki
  0 siblings, 2 replies; 10+ messages in thread
From: Ignacy Gawedzki @ 2015-02-03 14:11 UTC (permalink / raw)
  To: netdev

Hi everyone,

I have a problem with tc filter and very simple "basic" filters with no
associated action.

The thing is I have an HTB qdisc with handle 1: with a single class 1:1
attached to it.  When I add a basic filter that does nothing,

  tc filter add dev eth0 prio 1 handle 1 parent 1: basic classid 1:1

it doesn't completely appear when I type

  tc filter show dev eth0

When debugging basic_dump() in net/sched/cls_basic.c, I noticed that
tcf_exts_dump_stats() returns -1, which triggers a jump to nla_put_failure
which ends up removing all the added attributes so far.  When looking at
tcf_action_copy_stats() in net/sched/act_api.c, which is ultimately called by
tcf_exts_dump_stats(), I see that the returned error is triggered by a->priv
being NULL.

Although I confess I didn't make the effort of understanding all the workings
of a->priv in this context, it seems to me that if that is NULL, this is
probably not a good reason to return an error.  I made the change below and so
far it works for me.

Can anyone take a critical look at this?

Thanks.

Ignacy

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 3d43e49..6dd46be 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -602,7 +602,7 @@ int tcf_action_copy_stats(struct sk_buff *skb, struct
tc_action *a,
        struct tcf_common *p = a->priv;
 
        if (p == NULL)
-               goto errout;
+               return 0;
 
        /* compat_mode being true specifies a call that is supposed
         * to add additional backward compatibility statistic TLVs.

-- 
Ignacy Gawędzki
R&D Engineer
Green Communications

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-02-25  2:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-03 14:11 RFC: Fix "tc filter show" for basic filters Ignacy Gawedzki
2015-02-03 17:32 ` [PATCH net 0/1] " Ignacy Gawędzki
2015-02-03 17:32 ` [PATCH net 1/1] cls_api.c: Fix dumping of non-existing actions' stats Ignacy Gawędzki
2015-02-03 17:39   ` Cong Wang
2015-02-03 17:51     ` Eric Dumazet
2015-02-03 18:05     ` [PATCH net v2] " Ignacy Gawędzki
2015-02-03 18:10       ` Cong Wang
2015-02-05  4:26   ` [PATCH net 1/1] " David Miller
2015-02-25  0:20     ` Cong Wang
2015-02-25  2:15       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox