From owner-dev-commits-src-main@freebsd.org Wed Jul 28 20:07:25 2021 Return-Path: Delivered-To: dev-commits-src-main@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 44A8B66424E; Wed, 28 Jul 2021 20:07:25 +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 4GZl7d11rtz3NhY; Wed, 28 Jul 2021 20:07:25 +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 051932440F; Wed, 28 Jul 2021 20:07:25 +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 16SK7OfC062485; Wed, 28 Jul 2021 20:07:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SK7ObH062484; Wed, 28 Jul 2021 20:07:24 GMT (envelope-from git) Date: Wed, 28 Jul 2021 20:07:24 GMT Message-Id: <202107282007.16SK7ObH062484@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: 33306493825b - main - if_bridge: allow MTU changes 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: 33306493825b291a308c0d37396e82de458f6cfe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jul 2021 20:07:25 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=33306493825b291a308c0d37396e82de458f6cfe commit 33306493825b291a308c0d37396e82de458f6cfe Author: Kristof Provost AuthorDate: 2021-07-23 15:22:18 +0000 Commit: Kristof Provost CommitDate: 2021-07-28 20:01:12 +0000 if_bridge: allow MTU changes if_bridge used to only allow MTU changes if the new MTU matched that of all member interfaces. This doesn't really make much sense, in that we really shouldn't be allowed to change the MTU of bridge member in the first place. Instead we now change the MTU of all member interfaces. If one fails we revert all interfaces back to the original MTU. We do not address the issue where bridge member interface MTUs can be changed here. Reviewed by: donner Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31288 --- sys/net/if_bridge.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 3e6b5ba8e0c2..adf1c9155ee1 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -917,6 +917,8 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case SIOCSIFMTU: + oldmtu = sc->sc_ifp->if_mtu; + if (ifr->ifr_mtu < 576) { error = EINVAL; break; @@ -926,17 +928,27 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; } CK_LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { - if (bif->bif_ifp->if_mtu != ifr->ifr_mtu) { - log(LOG_NOTICE, "%s: invalid MTU: %u(%s)" - " != %d\n", sc->sc_ifp->if_xname, - bif->bif_ifp->if_mtu, - bif->bif_ifp->if_xname, ifr->ifr_mtu); + error = (*bif->bif_ifp->if_ioctl)(bif->bif_ifp, + SIOCSIFMTU, (caddr_t)ifr); + if (error != 0) { + log(LOG_NOTICE, "%s: invalid MTU: %u for" + " member %s\n", sc->sc_ifp->if_xname, + ifr->ifr_mtu, + bif->bif_ifp->if_xname); error = EINVAL; break; } } - if (!error) + if (error) { + /* Restore the previous MTU on all member interfaces. */ + ifr->ifr_mtu = oldmtu; + CK_LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { + (*bif->bif_ifp->if_ioctl)(bif->bif_ifp, + SIOCSIFMTU, (caddr_t)ifr); + } + } else { sc->sc_ifp->if_mtu = ifr->ifr_mtu; + } break; default: /*