git: c4bf12b43711 - stable/12 - bridge tests: Basic span test
Kristof Provost
kp at FreeBSD.org
Tue Mar 2 15:18:02 UTC 2021
The branch stable/12 has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=c4bf12b4371112ea5e875b51befbb4c12b9707db
commit c4bf12b4371112ea5e875b51befbb4c12b9707db
Author: Kristof Provost <kp at FreeBSD.org>
AuthorDate: 2020-03-16 08:44:46 +0000
Commit: Kristof Provost <kp at FreeBSD.org>
CommitDate: 2021-03-02 13:03:06 +0000
bridge tests: Basic span test
Reviewed by: philip, emaste (previous version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23961
(cherry picked from commit bb490fcf195450d9cbbac00e6338b352aac32c5c)
---
tests/sys/net/if_bridge_test.sh | 55 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh
index 34b72c33bb36..7b26b97967ad 100755
--- a/tests/sys/net/if_bridge_test.sh
+++ b/tests/sys/net/if_bridge_test.sh
@@ -191,9 +191,64 @@ static_cleanup()
vnet_cleanup
}
+atf_test_case "span" "cleanup"
+span_head()
+{
+ atf_set descr 'Bridge span test'
+ atf_set require.user root
+}
+
+span_body()
+{
+ set -x
+ vnet_init
+
+ epair=$(vnet_mkepair)
+ epair_span=$(vnet_mkepair)
+ bridge=$(vnet_mkbridge)
+
+ vnet_mkjail one ${bridge} ${epair}a ${epair_span}a
+
+ ifconfig ${epair}b up
+ ifconfig ${epair_span}b up
+
+ jexec one ifconfig ${bridge} up
+ jexec one ifconfig ${epair}a up
+ jexec one ifconfig ${epair_span}a up
+ jexec one ifconfig ${bridge} addm ${epair}a
+
+ jexec one ifconfig ${bridge} span ${epair_span}a
+ jexec one ifconfig ${bridge} 192.0.2.1/24
+
+ # Send some traffic through the span
+ jexec one ping -c 1 -t 1 192.0.2.2
+
+ # Check that we see the traffic on the span interface
+ atf_check -s exit:0 \
+ $(atf_get_srcdir)/../netpfil/common/pft_ping.py \
+ --sendif ${epair}b \
+ --to 192.0.2.2 \
+ --recvif ${epair_span}b
+
+ jexec one ifconfig ${bridge} -span ${epair_span}a
+
+ # And no more traffic after we remove the span
+ atf_check -s exit:1 \
+ $(atf_get_srcdir)/../netpfil/common/pft_ping.py \
+ --sendif ${epair}b \
+ --to 192.0.2.2 \
+ --recvif ${epair_span}b
+}
+
+span_cleanup()
+{
+ vnet_cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case "bridge_transmit_ipv4_unicast"
atf_add_test_case "stp"
atf_add_test_case "static"
+ atf_add_test_case "span"
}
More information about the dev-commits-src-branches
mailing list