From owner-dev-commits-src-all@freebsd.org Wed Jul 28 20:07:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 612A4664682; Wed, 28 Jul 2021 20:07:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZl7f1ddpz3NrZ; Wed, 28 Jul 2021 20:07:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AE4023C69; Wed, 28 Jul 2021 20:07:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16SK7Qlh062515; Wed, 28 Jul 2021 20:07:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SK7QgI062514; Wed, 28 Jul 2021 20:07:26 GMT (envelope-from git) Date: Wed, 28 Jul 2021 20:07:26 GMT Message-Id: <202107282007.16SK7QgI062514@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 6e439506408d - main - bridge tests: test changing the bridge MTU MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6e439506408d36a663e666d35a340595539270a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jul 2021 20:07:26 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6e439506408d36a663e666d35a340595539270a4 commit 6e439506408d36a663e666d35a340595539270a4 Author: Kristof Provost AuthorDate: 2021-07-23 15:46:10 +0000 Commit: Kristof Provost CommitDate: 2021-07-28 20:01:12 +0000 bridge tests: test changing the bridge MTU Changing the bridge MTU will now also change all of the member interface MTUs. Test this. Reviewed by: donner Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31289 --- tests/sys/net/if_bridge_test.sh | 68 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index b029d8d60419..da797f4fd39a 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -517,6 +517,73 @@ gif_cleanup() vnet_cleanup } +atf_test_case "mtu" "cleanup" +mtu_head() +{ + atf_set descr 'Bridge MTU changes' + atf_set require.user root +} + +get_mtu() +{ + intf=$1 + + ifconfig ${intf} ether | awk '$5 == "mtu" { print $6 }' +} + +check_mtu() +{ + intf=$1 + expected=$2 + + mtu=$(get_mtu $intf) + if [ $mtu -ne $expected ]; + then + atf_fail "Expected MTU of $expected on $intf but found $mtu" + fi +} + +mtu_body() +{ + vnet_init + + epair=$(vnet_mkepair) + gif=$(ifconfig gif create) + echo ${gif} >> created_interfaces.lst + bridge=$(vnet_mkbridge) + + atf_check -s exit:0 \ + ifconfig ${bridge} addm ${epair}a + # Can't add an interface with an MTU mismatch + atf_check -s exit:1 -e ignore \ + ifconfig ${bridge} addm ${gif} + + ifconfig ${gif} mtu 1500 + atf_check -s exit:0 \ + ifconfig ${bridge} addm ${gif} + + # Changing MTU changes it for all member interfaces + atf_check -s exit:0 \ + ifconfig ${bridge} mtu 2000 + + check_mtu ${bridge} 2000 + check_mtu ${gif} 2000 + check_mtu ${epair}a 2000 + + # Rejected MTUs mean none of the MTUs change + atf_check -s exit:1 -e ignore \ + ifconfig ${bridge} mtu 9000 + + check_mtu ${bridge} 2000 + check_mtu ${gif} 2000 + check_mtu ${epair}a 2000 +} + +mtu_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" @@ -529,4 +596,5 @@ atf_init_test_cases() atf_add_test_case "mac_conflict" atf_add_test_case "stp_validation" atf_add_test_case "gif" + atf_add_test_case "mtu" }