From nobody Mon Jun 27 08:28:28 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5CEB387515E; Mon, 27 Jun 2022 08:28:29 +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 4LWgq11xz6z4g8q; Mon, 27 Jun 2022 08:28:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656318509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jKDNjg2las191eSbbSMLKkYEXxtfRPyVPZL4PQlXTCM=; b=kEPAbUdiIvB0EMJH6AhyxOlCjnt6xlUbcaC9pfkR5SuiRjKOugBw977JtvFoVmEdrAj8XI UXlyaNkl8AsF4b02BPAk90IEzMXdNnms3PHk776EupL/cB89yW688plmBRpfpPk3nUApkj 7JDOF4qggfjRzZvqMOglItSIC45983NRmKOHVAmaFqibOvfQRbZfRSUH4lkCnqkP1MZ4rw 4tK99Meww+uQVLA4gc4u1vPGyRgm/ScYoyoFjwlepROKC6hxQnVziFivBRhVr+CmmGNSE3 FQSS/ksn9rIGnU7QHDHFaTVjrG0CEH90Sl4BbA7pwVSI8eKq7A2WOUuLdmmWNw== 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 0302E24DA0; Mon, 27 Jun 2022 08:28:29 +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 25R8SSVP006916; Mon, 27 Jun 2022 08:28:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25R8SSEQ006915; Mon, 27 Jun 2022 08:28:28 GMT (envelope-from git) Date: Mon, 27 Jun 2022 08:28:28 GMT Message-Id: <202206270828.25R8SSEQ006915@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: 1865ebfb12dd - main - if_bridge: change MTU for new members List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 1865ebfb12ddaf3d0ff1458e6152b3cb1f1bdee8 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656318509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jKDNjg2las191eSbbSMLKkYEXxtfRPyVPZL4PQlXTCM=; b=UOiKvVTsUyKExghXxkMgJ+TF1LhMFkNsDfYq1N4R032vubagQtJUPVpWSppL0Ab5urRNR6 PkhXTDko//oOC69vtcO9kX413Y+c3aTWH8BjYMMsnxm8ARLDxcx70nqBbNWIzq8DkAaYkf ImT450yILaLk2cGW1793yDyAs0wa55SiGmCngoo1dYLx6WRQvc+rTxWf7BTdYSV3rcADbt 8Jj7QBVa2Mn9srYov++dYdhUtjQHsdynj+lVQkkubIrGw1SYnhMpYds8ZDZEisPB2yCrJH Muy2kZJe5+CFKHehtYh2rVgmjkLFPo4fzn/BhMoYEwxsxVZPbJul8+mQMmUXfw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656318509; a=rsa-sha256; cv=none; b=iR+x67h7p7uO3veDy9MKDUaE7HtmQipJYf4w0lSUe3nttrvL83VGLdoTYliqmsMRnU10DX fMkmoqfMZGhIZvjK0L4UVPUPoFSYDA9Wl0K8nawQLxcYRkAVeFsK2ZguEZetamp5i6039q Wc9GBxNZ0b/zrdqCfhfQ31Xi0wZWMfGOt1zNtm0OTaYCI9LpJumxfAXT5g3PI+u88KV6Hv 6fQDQ8QQ1FJ0i8UhbBvHYYRySxQyQ/D3bBtVv9Cz4xZFEsUbaryKXqaSBvTMIOzt7wk5A7 kTh9MsBi6T+o1gCyNd4PeACxdE1VHUQZ1t63UUOfvCFomw3fkI0UfOAqLnFEGw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1865ebfb12ddaf3d0ff1458e6152b3cb1f1bdee8 commit 1865ebfb12ddaf3d0ff1458e6152b3cb1f1bdee8 Author: Kristof Provost AuthorDate: 2022-06-25 11:39:44 +0000 Commit: Kristof Provost CommitDate: 2022-06-27 06:27:27 +0000 if_bridge: change MTU for new members Rather than reject new bridge members because they have the wrong MTU change it to match the bridge. If that fails, reject the new interface. PR: 264883 Different Revision: https://reviews.freebsd.org/D35597 --- sys/net/if_bridge.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index dd65188bcc4a..39085fa440e8 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1266,9 +1266,21 @@ bridge_ioctl_add(struct bridge_softc *sc, void *arg) if (CK_LIST_EMPTY(&sc->sc_iflist)) sc->sc_ifp->if_mtu = ifs->if_mtu; else if (sc->sc_ifp->if_mtu != ifs->if_mtu) { - if_printf(sc->sc_ifp, "invalid MTU: %u(%s) != %u\n", - ifs->if_mtu, ifs->if_xname, sc->sc_ifp->if_mtu); - return (EINVAL); + struct ifreq ifr; + + snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s", + ifs->if_xname); + ifr.ifr_mtu = sc->sc_ifp->if_mtu; + + error = (*ifs->if_ioctl)(ifs, + SIOCSIFMTU, (caddr_t)&ifr); + if (error != 0) { + log(LOG_NOTICE, "%s: invalid MTU: %u for" + " new member %s\n", sc->sc_ifp->if_xname, + ifr.ifr_mtu, + ifs->if_xname); + return (EINVAL); + } } bif = malloc(sizeof(*bif), M_DEVBUF, M_NOWAIT|M_ZERO);