diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2005-07-07 21:28:11 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2005-07-07 21:28:11 +0000 |
commit | cc14e57b56cc8938c5a3aad6319c89aaa6593336 (patch) | |
tree | 035221173fe2e00ccb0efeb38f2395a705f4f287 | |
parent | c72f30b2467e073602a1ee4109d550af0cadecc0 (diff) |
check ETHERMIN and stop calling em_init_locked() from SIOCSIFMTU ioctl.
-rw-r--r-- | sys/dev/pci/if_bge.c | 5 | ||||
-rw-r--r-- | sys/dev/pci/if_em.c | 10 |
2 files changed, 7 insertions, 8 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index cc30ffd5077..8579b16b5ce 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bge.c,v 1.72 2005/07/06 00:56:33 brad Exp $ */ +/* $OpenBSD: if_bge.c,v 1.73 2005/07/07 21:28:10 brad Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -3297,7 +3297,8 @@ bge_ioctl(ifp, command, data) break; case SIOCSIFMTU: /* Disallow jumbo frames on 5705. */ - if ((((sc->bge_quirks & BGE_QUIRK_5705_CORE) != 0) && + if (ifr->ifr_mtu < ETHERMIN || + (((sc->bge_quirks & BGE_QUIRK_5705_CORE) != 0) && ifr->ifr_mtu > ETHERMTU) || ifr->ifr_mtu > ETHERMTU_JUMBO) error = EINVAL; else if (ifp->if_mtu != ifr->ifr_mtu) diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index 6cdcca8b567..d1909c6d550 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_em.c,v 1.62 2005/07/03 16:58:16 brad Exp $ */ +/* $OpenBSD: if_em.c,v 1.63 2005/07/07 21:28:10 brad Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include "bpfilter.h" @@ -550,15 +550,13 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; case SIOCSIFMTU: IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFMTU (Set Interface MTU)"); - if (ifr->ifr_mtu > MAX_JUMBO_FRAME_SIZE - ETHER_HDR_LEN || \ + if (ifr->ifr_mtu < ETHERMIN || + ifr->ifr_mtu > MAX_JUMBO_FRAME_SIZE - ETHER_HDR_LEN || \ /* 82573 does not support Jumbo frames */ (sc->hw.mac_type == em_82573 && ifr->ifr_mtu > ETHERMTU)) { error = EINVAL; - } else { - EM_LOCK(sc); + } else if (ifp->if_mtu != ifr->ifr_mtu) { ifp->if_mtu = ifr->ifr_mtu; - em_init_locked(sc); - EM_UNLOCK(sc); } break; case SIOCSIFFLAGS: |