Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Mar 2021 15:17:58 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e11329536494 - stable/12 - bridge tests: Ensure that bridges in different jails get different MAC addresses
Message-ID:  <202103021517.122FHwWD039832@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by kp:

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

commit e1132953649454ed7ae40e156c23de20d6a3827c
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2020-04-19 16:30:49 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2021-03-02 13:03:06 +0000

    bridge tests: Ensure that bridges in different jails get different MAC addresses
    
    We used to have a problem where bridges created in different vnet jails
    would end up having the same mac address. This is now fixed by
    including the jail name as a seed for the mac address generation, but we
    should verify that it doesn't regress.
    
    (cherry picked from commit 2885ae0c3ca3ea93e1f227ecb3003db2e94f4129)
---
 tests/sys/net/if_bridge_test.sh | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh
index cb9c297220b6..111281799e9d 100755
--- a/tests/sys/net/if_bridge_test.sh
+++ b/tests/sys/net/if_bridge_test.sh
@@ -271,6 +271,44 @@ delete_with_members_cleanup()
 	vnet_cleanup
 }
 
+atf_test_case "mac_conflict" "cleanup"
+mac_conflict_head()
+{
+	atf_set descr 'Ensure that bridges in different jails get different mac addresses'
+	atf_set require.user root
+}
+
+mac_conflict_body()
+{
+	vnet_init
+
+	epair=$(vnet_mkepair)
+
+	# Ensure the bridge module is loaded so jails can use it.
+	tmpbridge=$(vnet_mkbridge)
+
+	vnet_mkjail bridge_mac_conflict_one ${epair}a
+	vnet_mkjail bridge_mac_conflict_two ${epair}b
+
+	jexec bridge_mac_conflict_one ifconfig bridge create
+	jexec bridge_mac_conflict_one ifconfig bridge0 192.0.2.1/24 up \
+	    addm ${epair}a
+	jexec bridge_mac_conflict_one ifconfig ${epair}a up
+
+	jexec bridge_mac_conflict_two ifconfig bridge create
+	jexec bridge_mac_conflict_two ifconfig bridge0 192.0.2.2/24 up \
+	    addm ${epair}b
+	jexec bridge_mac_conflict_two ifconfig ${epair}b up
+
+	atf_check -s exit:0 -o ignore \
+	    jexec bridge_mac_conflict_one ping -c 3 192.0.2.2
+}
+
+mac_conflict_cleanup()
+{
+	vnet_cleanup
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case "bridge_transmit_ipv4_unicast"
@@ -278,4 +316,5 @@ atf_init_test_cases()
 	atf_add_test_case "static"
 	atf_add_test_case "span"
 	atf_add_test_case "delete_with_members"
+	atf_add_test_case "mac_conflict"
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103021517.122FHwWD039832>