Netdev List
 help / color / mirror / Atom feed
From: Jamal Hadi Salim <jhs@mojatatu.com>
To: davem@davemloft.net
Cc: daniel@iogearbox.net, netdev@vger.kernel.org,
	Jamal Hadi Salim <jhs@mojatatu.com>
Subject: [net-next PATCH v2 1/1] net_sched fix: reclassification needs to consider ether protocol changes
Date: Tue, 16 Feb 2016 07:37:05 -0500	[thread overview]
Message-ID: <1455626225-16382-1-git-send-email-jhs@emojatatu.com> (raw)

From: Jamal Hadi Salim <jhs@mojatatu.com>

actions could change the etherproto in particular with ethernet
tunnelled data. Typically such actions, after peeling the outer header,
will ask for the packet to be  reclassified. We then need to restart
the classification with the new proto header.

Example setup used to catch this:
sudo tc qdisc add dev $ETH ingress
sudo $TC filter add dev $ETH parent ffff: pref 1 protocol 802.1Q \
u32 match u32 0 0 flowid 1:1 \
action vlan pop reclassify

Fixes: 3b3ae880266d ("net: sched: consolidate tc_classify{,_compat}")
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
 net/sched/sch_api.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index b5c2cf2..22ab634 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1818,13 +1818,14 @@ done:
 int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp,
 		struct tcf_result *res, bool compat_mode)
 {
-	__be16 protocol = tc_skb_protocol(skb);
 #ifdef CONFIG_NET_CLS_ACT
-	const struct tcf_proto *old_tp = tp;
 	int limit = 0;
+#endif
+	const struct tcf_proto *old_tp = tp;
+	__be16 protocol;
 
 reclassify:
-#endif
+	protocol = tc_skb_protocol(skb);
 	for (; tp; tp = rcu_dereference_bh(tp->next)) {
 		int err;
 
-- 
1.9.1

             reply	other threads:[~2016-02-16 12:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16 12:37 Jamal Hadi Salim [this message]
2016-02-16 15:20 ` [net-next PATCH v2 1/1] net_sched fix: reclassification needs to consider ether protocol changes Daniel Borkmann
2016-02-17 11:19   ` Jamal Hadi Salim
2016-02-17 11:48     ` Jamal Hadi Salim
  -- strict thread matches above, loose matches on Subject: below --
2016-02-17 11:37 [net-next PATCH v2 0/1] tc " Jamal Hadi Salim
2016-02-17 11:37 ` [net-next PATCH v2 1/1] net_sched fix: " Jamal Hadi Salim
2016-02-17 17:27   ` Cong Wang
2016-02-18 11:53     ` Daniel Borkmann
2016-02-18 12:26       ` 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=1455626225-16382-1-git-send-email-jhs@emojatatu.com \
    --to=jhs@mojatatu.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --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