git: 4b765ab4cda0 - main - bridge tests: test linking bridges with a gif tunnel

Kristof Provost kp at FreeBSD.org
Mon Jul 26 21:15:20 UTC 2021


The branch main has been updated by kp:

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

commit 4b765ab4cda051a6d9ceb5fb9cac80c7f3b910bf
Author:     Kristof Provost <kp at FreeBSD.org>
AuthorDate: 2021-07-21 15:32:24 +0000
Commit:     Kristof Provost <kp at FreeBSD.org>
CommitDate: 2021-07-26 21:13:31 +0000

    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")
---
 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 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"
 }


More information about the dev-commits-src-all mailing list