From: Cong Wang <xiyou.wangcong@gmail.com>
To: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Cong Wang <cwang@twopensource.com>
Subject: Re: [Patch net] sched, cls: check if we could overwrite actions when changing a filter
Date: Wed, 16 Apr 2014 14:10:08 -0700 [thread overview]
Message-ID: <CAM_iQpXRVZ8_keaL-8OkmRVguA29bnTPS2ZHZ0j2SSeB6A=1jQ@mail.gmail.com> (raw)
In-Reply-To: <534E77D0.8000307@mojatatu.com>
On Wed, Apr 16, 2014 at 5:30 AM, Jamal Hadi Salim <jhs@mojatatu.com> wrote:
> On 04/15/14 19:46, Cong Wang wrote:
>>
>> From: Cong Wang <cwang@twopensource.com>
>>
>> When actions are attached to a filter, they are a part of the filter
>> itself, so when changing a filter we should allow to overwrite the actions
>> inside as well.
>>
>> In my specific case, when I tried to _append_ a new action to an existing
>> filter which already has an action, I got EEXIST since kernel refused
>> to overwrite the existing one in kernel.
>>
>> This patch checks if we are changing the filter checking NLM_F_CREATE flag
>> (Sigh, filters don't use NLM_F_REPLACE...) and then passes the boolean
>> down
>> to actions. This fixes the problem above.
>
>
>
> What are you trying to achieve?
I thought it's clear: I have a filter F1 contains an action A1,
they are already in kernel (therefore I can read them from libnl cache),
then I want to append A2 to F1 so that F1 would have two actions
A1 and A2.
In short: change from F1 -> A1 to F1 -> A1 -> A2 atomically.
> These are general netlink rules (which can be streamlined by
> the object).
> Append means "I dont care if this exists, add it to the end"
Exactly what I meant.
> In that case, you would specify the an existing filter rule but
> in order to resolve ambiguity tc classifiers provide priorities
> (i.e just specify a different priority) and the rule will be added
> before or after the conflicting rule.
> If you dont do that then you will get back EEXIST to tell you
> there is a conflict.
But I already told kernel I am changing a filter, so why it
complains? I should change an existing one, shouldn't I?
> You cant replace an existing filter in particular when it has
> a graph of actions attached to it. You can replace the paremetrization
> of an existing bound action - but i am not sure that is what you
> are trying to do here. For that address the specific action directly.
> i.e tc action ....
Why? Since actions are inside it, I should be able to change any
part of it, right?
> If otoh you wanted to replace the filter + action graph with a backup
> rule, then just add it lower in the priority list and delete the
> existing one etc.
>
This is not atomic, is it?
next prev parent reply other threads:[~2014-04-16 21:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-15 23:46 [Patch net] sched, cls: check if we could overwrite actions when changing a filter Cong Wang
2014-04-16 12:30 ` Jamal Hadi Salim
2014-04-16 21:10 ` Cong Wang [this message]
2014-04-17 11:50 ` Jamal Hadi Salim
2014-04-17 20:48 ` Cong Wang
2014-04-18 14:26 ` Jamal Hadi Salim
2014-04-18 17:18 ` Cong Wang
2014-04-19 11:10 ` Jamal Hadi Salim
2014-04-21 23:28 ` Cong Wang
2014-04-23 11:30 ` Jamal Hadi Salim
2014-04-24 21:12 ` Cong Wang
2014-04-25 15:48 ` Jamal Hadi Salim
2014-04-25 20:41 ` 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='CAM_iQpXRVZ8_keaL-8OkmRVguA29bnTPS2ZHZ0j2SSeB6A=1jQ@mail.gmail.com' \
--to=xiyou.wangcong@gmail.com \
--cc=cwang@twopensource.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).