netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonas Gorski <jonas.gorski@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Florian Fainelli <f.fainelli@gmail.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org
Subject: [PATCH RFC/RFT net-next v2 5/5] selftests: no_forwarding: test VLAN uppers on VLAN-unaware bridged ports
Date: Mon,  1 Dec 2025 11:28:17 +0100	[thread overview]
Message-ID: <20251201102817.301552-6-jonas.gorski@gmail.com> (raw)
In-Reply-To: <20251201102817.301552-1-jonas.gorski@gmail.com>

A VLAN upper on a bridged port consumes the VLAN on this port and
inhibits forwarding of it.

Add a test that for VLAN-unaware bridges a single VLAN upper prevents
forwarding of that VLAN from that port. This is asymmetric "blocking",
as other ports' traffic can still be forwarded to this port. This is not
tested, as this is a no-forward test, not a forward test.

Since we are testing VLAN uppers, skip checking untagged traffic in
those cases.

Disallowing VLAN uppers on bridge ports is a valid choice for switchdev
drivers, so test if we can create them first and skip the tests if not.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
v1 -> v2:
* new patch

 .../selftests/net/forwarding/no_forwarding.sh | 20 ++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/forwarding/no_forwarding.sh b/tools/testing/selftests/net/forwarding/no_forwarding.sh
index c8adf04e1328..d223b5b79a4f 100755
--- a/tools/testing/selftests/net/forwarding/no_forwarding.sh
+++ b/tools/testing/selftests/net/forwarding/no_forwarding.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 
-ALL_TESTS="standalone two_bridges one_bridge_two_pvids bridge_aware_vlan_uppers"
+ALL_TESTS="standalone two_bridges one_bridge_two_pvids bridge_unaware_vlan_upper bridge_aware_vlan_uppers"
 NUM_NETIFS=4
 
 source lib.sh
@@ -226,6 +226,24 @@ one_bridge_two_pvids()
 	ip link del br0
 }
 
+bridge_unaware_vlan_upper()
+{
+	ip link add br0 type bridge && ip link set br0 up
+	ip link set $swp1 master br0
+	ip link set $swp2 master br0
+
+	if ! ip link add name $swp1.10 link $swp1 type vlan id 10 2>/dev/null; then
+		ip link del br0
+		echo "SKIP: bridge does not allow vlan uppers on bridge ports"
+		exit "$ksft_skip"
+	fi
+	vlan_destroy $swp1 10
+
+	run_test "Switch ports in VLAN-unaware bridge with VLAN upper" 1
+
+	ip link del br0
+}
+
 bridge_aware_vlan_uppers()
 {
 	ip link add br0 type bridge vlan_filtering 1 vlan_default_pvid 0
-- 
2.43.0


      parent reply	other threads:[~2025-12-01 10:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01 10:28 [PATCH RFC/RFT net-next v2 0/5] net: dsa: deny unsupported 8021q upper on bridge port configurations Jonas Gorski
2025-12-01 10:28 ` [PATCH RFC/RFT net-next v2 1/5] net: dsa: deny bridge VLAN with existing 8021q upper on any port Jonas Gorski
2025-12-01 14:47   ` Simon Horman
2025-12-01 19:52     ` Jonas Gorski
2025-12-01 22:48       ` Chris Mason
2025-12-02 16:16         ` Simon Horman
2025-12-03  0:36           ` Chris Mason
2025-12-01 10:28 ` [PATCH RFC/RFT net-next v2 2/5] net: dsa: deny multiple 8021q uppers on bridged ports for the same VLAN Jonas Gorski
2025-12-01 10:28 ` [PATCH RFC/RFT net-next v2 3/5] selftests: no_forwarding: test VLAN uppers on VLAN aware bridged ports Jonas Gorski
2025-12-01 14:19   ` Simon Horman
2025-12-01 19:46     ` Jonas Gorski
2025-12-01 10:28 ` [PATCH RFC/RFT net-next v2 4/5] net: dsa: deny 8021q uppers on vlan unaware " Jonas Gorski
2025-12-01 10:28 ` Jonas Gorski [this message]

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=20251201102817.301552-6-jonas.gorski@gmail.com \
    --to=jonas.gorski@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=vladimir.oltean@nxp.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).