Skip to content

Commit

Permalink
selftests: router_bridge: Add tests to remove and add PVID
Browse files Browse the repository at this point in the history
This test relies on PVID being configured on the bridge itself. Thus when
it is deconfigured, the system should lose the ability to forward traffic.
Later when it is added again, the ability to forward traffic should be
regained. Add tests to exercise these configuration changes and verify
results.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Danielle Ratson <danieller@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Petr Machata authored and David S. Miller committed Jul 14, 2023
1 parent 5f44a71 commit c7203a2
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions tools/testing/selftests/net/forwarding/router_bridge.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

# +------------------------+ +----------------------+
# | H1 (vrf) | | H2 (vrf) |
# | + $h1 | | + $h2 |
# | | 192.0.2.1/28 | | | 192.0.2.130/28 |
# | | 2001:db8:1::1/64 | | | 2001:db8:2::2/64 |
# | | | | | |
# +----|-------------------+ +--|-------------------+
# | |
# +----|--------------------------------------------------|-------------------+
# | SW | | |
# | +--|-----------------------------+ + $swp2 |
# | | + $swp1 BR1 (802.1q) | 192.0.2.129/28 |
# | | 192.0.2.2/28 | 2001:db8:2::1/64 |
# | | 2001:db8:1::1/64 | |
# | | | |
# | +--------------------------------+ |
# +---------------------------------------------------------------------------+

ALL_TESTS="
ping_ipv4
ping_ipv6
config_remove_pvid
ping_ipv4_fails
ping_ipv6_fails
config_add_pvid
ping_ipv4
ping_ipv6
"
NUM_NETIFS=4
source lib.sh
Expand Down Expand Up @@ -62,6 +86,22 @@ router_destroy()
ip link del dev br1
}

config_remove_pvid()
{
log_info "Remove PVID from the bridge"

bridge vlan add dev br1 vid 1 self
sleep 2
}

config_add_pvid()
{
log_info "Add PVID to the bridge"

bridge vlan add dev br1 vid 1 self pvid untagged
sleep 2
}

setup_prepare()
{
h1=${NETIFS[p1]}
Expand Down Expand Up @@ -104,6 +144,16 @@ ping_ipv6()
ping6_test $h1 2001:db8:2::2
}

ping_ipv4_fails()
{
ping_test_fails $h1 192.0.2.130
}

ping_ipv6_fails()
{
ping6_test_fails $h1 2001:db8:2::2
}

trap cleanup EXIT

setup_prepare
Expand Down

0 comments on commit c7203a2

Please sign in to comment.