Netdev List
 help / color / mirror / Atom feed
From: Ignacy Gawedzki <ignacy.gawedzki@green-communications.fr>
To: netdev@vger.kernel.org
Subject: RFC: Fix "tc filter show" for basic filters
Date: Tue, 3 Feb 2015 15:11:00 +0100	[thread overview]
Message-ID: <20150203141059.GA25454@zenon.in.qult.net> (raw)

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

             reply	other threads:[~2015-02-03 14:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03 14:11 Ignacy Gawedzki [this message]
2015-02-03 17:32 ` [PATCH net 0/1] Re: RFC: Fix "tc filter show" for basic filters 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150203141059.GA25454@zenon.in.qult.net \
    --to=ignacy.gawedzki@green-communications.fr \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox