diff options
author | Kristof Provost <kp@FreeBSD.org> | 2023-04-07 16:02:35 +0000 |
---|---|---|
committer | Kristof Provost <kp@FreeBSD.org> | 2023-04-14 11:17:02 +0000 |
commit | f97802a35e484ee0f8e11d3956189392ea995b29 (patch) | |
tree | 74664fa927f911d828d36122e1de7dea4a93d326 | |
parent | b0e38a1373c087e5a55eefcdee69ccfbf12f86ce (diff) | |
download | src-f97802a35e484ee0f8e11d3956189392ea995b29.tar.gz src-f97802a35e484ee0f8e11d3956189392ea995b29.zip |
bridge tests: test cross-vlan bridging
Ensure that the bridge takes VLAN IDs into account when learning
addresses.
PR: 270559
Differential Revision: https://reviews.freebsd.org/D39379
-rwxr-xr-x | tests/sys/net/if_bridge_test.sh | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index 42f65936d038..1d8c4d317090 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -597,6 +597,73 @@ mtu_cleanup() vnet_cleanup } +atf_test_case "vlan" "cleanup" +vlan_head() +{ + atf_set descr 'Ensure the bridge takes vlan ID into account, PR#270559' + atf_set require.user root +} + +vlan_body() +{ + vnet_init + + vid=1 + + epaira=$(vnet_mkepair) + epairb=$(vnet_mkepair) + + br=$(vnet_mkbridge) + + vnet_mkjail one ${epaira}b + vnet_mkjail two ${epairb}b + + ifconfig ${br} up + ifconfig ${epaira}a up + ifconfig ${epairb}a up + ifconfig ${br} addm ${epaira}a addm ${epairb}a + + jexec one ifconfig ${epaira}b up + jexec one ifconfig ${epaira}b.${vid} create + + jexec two ifconfig ${epairb}b up + jexec two ifconfig ${epairb}b.${vid} create + + # Create a MAC address conflict between an untagged and tagged interface + jexec two ifconfig ${epairb}b.${vid} ether 02:05:6e:06:28:1a + jexec one ifconfig ${epaira}b ether 02:05:6e:06:28:1a + jexec one ifconfig ${epaira}b.${vid} ether 02:05:6e:06:28:1b + + # Add ip address, will also populate $br's fowarding table, by ARP announcement + jexec one ifconfig ${epaira}b.${vid} 192.0.2.1/24 up + jexec two ifconfig ${epairb}b.${vid} 192.0.2.2/24 up + + sleep 0.5 + + ifconfig ${br} + jexec one ifconfig + jexec two ifconfig + ifconfig ${br} addr + + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -t 1 192.0.2.2 + + # This will trigger a mac flap (by ARP announcement) + jexec one ifconfig ${epaira}b 192.0.2.1/24 up + + sleep 0.5 + + ifconfig ${br} addr + + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -t 1 192.0.2.2 +} + +vlan_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" @@ -610,4 +677,5 @@ atf_init_test_cases() atf_add_test_case "stp_validation" atf_add_test_case "gif" atf_add_test_case "mtu" + atf_add_test_case "vlan" } |