netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zahari Doychev <zahari.doychev@linux.com>
To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org,
	nikolay@cumulusnetworks.com, roopa@cumulusnetworks.com
Cc: jhs@mojatatu.com, johannes@sipsolutions.net, zahari.doychev@linux.com
Subject: [PATCH 0/2] net: bridge: fix tc added QinQ forwarding
Date: Sun, 13 Jan 2019 14:59:37 +0100	[thread overview]
Message-ID: <20190113135939.8970-1-zahari.doychev@linux.com> (raw)

The Linux bridge seems to not correctly forward double vlan tagged packets
added using the tc vlan action. I am using a bridge with two netdevs and on one
of them a have the clsact qdisc with tc flower rule adding two vlan
tags.

ip link add name br0 type bridge vlan_filtering 1
ip link set dev br0 up

ip link set dev net0 up
ip link set dev net0 master br0

ip link set dev net1 up
ip link set dev net1 master br0

bridge vlan add dev net0 vid 100 master
bridge vlan add dev br0 vid 100 self
bridge vlan add dev net1 vid 100 master

tc qdisc add dev net0 handle ffff: clsact
tc qdisc add dev net1 handle ffff: clsact

tc filter add dev net0 ingress pref 1 protocol all flower \
		  action vlan push id 10 pipe action vlan push id 100

tc filter add dev net0 egress pref 1 protocol 802.1q flower \
		  vlan_id 100 vlan_ethtype 802.1q cvlan_id 10 \
		  action vlan pop pipe action vlan pop

When using the setup above the packets coming on net0 get double tagged but
the MAC headers gets corrupted when the packets go out of net1. It seems that
the second vlan header is not considered in br_dev_queue_push_xmit. The skb
data pointer is decremented only by the ethernet header length. This later
causes the function validate_xmit_vlan to insert the outer vlan tag behind
the inner vlan tag. The inner vlan becomes also part of the source mac address.

The first patch fixes the problem described above. The second one fixes
similar problem when the tpids of the bridge and the inserted vlan don't match.
It fixes again incorrect insertion of the skb vlan into the payload. The two
patches seem to fix the problem but I am not sure if this the right way to fix
this and if there is any other impact.

Zahari Doychev (2):
  net: bridge: fix tc added QinQ forwarding
  net: bridge: fix tc added vlan insert as payload

 net/bridge/br_forward.c | 2 +-
 net/bridge/br_vlan.c    | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

-- 
2.20.1

             reply	other threads:[~2019-01-13 13:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-13 13:59 Zahari Doychev [this message]
2019-01-13 13:59 ` [PATCH 1/2] net: bridge: fix tc added QinQ forwarding Zahari Doychev
2019-01-15  6:11   ` [Bridge] " Toshiaki Makita
2019-01-17  8:17     ` Zahari Doychev
2019-01-17  8:57       ` Toshiaki Makita
2019-01-17 19:19         ` Cong Wang
2019-01-18  2:29           ` Toshiaki Makita
2019-01-21 21:11             ` Zahari Doychev
2019-01-22  8:45               ` Toshiaki Makita
2019-01-13 13:59 ` [PATCH 2/2] net: bridge: fix tc added vlan insert as payload Zahari Doychev
2019-01-14 11:46 ` [PATCH 0/2] net: bridge: fix tc added QinQ forwarding Nikolay Aleksandrov
2019-01-14 19:47   ` Zahari Doychev

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=20190113135939.8970-1-zahari.doychev@linux.com \
    --to=zahari.doychev@linux.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=jhs@mojatatu.com \
    --cc=johannes@sipsolutions.net \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=roopa@cumulusnetworks.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).