The branch stable/13 has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2c19b99c2f1c78bebb931f9465146ad4e7f1dec9

commit 2c19b99c2f1c78bebb931f9465146ad4e7f1dec9
Author:     Kristof Provost <k...@freebsd.org>
AuthorDate: 2021-02-20 09:13:33 +0000
Commit:     Kristof Provost <k...@freebsd.org>
CommitDate: 2021-03-02 14:50:21 +0000

    bridge tests: Test STP on top of VLAN devices
    
    This is basically the same test as the existing STP test, but now on top
    of VLAN interfaces instead of directly using the epair devices.
    
    MFC after:      1 week
    Sponsored by:   Orange Business Services
    Differential Revision:  https://reviews.freebsd.org/D28861
    
    (cherry picked from commit 26492ba2716f8b839f743bb663ce47405990fdf0)
---
 tests/sys/net/if_bridge_test.sh | 66 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh
index b848a03b273d..bc9add68ce25 100755
--- a/tests/sys/net/if_bridge_test.sh
+++ b/tests/sys/net/if_bridge_test.sh
@@ -124,6 +124,71 @@ stp_cleanup()
        vnet_cleanup
 }
 
+atf_test_case "stp_vlan" "cleanup"
+stp_vlan_head()
+{
+       atf_set descr 'Spanning tree on VLAN test'
+       atf_set require.user root
+}
+
+stp_vlan_body()
+{
+       vnet_init
+
+       epair_one=$(vnet_mkepair)
+       epair_two=$(vnet_mkepair)
+       bridge_a=$(vnet_mkbridge)
+       bridge_b=$(vnet_mkbridge)
+
+       vnet_mkjail a ${bridge_a} ${epair_one}a ${epair_two}a
+       vnet_mkjail b ${bridge_b} ${epair_one}b ${epair_two}b
+
+       jexec a ifconfig ${epair_one}a up
+       jexec a ifconfig ${epair_two}a up
+       vlan_a_one=$(jexec a ifconfig vlan create vlandev ${epair_one}a vlan 42)
+       vlan_a_two=$(jexec a ifconfig vlan create vlandev ${epair_two}a vlan 42)
+       jexec a ifconfig ${vlan_a_one} up
+       jexec a ifconfig ${vlan_a_two} up
+       jexec a ifconfig ${bridge_a} addm ${vlan_a_one}
+       jexec a ifconfig ${bridge_a} addm ${vlan_a_two}
+
+       jexec b ifconfig ${epair_one}b up
+       jexec b ifconfig ${epair_two}b up
+       vlan_b_one=$(jexec b ifconfig vlan create vlandev ${epair_one}b vlan 42)
+       vlan_b_two=$(jexec b ifconfig vlan create vlandev ${epair_two}b vlan 42)
+       jexec b ifconfig ${vlan_b_one} up
+       jexec b ifconfig ${vlan_b_two} up
+       jexec b ifconfig ${bridge_b} addm ${vlan_b_one}
+       jexec b ifconfig ${bridge_b} addm ${vlan_b_two}
+
+       jexec a ifconfig ${bridge_a} 192.0.2.1/24
+
+       # Enable spanning tree
+       jexec a ifconfig ${bridge_a} stp ${vlan_a_one}
+       jexec a ifconfig ${bridge_a} stp ${vlan_a_two}
+       jexec b ifconfig ${bridge_b} stp ${vlan_b_one}
+       jexec b ifconfig ${bridge_b} stp ${vlan_b_two}
+
+       jexec b ifconfig ${bridge_b} up
+       jexec a ifconfig ${bridge_a} up
+
+       # Give STP time to do its thing
+       sleep 5
+
+       a_discard=$(jexec a ifconfig ${bridge_a} | grep discarding)
+       b_discard=$(jexec b ifconfig ${bridge_b} | grep discarding)
+
+       if [ -z "${a_discard}" ] && [ -z "${b_discard}" ]
+       then
+               atf_fail "STP failed to detect bridging loop"
+       fi
+}
+
+stp_vlan_cleanup()
+{
+       vnet_cleanup
+}
+
 atf_test_case "static" "cleanup"
 static_head()
 {
@@ -329,6 +394,7 @@ atf_init_test_cases()
 {
        atf_add_test_case "bridge_transmit_ipv4_unicast"
        atf_add_test_case "stp"
+       atf_add_test_case "stp_vlan"
        atf_add_test_case "static"
        atf_add_test_case "span"
        atf_add_test_case "inherit_mac"
_______________________________________________
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"

Reply via email to