All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: David Miller <davem@davemloft.net>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: Re: [net-next PATCH v2 5/6] net sched: skbedit action fix late binding
Date: Sun, 8 May 2016 20:28:50 -0700	[thread overview]
Message-ID: <CAM_iQpXTTJjs0HBvRDzVY4eHVrGenq2bzkwCQo92vwWV0e9LUA@mail.gmail.com> (raw)
In-Reply-To: <1462728392-28489-6-git-send-email-jhs@emojatatu.com>

On Sun, May 8, 2016 at 10:26 AM, Jamal Hadi Salim <jhs@mojatatu.com> wrote:
> From: Jamal Hadi Salim <jhs@mojatatu.com>
>
> The process below was broken and is fixed with this patch.
>
> //add a skbedit action and give it an instance id of 1
> sudo tc actions add action skbedit mark 10 index 1
> //create a filter which binds to skbedit action id 1
> sudo tc filter add dev $DEV parent ffff: protocol ip prio 1 u32\
> match ip dst 17.0.0.1/32 flowid 1:10 action skbedit index 1
>
> Message before fix was:
> RTNETLINK answers: Invalid argument
> We have an error talking to the kernel
>
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
> ---
>  net/sched/act_skbedit.c | 22 +++++++++++++++-------
>  1 file changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
> index 51b2499..784b478 100644
> --- a/net/sched/act_skbedit.c
> +++ b/net/sched/act_skbedit.c
> @@ -69,7 +69,7 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
>         struct tcf_skbedit *d;
>         u32 flags = 0, *priority = NULL, *mark = NULL;
>         u16 *queue_mapping = NULL;
> -       int ret = 0, err;
> +       int ret = 0, err, aexists = 0;
>
>         if (nla == NULL)
>                 return -EINVAL;
> @@ -96,12 +96,22 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
>                 mark = nla_data(tb[TCA_SKBEDIT_MARK]);
>         }
>
> -       if (!flags)
> -               return -EINVAL;
> -
>         parm = nla_data(tb[TCA_SKBEDIT_PARMS]);
>
> -       if (!tcf_hash_check(tn, parm->index, a, bind)) {
> +       aexists = tcf_hash_check(tn, parm->index, a, bind);
> +
> +       /* if action exists and this is a late filter bind, no need
> +        * to continue processing
> +       */

This comment looks useless, at least for me, because the code
is already clear.


> +       if (aexists && bind)
> +                       return 0;


One extra tab?


> +
> +       if (!flags) {
> +               tcf_hash_release(a, bind);
> +               return -EINVAL;
> +       }
> +
> +       if (!aexists) {
>                 ret = tcf_hash_create(tn, parm->index, est, a,
>                                       sizeof(*d), bind, false);
>                 if (ret)
> @@ -111,8 +121,6 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
>                 ret = ACT_P_CREATED;
>         } else {
>                 d = to_skbedit(a);
> -               if (bind)
> -                       return 0;
>                 tcf_hash_release(a, bind);
>                 if (!ovr)
>                         return -EEXIST;
> --
> 1.9.1
>

  reply	other threads:[~2016-05-09  3:29 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-08 17:26 [net-next PATCH v2 0/6] net sched: Fix broken late binding of actions Jamal Hadi Salim
2016-05-08 17:26 ` [net-next PATCH v2 1/6] net sched: vlan action fix late binding Jamal Hadi Salim
2016-05-09  3:08   ` Cong Wang
2016-05-09 11:50     ` Jamal Hadi Salim
2016-05-10 20:52     ` Jamal Hadi Salim
2016-05-08 17:26 ` [net-next PATCH v2 2/6] net sched: ipt " Jamal Hadi Salim
2016-05-08 17:26 ` [net-next PATCH v2 3/6] net sched: mirred " Jamal Hadi Salim
2016-05-09  3:19   ` Cong Wang
2016-05-09 11:51     ` Jamal Hadi Salim
2016-05-10  4:37       ` Cong Wang
2016-05-08 17:26 ` [net-next PATCH v2 4/6] net sched: simple " Jamal Hadi Salim
2016-05-08 17:26 ` [net-next PATCH v2 5/6] net sched: skbedit " Jamal Hadi Salim
2016-05-09  3:28   ` Cong Wang [this message]
2016-05-09 11:53     ` Jamal Hadi Salim
2016-05-08 17:26 ` [net-next PATCH v2 6/6] net sched: ife " Jamal Hadi Salim
2016-05-09  3:32   ` Cong Wang
2016-05-09 11:54     ` Jamal Hadi Salim
2016-05-08 17:29 ` [net-next PATCH v2 0/6] net sched: Fix broken late binding of actions Jamal Hadi Salim
2016-05-09  4:30   ` David Miller
2016-05-09 11:54     ` Jamal Hadi Salim

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=CAM_iQpXTTJjs0HBvRDzVY4eHVrGenq2bzkwCQo92vwWV0e9LUA@mail.gmail.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jhs@mojatatu.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.