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
This commit is contained in:
parent
dbdf2b52f5
commit
3330649382
@ -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:
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user