All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jamal Hadi Salim <jhs@mojatatu.com>
To: Cong Wang <xiyou.wangcong@gmail.com>, netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>
Subject: Re: [Patch net-next] net_sched: act: fix a bug in tcf_register_action()
Date: Wed, 15 Jan 2014 07:34:49 -0500	[thread overview]
Message-ID: <52D68069.1090804@mojatatu.com> (raw)
In-Reply-To: <1389739694-9251-1-git-send-email-xiyou.wangcong@gmail.com>

On 01/14/14 17:48, Cong Wang wrote:
> In tcf_register_action() we check ->type and ->kind to see if there
> is an existing action registered, but ipt action registers two
> actions with same type but different kinds. This should be a valid
> case, otherwise only xt can be registered.
>


We cant allow for conflicts by name or id - we want to catch them.
So just introduce TCA_ACT_XT instead (ID 7)

[
Note: iptables used to be a constant moving API target
and this is supposed to be the latest "backward compat mode".
New kernel/iproute ==> We want to love "xt" more than "ipt".
We infact want to eventually kill "ipt".
but this preference is hard to achieve as you may have run into.
I would be curious how you tested and run into this..
].

cheers,
jamal

> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
>
> ---
> diff --git a/net/sched/act_api.c b/net/sched/act_api.c
> index 35f89e9..2070ee3 100644
> --- a/net/sched/act_api.c
> +++ b/net/sched/act_api.c
> @@ -273,7 +273,7 @@ int tcf_register_action(struct tc_action_ops *act)
>
>   	write_lock(&act_mod_lock);
>   	list_for_each_entry(a, &act_base, head) {
> -		if (act->type == a->type || (strcmp(act->kind, a->kind) == 0)) {
> +		if (act->type == a->type && (strcmp(act->kind, a->kind) == 0)) {
>   			write_unlock(&act_mod_lock);
>   			return -EEXIST;
>   		}
>

  reply	other threads:[~2014-01-15 12:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-14 22:48 [Patch net-next] net_sched: act: fix a bug in tcf_register_action() Cong Wang
2014-01-15 12:34 ` Jamal Hadi Salim [this message]
2014-01-15 17:40   ` Cong Wang

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=52D68069.1090804@mojatatu.com \
    --to=jhs@mojatatu.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /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.