Skip to content

Commit

Permalink
selftests: forwarding: Add a test case for externally learned FDB ent…
Browse files Browse the repository at this point in the history
…ries

Test that externally learned FDB entries can roam, but not age out.

Signed-off-by: Ido Schimmel <[email protected]>
Reviewed-by: Petr Machata <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
idosch authored and davem330 committed Jan 18, 2019
1 parent 7215927 commit 479a2b7
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding vlan_deletion"
ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding vlan_deletion extern_learn"
NUM_NETIFS=4
CHECK_TC="yes"
source lib.sh
Expand Down Expand Up @@ -109,6 +109,38 @@ vlan_deletion()
ping_ipv6
}

extern_learn()
{
local mac=de:ad:be:ef:13:37
local ageing_time

# Test that externally learned FDB entries can roam, but not age out
RET=0

bridge fdb add de:ad:be:ef:13:37 dev $swp1 master extern_learn vlan 1

bridge fdb show brport $swp1 | grep -q de:ad:be:ef:13:37
check_err $? "Did not find FDB entry when should"

# Wait for 10 seconds after the ageing time to make sure the FDB entry
# was not aged out
ageing_time=$(bridge_ageing_time_get br0)
sleep $((ageing_time + 10))

bridge fdb show brport $swp1 | grep -q de:ad:be:ef:13:37
check_err $? "FDB entry was aged out when should not"

$MZ $h2 -c 1 -p 64 -a $mac -t ip -q

bridge fdb show brport $swp2 | grep -q de:ad:be:ef:13:37
check_err $? "FDB entry did not roam when should"

log_test "Externally learned FDB entry - ageing & roaming"

bridge fdb del de:ad:be:ef:13:37 dev $swp2 master vlan 1 &> /dev/null
bridge fdb del de:ad:be:ef:13:37 dev $swp1 master vlan 1 &> /dev/null
}

trap cleanup EXIT

setup_prepare
Expand Down

0 comments on commit 479a2b7

Please sign in to comment.