aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2021-07-21 15:32:24 +0000
committerKristof Provost <kp@FreeBSD.org>2021-08-02 15:03:02 +0000
commit83dc038e594c6875ce44e79db2b8e494d53e5d5d (patch)
treea17ee3dbf9022842c98e0cf1f835f2e85a76f421
parent5f0efabf2b16d15ed7da25b1a8b0b24b8352b6d1 (diff)
downloadsrc-83dc038e594c6875ce44e79db2b8e494d53e5d5d.tar.gz
src-83dc038e594c6875ce44e79db2b8e494d53e5d5d.zip
bridge tests: test linking bridges with a gif tunnel
Fairly basic test case for using gif(4)'s ability to tunnel Ethernet traffic between bridges. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 4b765ab4cda051a6d9ceb5fb9cac80c7f3b910bf)
-rwxr-xr-xtests/sys/net/if_bridge_test.sh66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh
index 4703efed46b8..b029d8d60419 100755
--- a/tests/sys/net/if_bridge_test.sh
+++ b/tests/sys/net/if_bridge_test.sh
@@ -452,6 +452,71 @@ stp_validation_cleanup()
vnet_cleanup
}
+atf_test_case "gif" "cleanup"
+gif_head()
+{
+ atf_set descr 'gif as a bridge member'
+ atf_set require.user root
+}
+
+gif_body()
+{
+ vnet_init
+
+ epair=$(vnet_mkepair)
+
+ vnet_mkjail one ${epair}a
+ vnet_mkjail two ${epair}b
+
+ jexec one sysctl net.link.gif.max_nesting=2
+ jexec two sysctl net.link.gif.max_nesting=2
+
+ jexec one ifconfig ${epair}a 192.0.2.1/24 up
+ jexec two ifconfig ${epair}b 192.0.2.2/24 up
+
+ # Tunnel
+ gif_one=$(jexec one ifconfig gif create)
+ gif_two=$(jexec two ifconfig gif create)
+
+ jexec one ifconfig ${gif_one} tunnel 192.0.2.1 192.0.2.2
+ jexec one ifconfig ${gif_one} up
+ jexec two ifconfig ${gif_two} tunnel 192.0.2.2 192.0.2.1
+ jexec two ifconfig ${gif_two} up
+
+ bridge_one=$(jexec one ifconfig bridge create)
+ bridge_two=$(jexec two ifconfig bridge create)
+ jexec one ifconfig ${bridge_one} 198.51.100.1/24 up
+ jexec one ifconfig ${bridge_one} addm ${gif_one}
+ jexec two ifconfig ${bridge_two} 198.51.100.2/24 up
+ jexec two ifconfig ${bridge_two} addm ${gif_two}
+
+ # Sanity check
+ atf_check -s exit:0 -o ignore \
+ jexec one ping -c 1 192.0.2.2
+
+ # Test tunnel
+ atf_check -s exit:0 -o ignore \
+ jexec one ping -c 1 198.51.100.2
+ atf_check -s exit:0 -o ignore \
+ jexec one ping -c 1 -s 1200 198.51.100.2
+ atf_check -s exit:0 -o ignore \
+ jexec one ping -c 1 -s 2000 198.51.100.2
+
+ # Higher MTU on the tunnel than on the underlying interface
+ jexec one ifconfig ${epair}a mtu 1000
+ jexec two ifconfig ${epair}b mtu 1000
+
+ atf_check -s exit:0 -o ignore \
+ jexec one ping -c 1 -s 1200 198.51.100.2
+ atf_check -s exit:0 -o ignore \
+ jexec one ping -c 1 -s 2000 198.51.100.2
+}
+
+gif_cleanup()
+{
+ vnet_cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case "bridge_transmit_ipv4_unicast"
@@ -463,4 +528,5 @@ atf_init_test_cases()
atf_add_test_case "delete_with_members"
atf_add_test_case "mac_conflict"
atf_add_test_case "stp_validation"
+ atf_add_test_case "gif"
}