From: Cong Wang <cwang@twopensource.com>
To: Akshat Kakkar <akshat.1984@gmail.com>
Cc: netdev <netdev@vger.kernel.org>,
Cong Wang <xiyou.wangcong@gmail.com>,
Stephen Hemminger <stephen@networkplumber.org>,
Jamal Hadi Salim <jhs@mojatatu.com>
Subject: Re: [fw filter]: Broken! fw mark based tc class selection not working
Date: Fri, 11 Sep 2015 17:00:49 -0700 [thread overview]
Message-ID: <CAHA+R7N6rTS5rmALk_2FxUXc0s9Ni4snJQ52tS3imaA6hotdHw@mail.gmail.com> (raw)
In-Reply-To: <CAA5aLPgCqOXU3vw6moSvADuOc4Q_TM2iJLHjSH0O8NwYJJ1t7g@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1050 bytes --]
On Fri, Sep 11, 2015 at 3:24 PM, Akshat Kakkar <akshat.1984@gmail.com> wrote:
> There is no handle with fw filter. That's the whole point is. If
> handle and class (flow id) is not specified, then whatever be the mark
> on the packet, its automatically set as flowid. So if mark is 0x10003,
> then this fw filter
>
> tc filter add dev eth0 parent 1:0 protocol ip fw
>
> will cause 0x10003 being set as classid I.e. 1:3.
>
>
> tc qdisc add dev eth0 root handle 1: htb
> tc class add dev eth0 parent 1: classid 1:a htb rate 1mbit
> tc class add dev eth0 parent 1: classid 1:b htb rate 1mbit
> tc class add dev eth0 parent 1: classid 1:c htb rate 1mbit
> tc filter add dev eth0 parent 1:0 protocol ip fw
>
> iptables -t mangle -I OUTPUT -o eth0 -p tcp -j MARK --set-mark 0x1000a
> iptables -t mangle -I OUTPUT -o eth0 -p icmp -j MARK --set-mark 0x1000b
> iptables -t mangle -I OUTPUT -o eth0 -p udp -j MARK --set-mark 0x1000c
Hmm, I didn't know that before either. Looks like my tp->init change
breaks it.
Could you try the following patch?
Thanks!
[-- Attachment #2: cls_fw.diff --]
[-- Type: text/plain, Size: 971 bytes --]
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
index 715e01e..b6394ab 100644
--- a/net/sched/cls_fw.c
+++ b/net/sched/cls_fw.c
@@ -34,6 +34,7 @@
struct fw_head {
u32 mask;
bool mask_set;
+ bool old_method;
struct fw_filter __rcu *ht[HTSIZE];
struct rcu_head rcu;
};
@@ -65,7 +66,7 @@ static int fw_classify(struct sk_buff *skb, const struct tcf_proto *tp,
int r;
u32 id = skb->mark;
- if (head != NULL) {
+ if (!head->old_method) {
id &= head->mask;
for (f = rcu_dereference_bh(head->ht[fw_hash(id)]); f;
@@ -120,6 +121,7 @@ static int fw_init(struct tcf_proto *tp)
if (head == NULL)
return -ENOBUFS;
+ head->old_method = true;
head->mask_set = false;
rcu_assign_pointer(tp->root, head);
return 0;
@@ -302,6 +304,7 @@ static int fw_change(struct net *net, struct sk_buff *in_skb,
if (!handle)
return -EINVAL;
+ head->old_method = false;
if (!head->mask_set) {
head->mask = 0xFFFFFFFF;
if (tb[TCA_FW_MASK])
next prev parent reply other threads:[~2015-09-12 0:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-11 16:34 [fw filter]: Broken! fw mark based tc class selection not working Akshat Kakkar
2015-09-11 20:32 ` Cong Wang
2015-09-11 22:24 ` Akshat Kakkar
2015-09-12 0:00 ` Cong Wang [this message]
2015-09-14 12:28 ` Jamal Hadi Salim
2015-09-14 22:04 ` Cong Wang
2015-09-17 12:16 ` 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=CAHA+R7N6rTS5rmALk_2FxUXc0s9Ni4snJQ52tS3imaA6hotdHw@mail.gmail.com \
--to=cwang@twopensource.com \
--cc=akshat.1984@gmail.com \
--cc=jhs@mojatatu.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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 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).