git: 1865ebfb12dd - main - if_bridge: change MTU for new members
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 27 Jun 2022 08:28:28 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=1865ebfb12ddaf3d0ff1458e6152b3cb1f1bdee8
commit 1865ebfb12ddaf3d0ff1458e6152b3cb1f1bdee8
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-06-25 11:39:44 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
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);