From 7da313a2f65e39b86488c21555c356ca3a9100e5 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Fri, 28 Nov 2008 02:44:19 +0000 Subject: Eliminate the redundant bits of code for MTU and multicast handling from the individual drivers now that ether_ioctl() handles this. Shrinks the i386 kernels by.. RAMDISK - 2176 bytes RAMDISKB - 1504 bytes RAMDISKC - 736 bytes Tested by naddy@/okan@/sthen@/brad@/todd@/jmc@ and lots of users. Build tested on almost all archs by todd@/brad@ ok naddy@ --- sys/arch/mac68k/dev/if_mc.c | 29 ++++++++--------------------- sys/arch/mac68k/dev/if_sn.c | 30 ++++++++---------------------- sys/arch/macppc/dev/if_bm.c | 29 +++++++++-------------------- sys/arch/macppc/dev/if_mc.c | 26 +++++++------------------- sys/arch/mvme68k/dev/if_ie.c | 26 +++++++------------------- sys/arch/mvme88k/dev/if_ie.c | 26 +++++++------------------- sys/arch/sgi/dev/if_mec.c | 31 +++++++------------------------ sys/arch/socppc/dev/if_tsec.c | 28 +++++++--------------------- sys/arch/sparc/dev/be.c | 25 ++++++++----------------- sys/arch/sparc/dev/hme.c | 25 ++++++++----------------- sys/arch/sparc/dev/if_ie.c | 26 +++++++------------------- sys/arch/sparc/dev/qe.c | 25 ++++++++----------------- sys/arch/vax/bi/if_ni.c | 29 +++++++---------------------- sys/arch/vax/if/if_qe.c | 28 +++++++--------------------- sys/arch/vax/if/sgec.c | 33 +++++++++------------------------ sys/dev/ic/aic6915.c | 29 +++++++---------------------- sys/dev/ic/am7990.c | 25 +++++++------------------ sys/dev/ic/atw.c | 12 ++++-------- sys/dev/ic/dc.c | 31 +++++++------------------------ sys/dev/ic/dp8390.c | 43 +++++++++---------------------------------- sys/dev/ic/elink3.c | 33 +++++++-------------------------- sys/dev/ic/fxp.c | 31 +++++++------------------------ sys/dev/ic/gem.c | 33 +++++++-------------------------- sys/dev/ic/hme.c | 25 +++++++------------------ sys/dev/ic/i82596.c | 25 +++++++------------------ sys/dev/ic/if_wi.c | 36 ++++++++---------------------------- sys/dev/ic/lemac.c | 39 +++++++++------------------------------ sys/dev/ic/mtd8xx.c | 31 ++++++++----------------------- sys/dev/ic/re.c | 29 +++++++---------------------- sys/dev/ic/rtl81x9.c | 33 ++++++++------------------------- sys/dev/ic/rtw.c | 17 +++++++---------- sys/dev/ic/smc83c170.c | 38 ++++++++++---------------------------- sys/dev/ic/smc91cxx.c | 29 +++++++---------------------- sys/dev/ic/xl.c | 39 +++++++++++---------------------------- sys/dev/isa/if_ef_isapnp.c | 23 +++++++++-------------- sys/dev/isa/if_ex.c | 29 ++++++++--------------------- sys/dev/isa/if_ie.c | 26 +++++++------------------- sys/dev/pci/if_bce.c | 33 ++++++++++----------------------- sys/dev/pci/if_bge.c | 29 ++++++++++------------------- sys/dev/pci/if_bnx.c | 30 ++++++++---------------------- sys/dev/pci/if_cas.c | 33 +++++++-------------------------- sys/dev/pci/if_de.c | 36 +++++++----------------------------- sys/dev/pci/if_em.c | 41 +++++++++++++++-------------------------- sys/dev/pci/if_et.c | 29 ++++++++++------------------- sys/dev/pci/if_ix.c | 39 ++++++++++++++++++--------------------- sys/dev/pci/if_ixgb.c | 43 ++++++++++++++++--------------------------- sys/dev/pci/if_lge.c | 33 +++++++++++---------------------- sys/dev/pci/if_lii.c | 14 ++++---------- sys/dev/pci/if_msk.c | 35 +++++++++++------------------------ sys/dev/pci/if_myx.c | 18 ++---------------- sys/dev/pci/if_nfe.c | 29 ++++++++++------------------- sys/dev/pci/if_nge.c | 29 ++++++++++------------------- sys/dev/pci/if_nxe.c | 16 ++++------------ sys/dev/pci/if_pcn.c | 36 +++++++++--------------------------- sys/dev/pci/if_sis.c | 35 +++++++++++------------------------ sys/dev/pci/if_sk.c | 33 ++++++++++----------------------- sys/dev/pci/if_ste.c | 27 ++++++++++----------------- sys/dev/pci/if_stge.c | 34 ++++++++-------------------------- sys/dev/pci/if_tht.c | 26 +++++--------------------- sys/dev/pci/if_ti.c | 29 ++++++++++------------------- sys/dev/pci/if_tl.c | 28 +++++++++++----------------- sys/dev/pci/if_txp.c | 29 +++++++++++------------------ sys/dev/pci/if_vge.c | 29 ++++++++++------------------- sys/dev/pci/if_vic.c | 31 ++++--------------------------- sys/dev/pci/if_vr.c | 35 +++++++++++------------------------ sys/dev/pci/if_wb.c | 29 +++++++++++------------------ sys/dev/pci/if_xge.c | 31 +++++++++++-------------------- sys/dev/pcmcia/if_ray.c | 24 +++++++----------------- sys/dev/sbus/be.c | 25 ++++++++----------------- sys/dev/sbus/qe.c | 25 +++++++------------------ sys/dev/usb/if_aue.c | 27 ++++++++------------------- sys/dev/usb/if_axe.c | 32 ++++++++------------------------ sys/dev/usb/if_cdce.c | 23 ++++------------------- sys/dev/usb/if_cdcef.c | 22 ++++------------------ sys/dev/usb/if_cue.c | 33 ++++++++------------------------- sys/dev/usb/if_kue.c | 33 ++++++++------------------------- sys/dev/usb/if_udav.c | 26 ++++++++------------------ sys/dev/usb/if_url.c | 27 ++++++++------------------- sys/net/if_trunk.c | 9 +-------- 79 files changed, 646 insertions(+), 1651 deletions(-) diff --git a/sys/arch/mac68k/dev/if_mc.c b/sys/arch/mac68k/dev/if_mc.c index 033410c5e89..c3c0ee17ef1 100644 --- a/sys/arch/mac68k/dev/if_mc.c +++ b/sys/arch/mac68k/dev/if_mc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mc.c,v 1.18 2008/10/08 23:53:08 brad Exp $ */ +/* $OpenBSD: if_mc.c,v 1.19 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: if_mc.c,v 1.24 2004/10/30 18:08:34 thorpej Exp $ */ /*- @@ -176,15 +176,13 @@ mcioctl(ifp, cmd, data) caddr_t data; { struct mc_softc *sc = ifp->if_softc; - struct ifaddr *ifa; - struct ifreq *ifr; + struct ifaddr *ifa = (struct ifaddr *) data; int s, err = 0; s = splnet(); switch (cmd) { case SIOCSIFADDR: - ifa = (struct ifaddr *)data; ifp->if_flags |= IFF_UP; switch (ifa->ifa_addr->sa_family) { #ifdef INET @@ -225,27 +223,16 @@ mcioctl(ifp, cmd, data) } break; - case SIOCADDMULTI: - case SIOCDELMULTI: - ifr = (struct ifreq *) data; - err = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_ethercom) : - ether_delmulti(ifr, &sc->sc_ethercom); - - if (err == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. But remember UP flag! - */ - if (ifp->if_flags & IFF_RUNNING) - mcreset(sc); - err = 0; - } - break; default: err = ether_ioctl(ifp, &sc->sc_ethercom, cmd, data); } + if (err == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + mcreset(sc); + err = 0; + } + splx(s); return (err); } diff --git a/sys/arch/mac68k/dev/if_sn.c b/sys/arch/mac68k/dev/if_sn.c index 97bf9bdf259..537eca51026 100644 --- a/sys/arch/mac68k/dev/if_sn.c +++ b/sys/arch/mac68k/dev/if_sn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sn.c,v 1.49 2008/10/08 23:53:08 brad Exp $ */ +/* $OpenBSD: if_sn.c,v 1.50 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: if_sn.c,v 1.13 1997/04/25 03:40:10 briggs Exp $ */ /* @@ -251,16 +251,14 @@ snsetup(struct sn_softc *sc, u_int8_t *lladdr) static int snioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { - struct ifaddr *ifa; - struct ifreq *ifr; struct sn_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; int s, err = 0; s = splnet(); switch (cmd) { case SIOCSIFADDR: - ifa = (struct ifaddr *)data; ifp->if_flags |= IFF_UP; switch (ifa->ifa_addr->sa_family) { #ifdef INET @@ -301,28 +299,16 @@ snioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; - case SIOCADDMULTI: - case SIOCDELMULTI: - ifr = (struct ifreq *) data; - if (cmd == SIOCADDMULTI) - err = ether_addmulti(ifr, &sc->sc_arpcom); - else - err = ether_delmulti(ifr, &sc->sc_arpcom); - - if (err == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. But remember UP flag! - */ - if (ifp->if_flags & IFF_RUNNING) - snreset(sc); - err = 0; - } - break; default: err = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (err == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + snreset(sc); + err = 0; + } + splx(s); return (err); } diff --git a/sys/arch/macppc/dev/if_bm.c b/sys/arch/macppc/dev/if_bm.c index d47a3251c0d..26471c4e44c 100644 --- a/sys/arch/macppc/dev/if_bm.c +++ b/sys/arch/macppc/dev/if_bm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bm.c,v 1.24 2008/10/15 19:12:19 blambert Exp $ */ +/* $OpenBSD: if_bm.c,v 1.25 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: if_bm.c,v 1.1 1999/01/01 01:27:52 tsubai Exp $ */ /*- @@ -801,25 +801,6 @@ bmac_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) #endif break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) { - bmac_init(sc); - bmac_setladrf(sc); - } - error = 0; - } - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); @@ -829,6 +810,14 @@ bmac_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ether_ioctl(ifp, &sc->arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) { + bmac_init(sc); + bmac_setladrf(sc); + } + error = 0; + } + splx(s); return (error); } diff --git a/sys/arch/macppc/dev/if_mc.c b/sys/arch/macppc/dev/if_mc.c index e2a6e928655..2f24b75bda5 100644 --- a/sys/arch/macppc/dev/if_mc.c +++ b/sys/arch/macppc/dev/if_mc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mc.c,v 1.12 2008/10/08 23:53:08 brad Exp $ */ +/* $OpenBSD: if_mc.c,v 1.13 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: if_mc.c,v 1.9.16.1 2006/06/21 14:53:13 yamt Exp $ */ /*- @@ -496,7 +496,6 @@ mc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct mc_softc *sc = ifp->if_softc; struct ifaddr *ifa = (struct ifaddr *)data; - struct ifreq *ifr; int s, err = 0; s = splnet(); @@ -537,27 +536,16 @@ mc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; - case SIOCADDMULTI: - case SIOCDELMULTI: - ifr = (struct ifreq *) data; - err = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (err == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. But remember UP flag! - */ - if (ifp->if_flags & IFF_RUNNING) - mc_reset(sc); - err = 0; - } - break; default: err = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (err == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + mc_reset(sc); + err = 0; + } + splx(s); return (err); } diff --git a/sys/arch/mvme68k/dev/if_ie.c b/sys/arch/mvme68k/dev/if_ie.c index 6ae74e8b4b7..58c03318fa4 100644 --- a/sys/arch/mvme68k/dev/if_ie.c +++ b/sys/arch/mvme68k/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.36 2008/10/02 20:21:13 brad Exp $ */ +/* $OpenBSD: if_ie.c,v 1.37 2008/11/28 02:44:17 brad Exp $ */ /*- * Copyright (c) 1999 Steve Murphree, Jr. @@ -1806,7 +1806,6 @@ ieioctl(ifp, cmd, data) { struct ie_softc *sc = ifp->if_softc; struct ifaddr *ifa = (struct ifaddr *)data; - struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; s = splnet(); @@ -1861,27 +1860,16 @@ ieioctl(ifp, cmd, data) #endif break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom): - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - mc_reset(sc); - error = 0; - } - break; - default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + mc_reset(sc); + error = 0; + } + splx(s); return error; } diff --git a/sys/arch/mvme88k/dev/if_ie.c b/sys/arch/mvme88k/dev/if_ie.c index fc20ea22c19..1db59f68422 100644 --- a/sys/arch/mvme88k/dev/if_ie.c +++ b/sys/arch/mvme88k/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.42 2008/10/02 20:21:13 brad Exp $ */ +/* $OpenBSD: if_ie.c,v 1.43 2008/11/28 02:44:17 brad Exp $ */ /*- * Copyright (c) 1998 Steve Murphree, Jr. @@ -1789,7 +1789,6 @@ ieioctl(ifp, cmd, data) { struct ie_softc *sc = ifp->if_softc; struct ifaddr *ifa = (struct ifaddr *)data; - struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; s = splnet(); @@ -1844,27 +1843,16 @@ ieioctl(ifp, cmd, data) #endif break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom): - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - mc_reset(sc); - error = 0; - } - break; - default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + mc_reset(sc); + error = 0; + } + splx(s); return error; } diff --git a/sys/arch/sgi/dev/if_mec.c b/sys/arch/sgi/dev/if_mec.c index f973bf09cb9..450bf0f6c02 100644 --- a/sys/arch/sgi/dev/if_mec.c +++ b/sys/arch/sgi/dev/if_mec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mec.c,v 1.17 2008/10/15 19:12:19 blambert Exp $ */ +/* $OpenBSD: if_mec.c,v 1.18 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: if_mec_mace.c,v 1.5 2004/08/01 06:36:36 tsutsui Exp $ */ /* @@ -1060,12 +1060,6 @@ mec_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; case SIOCSIFFLAGS: /* @@ -1080,23 +1074,6 @@ mec_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) mec_stop(ifp); break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_ac) : - ether_delmulti(ifr, &sc->sc_ac); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - mec_init(ifp); - error = 0; - } - break; - case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); @@ -1106,6 +1083,12 @@ mec_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ether_ioctl(ifp, &sc->sc_ac, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + mec_init(ifp); + error = 0; + } + splx(s); return error; } diff --git a/sys/arch/socppc/dev/if_tsec.c b/sys/arch/socppc/dev/if_tsec.c index 6ac28f5fd99..67ec14712b9 100644 --- a/sys/arch/socppc/dev/if_tsec.c +++ b/sys/arch/socppc/dev/if_tsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tsec.c,v 1.13 2008/10/15 19:12:19 blambert Exp $ */ +/* $OpenBSD: if_tsec.c,v 1.14 2008/11/28 02:44:17 brad Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -480,26 +480,6 @@ tsec_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_ac) : - ether_delmulti(ifr, &sc->sc_ac); - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - tsec_iff(sc); - error = 0; - } - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); @@ -510,6 +490,12 @@ tsec_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) break; } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + tsec_iff(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/arch/sparc/dev/be.c b/sys/arch/sparc/dev/be.c index ed47a39d63a..cbdc6652e55 100644 --- a/sys/arch/sparc/dev/be.c +++ b/sys/arch/sparc/dev/be.c @@ -1,4 +1,4 @@ -/* $OpenBSD: be.c,v 1.42 2008/10/15 19:12:19 blambert Exp $ */ +/* $OpenBSD: be.c,v 1.43 2008/11/28 02:44:17 brad Exp $ */ /* * Copyright (c) 1998 Theo de Raadt and Jason L. Wright. @@ -615,30 +615,21 @@ beioctl(ifp, cmd, data) } break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom): - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - be_mcreset(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_ifmedia, cmd); break; + default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + be_mcreset(sc); + error = 0; + } + splx(s); return error; } diff --git a/sys/arch/sparc/dev/hme.c b/sys/arch/sparc/dev/hme.c index ef974a765cd..d67279ce6ef 100644 --- a/sys/arch/sparc/dev/hme.c +++ b/sys/arch/sparc/dev/hme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hme.c,v 1.57 2008/10/14 18:01:53 naddy Exp $ */ +/* $OpenBSD: hme.c,v 1.58 2008/11/28 02:44:17 brad Exp $ */ /* * Copyright (c) 1998 Jason L. Wright (jason@thought.net) @@ -440,30 +440,21 @@ hmeioctl(ifp, cmd, data) } break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom): - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - hme_mcreset(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); break; + default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + hme_mcreset(sc); + error = 0; + } + sc->sc_if_flags = ifp->if_flags; splx(s); return (error); diff --git a/sys/arch/sparc/dev/if_ie.c b/sys/arch/sparc/dev/if_ie.c index b26ae16859d..216ead5c32c 100644 --- a/sys/arch/sparc/dev/if_ie.c +++ b/sys/arch/sparc/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.38 2008/10/02 20:21:13 brad Exp $ */ +/* $OpenBSD: if_ie.c,v 1.39 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: if_ie.c,v 1.33 1997/07/29 17:55:38 fair Exp $ */ /*- @@ -1948,7 +1948,6 @@ ieioctl(ifp, cmd, data) { struct ie_softc *sc = ifp->if_softc; struct ifaddr *ifa = (struct ifaddr *)data; - struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; s = splnet(); @@ -2003,27 +2002,16 @@ ieioctl(ifp, cmd, data) #endif break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom): - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - mc_reset(sc); - error = 0; - } - break; - default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + mc_reset(sc); + error = 0; + } + splx(s); return error; } diff --git a/sys/arch/sparc/dev/qe.c b/sys/arch/sparc/dev/qe.c index 360ee17842a..44f5bfa8d3b 100644 --- a/sys/arch/sparc/dev/qe.c +++ b/sys/arch/sparc/dev/qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qe.c,v 1.31 2008/10/02 20:21:13 brad Exp $ */ +/* $OpenBSD: qe.c,v 1.32 2008/11/28 02:44:17 brad Exp $ */ /* * Copyright (c) 1998, 2000 Jason L. Wright. @@ -634,30 +634,21 @@ qeioctl(ifp, cmd, data) } break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom): - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - qeinit(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_ifmedia, cmd); break; + default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + qeinit(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/arch/vax/bi/if_ni.c b/sys/arch/vax/bi/if_ni.c index 8fe236275df..2813aed66b1 100644 --- a/sys/arch/vax/bi/if_ni.c +++ b/sys/arch/vax/bi/if_ni.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ni.c,v 1.12 2008/10/08 23:53:08 brad Exp $ */ +/* $OpenBSD: if_ni.c,v 1.13 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: if_ni.c,v 1.15 2002/05/22 16:03:14 wiz Exp $ */ /* * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved. @@ -695,7 +695,6 @@ niioctl(ifp, cmd, data) caddr_t data; { struct ni_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; int s, error = 0; @@ -739,30 +738,16 @@ niioctl(ifp, cmd, data) } break; - case SIOCADDMULTI: - case SIOCDELMULTI: - /* - * Update our multicast list. - */ - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_ec): - ether_delmulti(ifr, &sc->sc_ec); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - ni_setup(sc); - error = 0; - } - break; - default: error = ether_ioctl(ifp, &sc->sc_ec, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + ni_setup(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/arch/vax/if/if_qe.c b/sys/arch/vax/if/if_qe.c index 736db37ff29..dfd60210414 100644 --- a/sys/arch/vax/if/if_qe.c +++ b/sys/arch/vax/if/if_qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_qe.c,v 1.23 2008/10/08 23:53:08 brad Exp $ */ +/* $OpenBSD: if_qe.c,v 1.24 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: if_qe.c,v 1.51 2002/06/08 12:28:37 ragge Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. @@ -631,7 +631,6 @@ int qeioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct qe_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; int s, error = 0; @@ -676,29 +675,16 @@ qeioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; - case SIOCADDMULTI: - case SIOCDELMULTI: - /* - * Update our multicast list. - */ - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_ac): - ether_delmulti(ifr, &sc->sc_ac); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - qe_setup(sc); - error = 0; - } - break; - default: error = ether_ioctl(ifp, &sc->sc_ac, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + qe_setup(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/arch/vax/if/sgec.c b/sys/arch/vax/if/sgec.c index 2f827913e64..db60b04e24f 100644 --- a/sys/arch/vax/if/sgec.c +++ b/sys/arch/vax/if/sgec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sgec.c,v 1.18 2008/10/09 00:17:54 brad Exp $ */ +/* $OpenBSD: sgec.c,v 1.19 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: sgec.c,v 1.5 2000/06/04 02:14:14 matt Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. @@ -625,8 +625,8 @@ zeioctl(ifp, cmd, data) caddr_t data; { struct ze_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; + struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; s = splnet(); @@ -646,8 +646,7 @@ zeioctl(ifp, cmd, data) case SIOCSIFMEDIA: case SIOCGIFMEDIA: - error = ifmedia_ioctl(ifp, (struct ifreq *)data, - &sc->sc_ifmedia, cmd); + error = ifmedia_ioctl(ifp, ifr, &sc->sc_ifmedia, cmd); break; case SIOCSIFFLAGS: @@ -676,30 +675,16 @@ zeioctl(ifp, cmd, data) } break; - case SIOCADDMULTI: - case SIOCDELMULTI: - /* - * Update our multicast list. - */ - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_ac): - ether_delmulti(ifr, &sc->sc_ac); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - ze_setup(sc); - error = 0; - } - break; - default: error = ether_ioctl(ifp, &sc->sc_ac, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + ze_setup(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/ic/aic6915.c b/sys/dev/ic/aic6915.c index 24253a42ded..4f92d0a389f 100644 --- a/sys/dev/ic/aic6915.c +++ b/sys/dev/ic/aic6915.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic6915.c,v 1.7 2008/10/02 20:21:13 brad Exp $ */ +/* $OpenBSD: aic6915.c,v 1.8 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: aic6915.c,v 1.15 2005/12/24 20:27:29 perry Exp $ */ /*- @@ -571,27 +571,6 @@ sf_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) sc->sc_flags = ifp->if_flags; break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - - case SIOCADDMULTI: - case SIOCDELMULTI: - ifr = (struct ifreq *)data; - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - sf_set_filter(sc); - error = 0; - } - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); @@ -601,6 +580,12 @@ sf_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + sf_set_filter(sc); + error = 0; + } + /* Try to get more packets going. */ sf_start(ifp); diff --git a/sys/dev/ic/am7990.c b/sys/dev/ic/am7990.c index 46e48aa7507..1a05b1a69e0 100644 --- a/sys/dev/ic/am7990.c +++ b/sys/dev/ic/am7990.c @@ -1,4 +1,4 @@ -/* $OpenBSD: am7990.c,v 1.42 2008/10/02 20:21:13 brad Exp $ */ +/* $OpenBSD: am7990.c,v 1.43 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: am7990.c,v 1.22 1996/10/13 01:37:19 christos Exp $ */ /*- @@ -892,23 +892,6 @@ am7990_ioctl(ifp, cmd, data) #endif break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - am7990_reset(sc); - error = 0; - } - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: if (sc->sc_hasifmedia) @@ -921,6 +904,12 @@ am7990_ioctl(ifp, cmd, data) error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + am7990_reset(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c index f701bbc7083..f1c2e55458b 100644 --- a/sys/dev/ic/atw.c +++ b/sys/dev/ic/atw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atw.c,v 1.63 2008/10/03 00:58:39 brad Exp $ */ +/* $OpenBSD: atw.c,v 1.64 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: atw.c,v 1.69 2004/07/23 07:07:55 dyoung Exp $ */ /*- @@ -4041,13 +4041,6 @@ atw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) s = splnet(); switch (cmd) { - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) { - error = EINVAL; - } else if (ifp->if_mtu != ifr->ifr_mtu) { - ifp->if_mtu = ifr->ifr_mtu; - } - break; case SIOCSIFADDR: ifp->if_flags |= IFF_UP; #ifdef INET @@ -4056,6 +4049,7 @@ atw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } #endif /* INET */ /* FALLTHROUGH */ + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ATW_IS_ENABLED(sc)) { @@ -4070,6 +4064,7 @@ atw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } else if (ATW_IS_ENABLED(sc)) atw_stop(ifp, 1); break; + case SIOCADDMULTI: case SIOCDELMULTI: error = (cmd == SIOCADDMULTI) ? @@ -4082,6 +4077,7 @@ atw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = 0; } break; + default: error = ieee80211_ioctl(ifp, cmd, data); if (error == ENETRESET) { diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c index b78b6630110..61ab4a56285 100644 --- a/sys/dev/ic/dc.c +++ b/sys/dev/ic/dc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dc.c,v 1.106 2008/10/15 19:12:19 blambert Exp $ */ +/* $OpenBSD: dc.c,v 1.107 2008/11/28 02:44:17 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -3000,29 +3000,6 @@ dc_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->dc_if_flags = ifp->if_flags; break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) { - error = EINVAL; - } else if (ifp->if_mtu != ifr->ifr_mtu) { - ifp->if_mtu = ifr->ifr_mtu; - } - break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - dc_setfilt(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: mii = &sc->sc_mii; @@ -3036,6 +3013,12 @@ dc_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = ether_ioctl(ifp, &sc->sc_arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + dc_setfilt(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/ic/dp8390.c b/sys/dev/ic/dp8390.c index 2e20582a1d1..4c09d988ef2 100644 --- a/sys/dev/ic/dp8390.c +++ b/sys/dev/ic/dp8390.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dp8390.c,v 1.40 2008/10/03 20:25:29 brad Exp $ */ +/* $OpenBSD: dp8390.c,v 1.41 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: dp8390.c,v 1.13 1998/07/05 06:49:11 jonathan Exp $ */ /* @@ -839,14 +839,6 @@ dp8390_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) { - error = EINVAL; - } else if (ifp->if_mtu != ifr->ifr_mtu) { - ifp->if_mtu = ifr->ifr_mtu; - } - break; - case SIOCSIFFLAGS: if ((ifp->if_flags & IFF_UP) == 0 && (ifp->if_flags & IFF_RUNNING) != 0) { @@ -876,31 +868,6 @@ dp8390_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; - case SIOCADDMULTI: - case SIOCDELMULTI: - if (sc->sc_enabled == 0) { - error = EIO; - break; - } - - /* Update our multicast list. */ - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) { - dp8390_stop(sc); /* XXX for ds_setmcaf? */ - dp8390_init(sc); - } - error = 0; - } - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); @@ -910,6 +877,14 @@ dp8390_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) { + dp8390_stop(sc); /* XXX for ds_setmcaf? */ + dp8390_init(sc); + } + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/ic/elink3.c b/sys/dev/ic/elink3.c index e3a3298ac4b..8c03c85cd82 100644 --- a/sys/dev/ic/elink3.c +++ b/sys/dev/ic/elink3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: elink3.c,v 1.72 2008/10/02 20:21:13 brad Exp $ */ +/* $OpenBSD: elink3.c,v 1.73 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: elink3.c,v 1.32 1997/05/14 00:22:00 thorpej Exp $ */ /* @@ -1499,14 +1499,6 @@ epioctl(ifp, cmd, data) error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) { - error = EINVAL; - } else if (ifp->if_mtu != ifr->ifr_mtu) { - ifp->if_mtu = ifr->ifr_mtu; - } - break; - case SIOCSIFFLAGS: if ((ifp->if_flags & IFF_UP) == 0 && (ifp->if_flags & IFF_RUNNING) != 0) { @@ -1532,27 +1524,16 @@ epioctl(ifp, cmd, data) } break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - epreset(sc); - error = 0; - } - break; - default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + epreset(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/ic/fxp.c b/sys/dev/ic/fxp.c index a1c06209a9a..e60ebab5b49 100644 --- a/sys/dev/ic/fxp.c +++ b/sys/dev/ic/fxp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fxp.c,v 1.93 2008/10/02 20:21:13 brad Exp $ */ +/* $OpenBSD: fxp.c,v 1.94 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: if_fxp.c,v 1.2 1997/06/05 02:01:55 thorpej Exp $ */ /* @@ -1644,13 +1644,6 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data) #endif break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCSIFFLAGS: /* * If interface is marked up and not running, then start it. @@ -1664,22 +1657,6 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data) fxp_stop(sc, 1); break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - fxp_init(sc); - error = 0; - } - break; - case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, command); @@ -1689,6 +1666,12 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = ether_ioctl(ifp, &sc->sc_arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + fxp_init(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c index 5870dc3726e..81103d3e172 100644 --- a/sys/dev/ic/gem.c +++ b/sys/dev/ic/gem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gem.c,v 1.83 2008/11/26 18:34:31 kettenis Exp $ */ +/* $OpenBSD: gem.c,v 1.84 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: gem.c,v 1.1 2001/09/16 00:11:43 eeh Exp $ */ /* @@ -1463,31 +1463,6 @@ gem_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) #endif break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) { - error = EINVAL; - } else if (ifp->if_mtu != ifr->ifr_mtu) { - ifp->if_mtu = ifr->ifr_mtu; - } - break; - - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - gem_setladrf(sc); - error = 0; - } - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); @@ -1497,6 +1472,12 @@ gem_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + gem_setladrf(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c index ea3127d02e3..a479132ca19 100644 --- a/sys/dev/ic/hme.c +++ b/sys/dev/ic/hme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hme.c,v 1.52 2008/11/26 13:30:29 kettenis Exp $ */ +/* $OpenBSD: hme.c,v 1.53 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: hme.c,v 1.21 2001/07/07 15:59:37 thorpej Exp $ */ /*- @@ -1328,23 +1328,6 @@ hme_ioctl(ifp, cmd, data) #endif break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - hme_setladrf(sc); - error = 0; - } - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); @@ -1354,6 +1337,12 @@ hme_ioctl(ifp, cmd, data) error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + hme_setladrf(sc); + error = 0; + } + sc->sc_if_flags = ifp->if_flags; splx(s); return (error); diff --git a/sys/dev/ic/i82596.c b/sys/dev/ic/i82596.c index ef7d86432c2..29e4a07d01e 100644 --- a/sys/dev/ic/i82596.c +++ b/sys/dev/ic/i82596.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i82596.c,v 1.31 2008/10/03 00:19:55 brad Exp $ */ +/* $OpenBSD: i82596.c,v 1.32 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: i82586.c,v 1.18 1998/08/15 04:42:42 mycroft Exp $ */ /*- @@ -1920,23 +1920,6 @@ i82596_ioctl(ifp, cmd, data) #endif break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom): - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - ie_mc_reset(sc); - error = 0; - } - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); @@ -1946,6 +1929,12 @@ i82596_ioctl(ifp, cmd, data) error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + ie_mc_reset(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c index 5712a0c9cc0..24e2f5f2b2b 100644 --- a/sys/dev/ic/if_wi.c +++ b/sys/dev/ic/if_wi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi.c,v 1.142 2008/10/15 19:12:19 blambert Exp $ */ +/* $OpenBSD: if_wi.c,v 1.143 2008/11/28 02:44:17 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -126,7 +126,7 @@ u_int32_t widebug = WIDEBUG; #if !defined(lint) && !defined(__OpenBSD__) static const char rcsid[] = - "$OpenBSD: if_wi.c,v 1.142 2008/10/15 19:12:19 blambert Exp $"; + "$OpenBSD: if_wi.c,v 1.143 2008/11/28 02:44:17 brad Exp $"; #endif /* lint */ #ifdef foo @@ -1589,15 +1589,6 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; } break; - - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) { - error = EINVAL; - } else if (ifp->if_mtu != ifr->ifr_mtu) { - ifp->if_mtu = ifr->ifr_mtu; - } - break; - case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1617,23 +1608,6 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) sc->wi_if_flags = ifp->if_flags; error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - /* Update our multicast list. */ - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_ic.ic_ac) : - ether_delmulti(ifr, &sc->sc_ic.ic_ac); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - wi_setmulti(sc); - error = 0; - } - break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, command); @@ -2051,6 +2025,12 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = ether_ioctl(ifp, &sc->sc_ic.ic_ac, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + wi_setmulti(sc); + error = 0; + } + if (wreq) free(wreq, M_DEVBUF); if (nwidp) diff --git a/sys/dev/ic/lemac.c b/sys/dev/ic/lemac.c index 464ce3690c2..eec61e082cb 100644 --- a/sys/dev/ic/lemac.c +++ b/sys/dev/ic/lemac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lemac.c,v 1.11 2008/10/02 20:21:13 brad Exp $ */ +/* $OpenBSD: lemac.c,v 1.12 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: lemac.c,v 1.20 2001/06/13 10:46:02 wiz Exp $ */ /*- @@ -792,10 +792,9 @@ int lemac_ifioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct lemac_softc *const sc = LEMAC_IFP_TO_SOFTC(ifp); - int s; - int error = 0; struct ifaddr *ifa = (struct ifaddr *)data; struct ifreq *ifr = (struct ifreq *)data; + int s, error = 0; s = splnet(); @@ -819,41 +818,21 @@ lemac_ifioctl(struct ifnet *ifp, u_long cmd, caddr_t data) lemac_init(sc); break; - case SIOCADDMULTI: - case SIOCDELMULTI: - /* - * Update multicast listeners - */ - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* Reset multicast filtering. */ - if (ifp->if_flags & IFF_RUNNING) - lemac_init(sc); - error = 0; - } - break; - case SIOCSIFMEDIA: case SIOCGIFMEDIA: - error = ifmedia_ioctl(ifp, (struct ifreq *)data, - &sc->sc_ifmedia, cmd); - break; - - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) { - error = EINVAL; - } else if (ifp->if_mtu != ifr->ifr_mtu) { - ifp->if_mtu = ifr->ifr_mtu; - } + error = ifmedia_ioctl(ifp, ifr, &sc->sc_ifmedia, cmd); break; default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + lemac_init(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/ic/mtd8xx.c b/sys/dev/ic/mtd8xx.c index 3fa3f8daa8b..f3c08baeecc 100644 --- a/sys/dev/ic/mtd8xx.c +++ b/sys/dev/ic/mtd8xx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mtd8xx.c,v 1.15 2008/10/14 18:01:53 naddy Exp $ */ +/* $OpenBSD: mtd8xx.c,v 1.16 2008/11/28 02:44:17 brad Exp $ */ /* * Copyright (c) 2003 Oleg Safiullin @@ -578,8 +578,8 @@ static int mtd_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct mtd_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; + struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; s = splnet(); @@ -596,12 +596,6 @@ mtd_ioctl(struct ifnet *ifp, u_long command, caddr_t data) #endif /* INET */ } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu >= ETHERMIN && ifr->ifr_mtu <= ETHERMTU) - ifp->if_mtu = ifr->ifr_mtu; - else - error = EINVAL; - break; case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) @@ -612,22 +606,7 @@ mtd_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - mtd_setmulti(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, command); @@ -636,6 +615,12 @@ mtd_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = ether_ioctl(ifp, &sc->sc_arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + mtd_setmulti(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c index 8e3d80663f9..bad424cda22 100644 --- a/sys/dev/ic/re.c +++ b/sys/dev/ic/re.c @@ -1,4 +1,4 @@ -/* $OpenBSD: re.c,v 1.101 2008/11/17 01:25:31 brad Exp $ */ +/* $OpenBSD: re.c,v 1.102 2008/11/28 02:44:17 brad Exp $ */ /* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */ /* * Copyright (c) 1997, 1998-2003 @@ -2108,12 +2108,6 @@ re_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc->sc_arpcom, ifa); #endif /* INET */ break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING) @@ -2126,21 +2120,6 @@ re_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - re_iff(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, command); @@ -2149,6 +2128,12 @@ re_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = ether_ioctl(ifp, &sc->sc_arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + re_iff(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c index 3a0256f699e..3bcea2a035e 100644 --- a/sys/dev/ic/rtl81x9.c +++ b/sys/dev/ic/rtl81x9.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtl81x9.c,v 1.61 2008/10/14 18:01:53 naddy Exp $ */ +/* $OpenBSD: rtl81x9.c,v 1.62 2008/11/28 02:44:17 brad Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1083,7 +1083,7 @@ int rl_ioctl(ifp, command, data) { struct rl_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; + struct ifaddr *ifa = (struct ifaddr *) data; int s, error = 0; s = splnet(); @@ -1103,13 +1103,6 @@ int rl_ioctl(ifp, command, data) break; } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) { - error = EINVAL; - } else if (ifp->if_mtu != ifr->ifr_mtu) { - ifp->if_mtu = ifr->ifr_mtu; - } - break; case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { rl_init(sc); @@ -1119,22 +1112,6 @@ int rl_ioctl(ifp, command, data) } error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - rl_setmulti(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, command); @@ -1143,6 +1120,12 @@ int rl_ioctl(ifp, command, data) error = ether_ioctl(ifp, &sc->sc_arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + rl_setmulti(sc); + error = 0; + } + splx(s); return(error); } diff --git a/sys/dev/ic/rtw.c b/sys/dev/ic/rtw.c index 6635b02042b..b10a9e63f40 100644 --- a/sys/dev/ic/rtw.c +++ b/sys/dev/ic/rtw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtw.c,v 1.70 2008/08/27 10:29:53 damien Exp $ */ +/* $OpenBSD: rtw.c,v 1.71 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: rtw.c,v 1.29 2004/12/27 19:49:16 dyoung Exp $ */ /*- @@ -2614,21 +2614,15 @@ rtw_led_attach(struct rtw_led_state *ls, void *arg) int rtw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { - int rc = 0, s; struct rtw_softc *sc = ifp->if_softc; struct ieee80211com *ic = &sc->sc_ic; - struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; + struct ifreq *ifr = (struct ifreq *)data; + int rc = 0, s; s = splnet(); + switch (cmd) { - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) { - rc = EINVAL; - } else if (ifp->if_mtu != ifr->ifr_mtu) { - ifp->if_mtu = ifr->ifr_mtu; - } - break; case SIOCSIFADDR: ifp->if_flags |= IFF_UP; #ifdef INET @@ -2647,6 +2641,7 @@ rtw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } else if ((sc->sc_flags & RTW_F_ENABLED) != 0) rtw_stop(ifp, 1); break; + case SIOCADDMULTI: case SIOCDELMULTI: if (cmd == SIOCADDMULTI) @@ -2659,6 +2654,7 @@ rtw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) rtw_pktfilt_load(sc); rc = 0; break; + default: if ((rc = ieee80211_ioctl(ifp, cmd, data)) == ENETRESET) { if ((sc->sc_flags & RTW_F_ENABLED) != 0) @@ -2668,6 +2664,7 @@ rtw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; } + splx(s); return rc; } diff --git a/sys/dev/ic/smc83c170.c b/sys/dev/ic/smc83c170.c index 1b05cf3337b..b7cc0377720 100644 --- a/sys/dev/ic/smc83c170.c +++ b/sys/dev/ic/smc83c170.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smc83c170.c,v 1.12 2008/10/02 20:21:13 brad Exp $ */ +/* $OpenBSD: smc83c170.c,v 1.13 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: smc83c170.c,v 1.59 2005/02/27 00:27:02 perry Exp $ */ /*- @@ -549,8 +549,8 @@ int epic_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct epic_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; + struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; s = splnet(); @@ -572,13 +572,6 @@ epic_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCSIFFLAGS: /* * If interface is marked up and not running, then start it. @@ -592,25 +585,6 @@ epic_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) epic_stop(ifp, 1); break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) { - mii_pollstat(&sc->sc_mii); - epic_set_mchash(sc); - } - error = 0; - } - break; - case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); @@ -620,6 +594,14 @@ epic_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) { + mii_pollstat(&sc->sc_mii); + epic_set_mchash(sc); + } + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/ic/smc91cxx.c b/sys/dev/ic/smc91cxx.c index 00ad6a60b52..685be05c990 100644 --- a/sys/dev/ic/smc91cxx.c +++ b/sys/dev/ic/smc91cxx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smc91cxx.c,v 1.29 2008/10/03 20:25:29 brad Exp $ */ +/* $OpenBSD: smc91cxx.c,v 1.30 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: smc91cxx.c,v 1.11 1998/08/08 23:51:41 mycroft Exp $ */ /*- @@ -1089,27 +1089,6 @@ smc91cxx_ioctl(ifp, cmd, data) } break; - case SIOCADDMULTI: - case SIOCDELMULTI: - if ((sc->sc_flags & SMC_FLAGS_ENABLED) == 0) { - error = EIO; - break; - } - - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - smc91cxx_reset(sc); - error = 0; - } - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); @@ -1119,6 +1098,12 @@ smc91cxx_ioctl(ifp, cmd, data) error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + smc91cxx_reset(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c index a1f4f0a030a..1bb6f202107 100644 --- a/sys/dev/ic/xl.c +++ b/sys/dev/ic/xl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xl.c,v 1.84 2008/11/19 08:20:01 brad Exp $ */ +/* $OpenBSD: xl.c,v 1.85 2008/11/28 02:44:17 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -2281,13 +2281,6 @@ xl_ioctl(struct ifnet *ifp, u_long command, caddr_t data) #endif /* INET */ break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCSIFFLAGS: XL_SEL_WIN(5); if (ifp->if_flags & IFF_UP) { @@ -2306,26 +2299,6 @@ xl_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->xl_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) { - if (sc->xl_type == XL_TYPE_905B) - xl_setmulti_hash(sc); - else - xl_setmulti(sc); - } - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: if (sc->xl_hasmii != 0) @@ -2341,6 +2314,16 @@ xl_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = ether_ioctl(ifp, &sc->sc_arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) { + if (sc->xl_type == XL_TYPE_905B) + xl_setmulti_hash(sc); + else + xl_setmulti(sc); + } + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/isa/if_ef_isapnp.c b/sys/dev/isa/if_ef_isapnp.c index c68bac2a81c..19c91769981 100644 --- a/sys/dev/isa/if_ef_isapnp.c +++ b/sys/dev/isa/if_ef_isapnp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ef_isapnp.c,v 1.23 2008/10/02 20:21:13 brad Exp $ */ +/* $OpenBSD: if_ef_isapnp.c,v 1.24 2008/11/28 02:44:17 brad Exp $ */ /* * Copyright (c) 1999 Jason L. Wright (jason@thought.net) @@ -377,23 +377,18 @@ efioctl(ifp, cmd, data) efsetmulti(sc); break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - efreset(sc); - error = 0; - } - efsetmulti(sc); - break; default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) { + efreset(sc); + efsetmulti(sc); + } + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/isa/if_ex.c b/sys/dev/isa/if_ex.c index 0bb810f82c7..e9ab96f0532 100644 --- a/sys/dev/isa/if_ex.c +++ b/sys/dev/isa/if_ex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ex.c,v 1.34 2008/11/22 13:14:35 oga Exp $ */ +/* $OpenBSD: if_ex.c,v 1.35 2008/11/28 02:44:17 brad Exp $ */ /* * Copyright (c) 1997, Donald A. Schmidt * Copyright (c) 1996, Javier Martín Rueda (jmrueda@diatel.upm.es) @@ -737,8 +737,8 @@ ex_rx_intr(struct ex_softc *sc) int ex_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { - struct ifaddr *ifa = (struct ifaddr *) data; struct ex_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; @@ -765,25 +765,6 @@ ex_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } else ex_init(sc); break; - case SIOCSIFMTU: - DODEBUG(Start_End, printf("SIOCSIFMTU");); - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) - ? ether_addmulti(ifr, &sc->arpcom) - : ether_delmulti(ifr, &sc->arpcom); - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - ex_init(sc); - error = 0; - } - break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->ifmedia, cmd); @@ -792,6 +773,12 @@ ex_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ether_ioctl(ifp, &sc->arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + ex_init(sc); + error = 0; + } + splx(s); DODEBUG(Start_End, printf("\nex_ioctl: finish\n");); return(error); diff --git a/sys/dev/isa/if_ie.c b/sys/dev/isa/if_ie.c index 0639fbeae9d..34609848d1c 100644 --- a/sys/dev/isa/if_ie.c +++ b/sys/dev/isa/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.34 2008/10/02 20:21:13 brad Exp $ */ +/* $OpenBSD: if_ie.c,v 1.35 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: if_ie.c,v 1.51 1996/05/12 23:52:48 mycroft Exp $ */ /*- @@ -2121,7 +2121,6 @@ ieioctl(ifp, cmd, data) { struct ie_softc *sc = ifp->if_softc; struct ifaddr *ifa = (struct ifaddr *)data; - struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; s = splnet(); @@ -2176,27 +2175,16 @@ ieioctl(ifp, cmd, data) #endif break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom): - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - mc_reset(sc); - error = 0; - } - break; - default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + mc_reset(sc); + error = 0; + } + splx(s); return error; } diff --git a/sys/dev/pci/if_bce.c b/sys/dev/pci/if_bce.c index eae61660a28..34669556d26 100644 --- a/sys/dev/pci/if_bce.c +++ b/sys/dev/pci/if_bce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bce.c,v 1.26 2008/10/02 20:21:13 brad Exp $ */ +/* $OpenBSD: if_bce.c,v 1.27 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: if_bce.c,v 1.3 2003/09/29 01:53:02 mrg Exp $ */ /* @@ -434,8 +434,8 @@ int bce_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct bce_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; int s, error = 0; s = splnet(); @@ -456,12 +456,7 @@ bce_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if(ifp->if_flags & IFF_UP) if(ifp->if_flags & IFF_RUNNING) @@ -472,30 +467,22 @@ bce_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) bce_stop(ifp, 0); break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->bce_ac) : - ether_delmulti(ifr, &sc->bce_ac); - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - bce_set_filter(ifp); - error = 0; - } - break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->bce_mii.mii_media, cmd); break; + default: error = ether_ioctl(ifp, &sc->bce_ac, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + bce_set_filter(ifp); + error = 0; + } + if (error == 0) { /* Try to get more packets going. */ bce_start(ifp); diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index 88a1deb0fbd..5462d27517e 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.256 2008/11/22 18:16:55 dlg Exp $ */ +/* $OpenBSD: if_bge.c,v 1.257 2008/11/28 02:44:17 brad Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -3281,8 +3281,8 @@ int bge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct bge_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; int s, error = 0; struct mii_data *mii; @@ -3298,12 +3298,7 @@ bge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc->arpcom, ifa); #endif /* INET */ break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING) @@ -3316,18 +3311,7 @@ bge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->bge_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) - ? ether_addmulti(ifr, &sc->arpcom) - : ether_delmulti(ifr, &sc->arpcom); - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - bge_iff(sc); - error = 0; - } - break; case SIOCSIFMEDIA: /* XXX Flow control is not supported for 1000BASE-SX */ if (sc->bge_flags & BGE_PHY_FIBER_TBI) { @@ -3359,10 +3343,17 @@ bge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) command); } break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + bge_iff(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c index 22008bcb765..4505ad8f0dd 100644 --- a/sys/dev/pci/if_bnx.c +++ b/sys/dev/pci/if_bnx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bnx.c,v 1.70 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_bnx.c,v 1.71 2008/11/28 02:44:17 brad Exp $ */ /*- * Copyright (c) 2006 Broadcom Corporation @@ -4586,8 +4586,8 @@ int bnx_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct bnx_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; struct mii_data *mii = &sc->bnx_mii; int s, error = 0; @@ -4604,13 +4604,6 @@ bnx_ioctl(struct ifnet *ifp, u_long command, caddr_t data) #endif /* INET */ break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if ((ifp->if_flags & IFF_RUNNING) && @@ -4628,19 +4621,6 @@ bnx_ioctl(struct ifnet *ifp, u_long command, caddr_t data) sc->bnx_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) - ? ether_addmulti(ifr, &sc->arpcom) - : ether_delmulti(ifr, &sc->arpcom); - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - bnx_set_rx_mode(sc); - error = 0; - } - break; - case SIOCSIFMEDIA: case SIOCGIFMEDIA: DBPRINT(sc, BNX_VERBOSE, "bnx_phy_flags = 0x%08X\n", @@ -4653,6 +4633,12 @@ bnx_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + bnx_set_rx_mode(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c index 4c42eb8bbe0..c037ab2acd3 100644 --- a/sys/dev/pci/if_cas.c +++ b/sys/dev/pci/if_cas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cas.c,v 1.23 2008/10/14 18:01:53 naddy Exp $ */ +/* $OpenBSD: if_cas.c,v 1.24 2008/11/28 02:44:17 brad Exp $ */ /* * @@ -1718,31 +1718,6 @@ cas_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) #endif break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) { - error = EINVAL; - } else if (ifp->if_mtu != ifr->ifr_mtu) { - ifp->if_mtu = ifr->ifr_mtu; - } - break; - - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - cas_setladrf(sc); - error = 0; - } - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); @@ -1752,6 +1727,12 @@ cas_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + cas_setladrf(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_de.c b/sys/dev/pci/if_de.c index 6bc9a6b689e..13c35da05f9 100644 --- a/sys/dev/pci/if_de.c +++ b/sys/dev/pci/if_de.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_de.c,v 1.100 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_de.c,v 1.101 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: if_de.c,v 1.58 1998/01/12 09:39:58 thorpej Exp $ */ /*- @@ -4182,38 +4182,16 @@ tulip_ifioctl(struct ifnet * ifp, u_long cmd, caddr_t data) break; } - case SIOCADDMULTI: - case SIOCDELMULTI: { - /* - * Update multicast listeners - */ - if (cmd == SIOCADDMULTI) - error = ether_addmulti(ifr, &sc->tulip_ac); - else - error = ether_delmulti(ifr, &sc->tulip_ac); + default: + error = ether_ioctl(ifp, &sc->tulip_ac, cmd, data); + } - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) { + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) { tulip_addr_filter(sc); /* reset multicast filtering */ tulip_init(sc); - } - error = 0; } - break; - } - - case SIOCSIFMTU: - /* - * Set the interface MTU. - */ - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - - default: - error = ether_ioctl(ifp, &sc->tulip_ac, cmd, data); + error = 0; } splx(s); diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index 35a96944f55..e5c701319b8 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.197 2008/11/26 00:14:48 dlg Exp $ */ +/* $OpenBSD: if_em.c,v 1.198 2008/11/28 02:44:17 brad Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include @@ -555,13 +555,7 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc->interface_data, ifa); #endif /* INET */ break; - case SIOCSIFMTU: - IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFMTU (Set Interface MTU)"); - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFFLAGS (Set Interface Flags)"); if (ifp->if_flags & IFF_UP) { @@ -584,24 +578,7 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - IOCTL_DEBUGOUT("ioctl rcv'd: SIOC(ADD|DEL)MULTI"); - error = (command == SIOCADDMULTI) - ? ether_addmulti(ifr, &sc->interface_data) - : ether_delmulti(ifr, &sc->interface_data); - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) { - em_disable_intr(sc); - em_set_multi(sc); - if (sc->hw.mac_type == em_82542_rev2_0) - em_initialize_receive_unit(sc); - em_enable_intr(sc); - } - error = 0; - } - break; + case SIOCSIFMEDIA: /* Check SOL/IDER usage */ if (em_check_phy_reset_block(&sc->hw)) { @@ -613,10 +590,22 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) IOCTL_DEBUGOUT("ioctl rcv'd: SIOCxIFMEDIA (Get/Set Interface Media)"); error = ifmedia_ioctl(ifp, ifr, &sc->media, command); break; + default: error = ether_ioctl(ifp, &sc->interface_data, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) { + em_disable_intr(sc); + em_set_multi(sc); + if (sc->hw.mac_type == em_82542_rev2_0) + em_initialize_receive_unit(sc); + em_enable_intr(sc); + } + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_et.c b/sys/dev/pci/if_et.c index ef2c020da00..463e9e89e2e 100644 --- a/sys/dev/pci/if_et.c +++ b/sys/dev/pci/if_et.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_et.c,v 1.15 2008/11/04 19:20:22 chl Exp $ */ +/* $OpenBSD: if_et.c,v 1.16 2008/11/28 02:44:17 brad Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. * @@ -1030,8 +1030,8 @@ int et_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct et_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; + struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; s = splnet(); @@ -1046,12 +1046,7 @@ et_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) arp_ifinit(&sc->sc_arpcom, ifa); #endif break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { /* @@ -1073,26 +1068,22 @@ et_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } sc->sc_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - et_setmulti(sc); - error = 0; - } - break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_miibus.mii_media, cmd); break; + default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + et_setmulti(sc); + error = 0; + } + splx(s); return error; } diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c index c5626db5f80..7720a2e9f19 100644 --- a/sys/dev/pci/if_ix.c +++ b/sys/dev/pci/if_ix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ix.c,v 1.14 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_ix.c,v 1.15 2008/11/28 02:44:18 brad Exp $ */ /****************************************************************************** @@ -425,10 +425,10 @@ ixgbe_start(struct ifnet *ifp) int ixgbe_ioctl(struct ifnet * ifp, u_long command, caddr_t data) { - int s, error = 0; - struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *) data; - struct ix_softc *sc = ifp->if_softc; + struct ix_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; + struct ifreq *ifr = (struct ifreq *) data; + int s, error = 0; s = splnet(); @@ -443,6 +443,7 @@ ixgbe_ioctl(struct ifnet * ifp, u_long command, caddr_t data) arp_ifinit(&sc->arpcom, ifa); #endif break; + case SIOCSIFMTU: IOCTL_DEBUGOUT("ioctl: SIOCSIFMTU (Set Interface MTU)"); if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) @@ -454,6 +455,7 @@ ixgbe_ioctl(struct ifnet * ifp, u_long command, caddr_t data) ixgbe_init(sc); } break; + case SIOCSIFFLAGS: IOCTL_DEBUGOUT("ioctl: SIOCSIFFLAGS (Set Interface Flags)"); if (ifp->if_flags & IFF_UP) { @@ -470,31 +472,26 @@ ixgbe_ioctl(struct ifnet * ifp, u_long command, caddr_t data) ixgbe_stop(sc); sc->if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - IOCTL_DEBUGOUT("ioctl: SIOC(ADD|DEL)MULTI"); - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) { - ixgbe_disable_intr(sc); - ixgbe_set_multi(sc); - ixgbe_enable_intr(sc); - } - error = 0; - } - break; + case SIOCSIFMEDIA: case SIOCGIFMEDIA: IOCTL_DEBUGOUT("ioctl: SIOCxIFMEDIA (Get/Set Interface Media)"); error = ifmedia_ioctl(ifp, ifr, &sc->media, command); break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) { + ixgbe_disable_intr(sc); + ixgbe_set_multi(sc); + ixgbe_enable_intr(sc); + } + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_ixgb.c b/sys/dev/pci/if_ixgb.c index baac695eca5..a2d5e58c370 100644 --- a/sys/dev/pci/if_ixgb.c +++ b/sys/dev/pci/if_ixgb.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_ixgb.c,v 1.51 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_ixgb.c,v 1.52 2008/11/28 02:44:18 brad Exp $ */ #include @@ -364,10 +364,10 @@ ixgb_start(struct ifnet *ifp) int ixgb_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { - int s, error = 0; - struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; struct ixgb_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; + struct ifreq *ifr = (struct ifreq *) data; + int s, error = 0; s = splnet(); @@ -383,13 +383,7 @@ ixgb_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc->interface_data, ifa); #endif /* INET */ break; - case SIOCSIFMTU: - IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFMTU (Set Interface MTU)"); - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFFLAGS (Set Interface Flags)"); if (ifp->if_flags & IFF_UP) { @@ -412,31 +406,26 @@ ixgb_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - IOCTL_DEBUGOUT("ioctl rcv'd: SIOC(ADD|DEL)MULTI"); - error = (command == SIOCADDMULTI) - ? ether_addmulti(ifr, &sc->interface_data) - : ether_delmulti(ifr, &sc->interface_data); - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) { - ixgb_disable_intr(sc); - ixgb_set_multi(sc); - ixgb_enable_intr(sc); - } - error = 0; - } - break; + case SIOCSIFMEDIA: case SIOCGIFMEDIA: IOCTL_DEBUGOUT("ioctl rcv'd: SIOCxIFMEDIA (Get/Set Interface Media)"); error = ifmedia_ioctl(ifp, ifr, &sc->media, command); break; + default: error = ether_ioctl(ifp, &sc->interface_data, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) { + ixgb_disable_intr(sc); + ixgb_set_multi(sc); + ixgb_enable_intr(sc); + } + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_lge.c b/sys/dev/pci/if_lge.c index 7fab43820c3..5824f8b0959 100644 --- a/sys/dev/pci/if_lge.c +++ b/sys/dev/pci/if_lge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lge.c,v 1.49 2008/10/22 00:01:59 brad Exp $ */ +/* $OpenBSD: if_lge.c,v 1.50 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 @@ -1366,8 +1366,8 @@ int lge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct lge_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; struct mii_data *mii; int s, error = 0; @@ -1383,12 +1383,7 @@ lge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc->arpcom, ifa); #endif /* INET */ break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1417,30 +1412,24 @@ lge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->lge_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) - ? ether_addmulti(ifr, &sc->arpcom) - : ether_delmulti(ifr, &sc->arpcom); - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - lge_setmulti(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: mii = &sc->lge_mii; error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); break; + default: - error = ENOTTY; - break; + error = ether_ioctl(ifp, &sc->arpcom, command, data); } - splx(s); + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + lge_setmulti(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_lii.c b/sys/dev/pci/if_lii.c index 216afe114ac..11a9d278d55 100644 --- a/sys/dev/pci/if_lii.c +++ b/sys/dev/pci/if_lii.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lii.c,v 1.20 2008/10/07 16:03:37 jsing Exp $ */ +/* $OpenBSD: if_lii.c,v 1.21 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2007 The NetBSD Foundation. @@ -1044,8 +1044,8 @@ int lii_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) { struct lii_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *)addr; struct ifreq *ifr = (struct ifreq *)addr; - struct ifaddr *ifa; int s, error = 0; s = splnet(); @@ -1054,11 +1054,11 @@ lii_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) case SIOCSIFADDR: SET(ifp->if_flags, IFF_UP); #ifdef INET - ifa = (struct ifaddr *)addr; if (ifa->ifa_addr->sa_family == AF_INET) arp_ifinit(&sc->sc_ac, ifa); #endif /* FALLTHROUGH */ + case SIOCSIFFLAGS: if (ISSET(ifp->if_flags, IFF_UP)) { if (ISSET(ifp->if_flags, IFF_RUNNING)) @@ -1071,17 +1071,11 @@ lii_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) } break; - case SIOCADDMULTI: - error = ether_addmulti(ifr, &sc->sc_ac); - break; - case SIOCDELMULTI: - error = ether_delmulti(ifr, &sc->sc_ac); - break; - case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); break; + default: error = ether_ioctl(ifp, &sc->sc_ac, cmd, addr); } diff --git a/sys/dev/pci/if_msk.c b/sys/dev/pci/if_msk.c index ad9c0958fad..f30d78874f3 100644 --- a/sys/dev/pci/if_msk.c +++ b/sys/dev/pci/if_msk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_msk.c,v 1.67 2008/10/14 18:01:53 naddy Exp $ */ +/* $OpenBSD: if_msk.c,v 1.68 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -727,8 +727,8 @@ int msk_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct sk_if_softc *sc_if = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *) data; struct ifaddr *ifa = (struct ifaddr *) data; + struct ifreq *ifr = (struct ifreq *) data; struct mii_data *mii; int s, error = 0; @@ -744,12 +744,7 @@ msk_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc_if->arpcom, ifa); #endif /* INET */ break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -767,31 +762,23 @@ msk_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc_if->sk_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc_if->arpcom) : - ether_delmulti(ifr, &sc_if->arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - msk_setmulti(sc_if); - error = 0; - } - break; + case SIOCGIFMEDIA: case SIOCSIFMEDIA: mii = &sc_if->sk_mii; error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); break; + default: error = ether_ioctl(ifp, &sc_if->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + msk_setmulti(sc_if); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_myx.c b/sys/dev/pci/if_myx.c index 27ff873b5c3..2645c20b5c5 100644 --- a/sys/dev/pci/if_myx.c +++ b/sys/dev/pci/if_myx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_myx.c,v 1.9 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_myx.c,v 1.10 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2007 Reyk Floeter @@ -831,6 +831,7 @@ myx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) arp_ifinit(&sc->sc_ac, ifa); #endif /* FALLTHROUGH */ + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING) @@ -843,21 +844,6 @@ myx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - - case SIOCADDMULTI: - error = ether_addmulti(ifr, &sc->sc_ac); - break; - - case SIOCDELMULTI: - error = ether_delmulti(ifr, &sc->sc_ac); - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); diff --git a/sys/dev/pci/if_nfe.c b/sys/dev/pci/if_nfe.c index 133f0b7ed9d..e0c4e34edf4 100644 --- a/sys/dev/pci/if_nfe.c +++ b/sys/dev/pci/if_nfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nfe.c,v 1.86 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_nfe.c,v 1.87 2008/11/28 02:44:18 brad Exp $ */ /*- * Copyright (c) 2006, 2007 Damien Bergamini @@ -522,8 +522,8 @@ int nfe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct nfe_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; + struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; s = splnet(); @@ -538,12 +538,7 @@ nfe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) arp_ifinit(&sc->sc_arpcom, ifa); #endif break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { /* @@ -565,26 +560,22 @@ nfe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } sc->sc_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - nfe_setmulti(sc); - error = 0; - } - break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); break; + default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + nfe_setmulti(sc); + error = 0; + } + splx(s); return error; } diff --git a/sys/dev/pci/if_nge.c b/sys/dev/pci/if_nge.c index 7da2a2d5ea5..9427b44cf43 100644 --- a/sys/dev/pci/if_nge.c +++ b/sys/dev/pci/if_nge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nge.c,v 1.66 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_nge.c,v 1.67 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 @@ -2061,20 +2061,14 @@ nge_ioctl(ifp, command, data) caddr_t data; { struct nge_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; struct mii_data *mii; int s, error = 0; s = splnet(); switch(command) { - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; case SIOCSIFADDR: ifp->if_flags |= IFF_UP; switch (ifa->ifa_addr->sa_family) { @@ -2089,6 +2083,7 @@ nge_ioctl(ifp, command, data) break; } break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -2116,18 +2111,7 @@ nge_ioctl(ifp, command, data) sc->nge_if_flags = ifp->if_flags; error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) - ? ether_addmulti(ifr, &sc->arpcom) - : ether_delmulti(ifr, &sc->arpcom); - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - nge_setmulti(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: if (sc->nge_tbi) { @@ -2139,10 +2123,17 @@ nge_ioctl(ifp, command, data) command); } break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + nge_setmulti(sc); + error = 0; + } + splx(s); return(error); } diff --git a/sys/dev/pci/if_nxe.c b/sys/dev/pci/if_nxe.c index 42545077a8c..eb59c1f25a0 100644 --- a/sys/dev/pci/if_nxe.c +++ b/sys/dev/pci/if_nxe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nxe.c,v 1.58 2008/11/23 12:51:10 dlg Exp $ */ +/* $OpenBSD: if_nxe.c,v 1.59 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2007 David Gwynne @@ -1017,10 +1017,9 @@ int nxe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) { struct nxe_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *)addr; struct ifreq *ifr = (struct ifreq *)addr; - struct ifaddr *ifa; - int error = 0; - int s; + int s, error = 0; rw_enter_write(&sc->sc_lock); s = splnet(); @@ -1031,11 +1030,11 @@ nxe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) case SIOCSIFADDR: SET(ifp->if_flags, IFF_UP); #ifdef INET - ifa = (struct ifaddr *)addr; if (ifa->ifa_addr->sa_family == AF_INET) arp_ifinit(&sc->sc_ac, ifa); #endif /* FALLTHROUGH */ + case SIOCSIFFLAGS: if (ISSET(ifp->if_flags, IFF_UP)) { if (ISSET(ifp->if_flags, IFF_RUNNING)) @@ -1053,13 +1052,6 @@ nxe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); break; - case SIOCADDMULTI: - error = ether_addmulti(ifr, &sc->sc_ac); - break; - case SIOCDELMULTI: - error = ether_delmulti(ifr, &sc->sc_ac); - break; - default: error = ether_ioctl(ifp, &sc->sc_ac, cmd, addr); } diff --git a/sys/dev/pci/if_pcn.c b/sys/dev/pci/if_pcn.c index 58d5339d6c9..268e6f19730 100644 --- a/sys/dev/pci/if_pcn.c +++ b/sys/dev/pci/if_pcn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pcn.c,v 1.20 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_pcn.c,v 1.21 2008/11/28 02:44:18 brad Exp $ */ /* $NetBSD: if_pcn.c,v 1.26 2005/05/07 09:15:44 is Exp $ */ /* @@ -1082,8 +1082,8 @@ int pcn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct pcn_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; int s, error = 0; s = splnet(); @@ -1105,13 +1105,6 @@ pcn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCSIFFLAGS: /* * If interface is marked up and not running, then start it. @@ -1125,24 +1118,6 @@ pcn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) pcn_stop(ifp, 1); break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - error = pcn_init(ifp); - else - error = 0; - } - break; - case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); @@ -1152,6 +1127,13 @@ pcn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + error = pcn_init(ifp); + else + error = 0; + } + /* Try to get more packets going. */ pcn_start(ifp); diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c index 284256b4174..08c2ee07e01 100644 --- a/sys/dev/pci/if_sis.c +++ b/sys/dev/pci/if_sis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sis.c,v 1.84 2008/11/10 07:23:43 cnst Exp $ */ +/* $OpenBSD: if_sis.c,v 1.85 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. @@ -1887,8 +1887,8 @@ int sis_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct sis_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; struct mii_data *mii; int s, error = 0; @@ -1904,6 +1904,7 @@ sis_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc->arpcom, ifa); #endif break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1925,37 +1926,23 @@ sis_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->sc_if_flags = ifp->if_flags; break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - sis_setmulti(sc); - error = 0; - } - break; + case SIOCGIFMEDIA: case SIOCSIFMEDIA: mii = &sc->sc_mii; error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + sis_setmulti(sc); + error = 0; + } + splx(s); return(error); } diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c index 40466aa83f7..2b53bbde494 100644 --- a/sys/dev/pci/if_sk.c +++ b/sys/dev/pci/if_sk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sk.c,v 1.149 2008/10/14 18:01:53 naddy Exp $ */ +/* $OpenBSD: if_sk.c,v 1.150 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -859,8 +859,8 @@ int sk_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct sk_if_softc *sc_if = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *) data; struct ifaddr *ifa = (struct ifaddr *) data; + struct ifreq *ifr = (struct ifreq *) data; struct mii_data *mii; int s, error = 0; @@ -876,12 +876,7 @@ sk_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc_if->arpcom, ifa); #endif /* INET */ break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -899,31 +894,23 @@ sk_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc_if->sk_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc_if->arpcom) : - ether_delmulti(ifr, &sc_if->arpcom); - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - sk_setmulti(sc_if); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: mii = &sc_if->sk_mii; error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); break; + default: error = ether_ioctl(ifp, &sc_if->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + sk_setmulti(sc_if); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_ste.c b/sys/dev/pci/if_ste.c index f817717a6b5..1ffab70958c 100644 --- a/sys/dev/pci/if_ste.c +++ b/sys/dev/pci/if_ste.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ste.c,v 1.42 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_ste.c,v 1.43 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. @@ -1275,8 +1275,8 @@ int ste_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct ste_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; struct mii_data *mii; int s, error = 0; @@ -1295,6 +1295,7 @@ ste_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; } break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1322,31 +1323,23 @@ ste_ioctl(struct ifnet *ifp, u_long command, caddr_t data) sc->ste_if_flags = ifp->if_flags; error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - ste_setmulti(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: mii = &sc->sc_mii; error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + ste_setmulti(sc); + error = 0; + } + splx(s); return(error); } diff --git a/sys/dev/pci/if_stge.c b/sys/dev/pci/if_stge.c index 91d27001ef2..76be8fae8c8 100644 --- a/sys/dev/pci/if_stge.c +++ b/sys/dev/pci/if_stge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_stge.c,v 1.44 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_stge.c,v 1.45 2008/11/28 02:44:18 brad Exp $ */ /* $NetBSD: if_stge.c,v 1.27 2005/05/16 21:35:32 bouyer Exp $ */ /*- @@ -700,8 +700,8 @@ int stge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct stge_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; + struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; s = splnet(); @@ -718,13 +718,6 @@ stge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) #endif break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -742,23 +735,6 @@ stge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) sc->stge_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - stge_set_filter(sc); - error = 0; - } - break; - case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); @@ -768,6 +744,12 @@ stge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + stge_set_filter(sc); + error = 0; + } + /* Try to get more packets going. */ stge_start(ifp); diff --git a/sys/dev/pci/if_tht.c b/sys/dev/pci/if_tht.c index 2e2520b37ad..1a5b168b9f7 100644 --- a/sys/dev/pci/if_tht.c +++ b/sys/dev/pci/if_tht.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tht.c,v 1.120 2008/11/23 12:48:43 dlg Exp $ */ +/* $OpenBSD: if_tht.c,v 1.121 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2007 David Gwynne @@ -863,25 +863,23 @@ int tht_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) { struct tht_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *)addr; struct ifreq *ifr = (struct ifreq *)addr; - struct ifaddr *ifa; - int error = 0; - int s; + int s, error = 0; rw_enter_write(&sc->sc_lock); s = splnet(); switch (cmd) { case SIOCSIFADDR: - ifa = (struct ifaddr *)addr; + ifp->if_flags |= IFF_UP; #ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) arp_ifinit(&sc->sc_ac, ifa); #endif - - ifp->if_flags |= IFF_UP; /* FALLTHROUGH */ + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING) @@ -894,20 +892,6 @@ tht_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else - ifp->if_mtu = ifr->ifr_mtu; - break; - - case SIOCADDMULTI: - error = ether_addmulti(ifr, &sc->sc_ac); - break; - case SIOCDELMULTI: - error = ether_delmulti(ifr, &sc->sc_ac); - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); diff --git a/sys/dev/pci/if_ti.c b/sys/dev/pci/if_ti.c index c73367510cf..da5a66a8083 100644 --- a/sys/dev/pci/if_ti.c +++ b/sys/dev/pci/if_ti.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ti.c,v 1.93 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_ti.c,v 1.94 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -2485,8 +2485,8 @@ int ti_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct ti_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; + struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; struct ti_cmd_desc cmd; @@ -2502,12 +2502,7 @@ ti_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc->arpcom, ifa); #endif /* INET */ break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { /* @@ -2538,26 +2533,22 @@ ti_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->ti_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - ti_setmulti(sc); - error = 0; - } - break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->ifmedia, command); break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + ti_setmulti(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_tl.c b/sys/dev/pci/if_tl.c index ac7a9dda767..e1fadeec78b 100644 --- a/sys/dev/pci/if_tl.c +++ b/sys/dev/pci/if_tl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tl.c,v 1.45 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_tl.c,v 1.46 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1782,8 +1782,8 @@ int tl_ioctl(ifp, command, data) caddr_t data; { struct tl_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; int s, error = 0; s = splnet(); @@ -1803,6 +1803,7 @@ int tl_ioctl(ifp, command, data) break; } break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1825,21 +1826,7 @@ int tl_ioctl(ifp, command, data) sc->tl_if_flags = ifp->if_flags; error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - tl_setmulti(sc); - error = 0; - } - break; + case SIOCSIFMEDIA: case SIOCGIFMEDIA: if (sc->tl_bitrate) @@ -1848,10 +1835,17 @@ int tl_ioctl(ifp, command, data) error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, command); break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + tl_setmulti(sc); + error = 0; + } + splx(s); return(error); } diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c index 326324b426a..45491a26755 100644 --- a/sys/dev/pci/if_txp.c +++ b/sys/dev/pci/if_txp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_txp.c,v 1.98 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_txp.c,v 1.99 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2001 @@ -1190,8 +1190,8 @@ int txp_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct txp_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; - struct ifaddr *ifa = (struct ifaddr *)data; + struct ifaddr *ifa = (struct ifaddr *) data; + struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; s = splnet(); @@ -1211,6 +1211,7 @@ txp_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; } break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { txp_init(sc); @@ -1219,30 +1220,22 @@ txp_ioctl(struct ifnet *ifp, u_long command, caddr_t data) txp_stop(sc); } break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - txp_set_filter(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_ifmedia, command); break; + default: error = ether_ioctl(ifp, &sc->sc_arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + txp_set_filter(sc); + error = 0; + } + splx(s); return(error); } diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c index ed280d7b627..f924e701d4d 100644 --- a/sys/dev/pci/if_vge.c +++ b/sys/dev/pci/if_vge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vge.c,v 1.42 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_vge.c,v 1.43 2008/11/28 02:44:18 brad Exp $ */ /* $FreeBSD: if_vge.c,v 1.3 2004/09/11 22:13:25 wpaul Exp $ */ /* * Copyright (c) 2004 @@ -1733,8 +1733,8 @@ int vge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct vge_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *) data; struct ifaddr *ifa = (struct ifaddr *) data; + struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; s = splnet(); @@ -1754,12 +1754,7 @@ vge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1782,26 +1777,22 @@ vge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->vge_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - vge_setmulti(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, command); break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + vge_setmulti(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_vic.c b/sys/dev/pci/if_vic.c index e214785c663..ed0c0089435 100644 --- a/sys/dev/pci/if_vic.c +++ b/sys/dev/pci/if_vic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vic.c,v 1.63 2008/11/25 17:01:14 dlg Exp $ */ +/* $OpenBSD: if_vic.c,v 1.64 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2006 Reyk Floeter @@ -1214,15 +1214,14 @@ int vic_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct vic_softc *sc = (struct vic_softc *)ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *)data; struct ifreq *ifr = (struct ifreq *)data; - struct ifaddr *ifa; int s, error = 0; s = splnet(); switch (cmd) { case SIOCSIFADDR: - ifa = (struct ifaddr *)data; ifp->if_flags |= IFF_UP; #ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) @@ -1241,27 +1240,6 @@ vic_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - - case SIOCADDMULTI: - case SIOCDELMULTI: - ifr = (struct ifreq *)data; - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_ac) : - ether_delmulti(ifr, &sc->sc_ac); - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - vic_iff(sc); - error = 0; - } - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); @@ -1272,9 +1250,8 @@ vic_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } if (error == ENETRESET) { - if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) == - (IFF_UP | IFF_RUNNING)) - vic_iff(ifp->if_softc); + if (ifp->if_flags & IFF_RUNNING) + vic_iff(sc); error = 0; } diff --git a/sys/dev/pci/if_vr.c b/sys/dev/pci/if_vr.c index 90d0d884645..9e64f710c78 100644 --- a/sys/dev/pci/if_vr.c +++ b/sys/dev/pci/if_vr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vr.c,v 1.79 2008/10/14 18:01:53 naddy Exp $ */ +/* $OpenBSD: if_vr.c,v 1.80 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1326,9 +1326,9 @@ int vr_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct vr_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; - struct ifaddr *ifa = (struct ifaddr *)data; s = splnet(); @@ -1342,6 +1342,7 @@ vr_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc->arpcom, ifa); #endif break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1369,36 +1370,22 @@ vr_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->sc_if_flags = ifp->if_flags; break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - vr_setmulti(sc); - error = 0; - } - break; + case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, command); break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + vr_setmulti(sc); + error = 0; + } + splx(s); return(error); } diff --git a/sys/dev/pci/if_wb.c b/sys/dev/pci/if_wb.c index 22229c29d42..a41a7c982dc 100644 --- a/sys/dev/pci/if_wb.c +++ b/sys/dev/pci/if_wb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wb.c,v 1.42 2008/11/25 11:01:35 claudio Exp $ */ +/* $OpenBSD: if_wb.c,v 1.43 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1572,8 +1572,8 @@ int wb_ioctl(ifp, command, data) caddr_t data; { struct wb_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; int s, error = 0; s = splnet(); @@ -1592,6 +1592,7 @@ int wb_ioctl(ifp, command, data) wb_init(sc); } break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { wb_init(sc); @@ -1601,30 +1602,22 @@ int wb_ioctl(ifp, command, data) } error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - wb_setmulti(sc); - error = 0; - } - break; + case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, command); break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + wb_setmulti(sc); + error = 0; + } + splx(s); return(error); } diff --git a/sys/dev/pci/if_xge.c b/sys/dev/pci/if_xge.c index 7bef2d3296b..513df959520 100644 --- a/sys/dev/pci/if_xge.c +++ b/sys/dev/pci/if_xge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xge.c,v 1.48 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_xge.c,v 1.49 2008/11/28 02:44:18 brad Exp $ */ /* $NetBSD: if_xge.c,v 1.1 2005/09/09 10:30:27 ragge Exp $ */ /* @@ -968,8 +968,8 @@ int xge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct xge_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; int s, error = 0; s = splnet(); @@ -984,12 +984,7 @@ xge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) arp_ifinit(&sc->sc_arpcom, ifa); #endif /* INET */ break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1006,26 +1001,22 @@ xge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } sc->xge_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) - ? ether_addmulti(ifr, &sc->sc_arpcom) - : ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - xge_setmulti(sc); - error = 0; - } - break; + case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->xena_media, cmd); break; + default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + xge_setmulti(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pcmcia/if_ray.c b/sys/dev/pcmcia/if_ray.c index f5da8e812e2..d2f59611348 100644 --- a/sys/dev/pcmcia/if_ray.c +++ b/sys/dev/pcmcia/if_ray.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ray.c,v 1.36 2008/11/21 16:53:05 oga Exp $ */ +/* $OpenBSD: if_ray.c,v 1.37 2008/11/28 02:44:18 brad Exp $ */ /* $NetBSD: if_ray.c,v 1.21 2000/07/05 02:35:54 onoe Exp $ */ /* @@ -985,22 +985,6 @@ ray_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } else if (ifp->if_flags & IFF_RUNNING) ray_disable(sc); break; - case SIOCADDMULTI: - case SIOCDELMULTI: - if (cmd == SIOCADDMULTI) { - RAY_DPRINTF(("%s: ioctl: cmd SIOCADDMULTI\n", - ifp->if_xname)); - error = ether_addmulti(ifr, &sc->sc_ec); - } else { - RAY_DPRINTF(("%s: ioctl: cmd SIOCDELMULTI\n", - ifp->if_xname)); - error = ether_delmulti(ifr, &sc->sc_ec); - } - if (error == ENETRESET) { - error = 0; - ray_update_mcast(sc); - } - break; case SIOCSIFMEDIA: RAY_DPRINTF(("%s: ioctl: cmd SIOCSIFMEDIA\n", ifp->if_xname)); case SIOCGIFMEDIA: @@ -1075,6 +1059,12 @@ ray_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ether_ioctl(ifp, &sc->sc_ec, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + ray_update_mcast(sc); + error = 0; + } + RAY_DPRINTF(("%s: ioctl: returns %d\n", ifp->if_xname, error)); splx(s); diff --git a/sys/dev/sbus/be.c b/sys/dev/sbus/be.c index c73ef6b2ec0..1527ff0008b 100644 --- a/sys/dev/sbus/be.c +++ b/sys/dev/sbus/be.c @@ -1,4 +1,4 @@ -/* $OpenBSD: be.c,v 1.22 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: be.c,v 1.23 2008/11/28 02:44:18 brad Exp $ */ /* $NetBSD: be.c,v 1.26 2001/03/20 15:39:20 pk Exp $ */ /*- @@ -981,30 +981,21 @@ beioctl(struct ifnet *ifp, u_long cmd, caddr_t data) #endif break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom): - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - be_mcreset(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); break; + default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + be_mcreset(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/sbus/qe.c b/sys/dev/sbus/qe.c index e75e0ef2600..a350916ef4b 100644 --- a/sys/dev/sbus/qe.c +++ b/sys/dev/sbus/qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qe.c,v 1.22 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: qe.c,v 1.23 2008/11/28 02:44:18 brad Exp $ */ /* $NetBSD: qe.c,v 1.16 2001/03/30 17:30:18 christos Exp $ */ /*- @@ -950,23 +950,6 @@ qeioctl(ifp, cmd, data) #endif break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom): - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - qe_mcreset(sc); - error = 0; - } - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_ifmedia, cmd); @@ -976,6 +959,12 @@ qeioctl(ifp, cmd, data) error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + qe_mcreset(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c index 0b0c45bea28..9572f87dc00 100644 --- a/sys/dev/usb/if_aue.c +++ b/sys/dev/usb/if_aue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_aue.c,v 1.74 2008/11/06 02:32:28 brad Exp $ */ +/* $OpenBSD: if_aue.c,v 1.75 2008/11/28 02:44:18 brad Exp $ */ /* $NetBSD: if_aue.c,v 1.82 2003/03/05 17:37:36 shiba Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -1537,13 +1537,6 @@ aue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU) - error = EINVAL; - else - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1563,27 +1556,23 @@ aue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) sc->aue_if_flags = ifp->if_flags; error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - aue_setmulti(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: mii = GET_MII(sc); error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + aue_setmulti(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c index ab00e05ed9d..62af3637512 100644 --- a/sys/dev/usb/if_axe.c +++ b/sys/dev/usb/if_axe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_axe.c,v 1.90 2008/11/06 02:32:28 brad Exp $ */ +/* $OpenBSD: if_axe.c,v 1.91 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Jonathan Gray @@ -1352,13 +1352,6 @@ axe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) #endif break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1385,22 +1378,7 @@ axe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } sc->axe_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - axe_setmulti(sc); - error = 0; - } - break; + case SIOCGIFMEDIA: case SIOCSIFMEDIA: mii = GET_MII(sc); @@ -1411,6 +1389,12 @@ axe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ether_ioctl(ifp, &sc->arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + axe_setmulti(sc); + error = 0; + } + splx(s); return(error); } diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c index d19d56e366f..aad335ad37a 100644 --- a/sys/dev/usb/if_cdce.c +++ b/sys/dev/usb/if_cdce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cdce.c,v 1.42 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_cdce.c,v 1.43 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul @@ -531,7 +531,6 @@ cdce_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct cdce_softc *sc = ifp->if_softc; struct ifaddr *ifa = (struct ifaddr *)data; - struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; if (sc->cdce_dying) @@ -550,13 +549,6 @@ cdce_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU) - error = EINVAL; - else - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (!(ifp->if_flags & IFF_RUNNING)) @@ -568,21 +560,14 @@ cdce_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->cdce_arpcom) : - ether_delmulti(ifr, &sc->cdce_arpcom); - - if (error == ENETRESET) - error = 0; - break; - default: error = ether_ioctl(ifp, &sc->cdce_arpcom, command, data); break; } + if (error == ENETRESET) + error = 0; + splx(s); return (error); } diff --git a/sys/dev/usb/if_cdcef.c b/sys/dev/usb/if_cdcef.c index a2a61de305e..2b12a61f5a0 100644 --- a/sys/dev/usb/if_cdcef.c +++ b/sys/dev/usb/if_cdcef.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cdcef.c,v 1.21 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_cdcef.c,v 1.22 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2007 Dale Rahn @@ -489,13 +489,6 @@ cdcef_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU) - error = EINVAL; - else - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (!(ifp->if_flags & IFF_RUNNING)) @@ -507,20 +500,13 @@ cdcef_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) - error = 0; - break; - default: error = ether_ioctl(ifp, &sc->sc_arpcom, command, data); } + if (error = ENETRESET) + error = 0; + splx(s); return (error); } diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index 3accd93c7ea..1225a3aead6 100644 --- a/sys/dev/usb/if_cue.c +++ b/sys/dev/usb/if_cue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cue.c,v 1.50 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_cue.c,v 1.51 2008/11/28 02:44:18 brad Exp $ */ /* $NetBSD: if_cue.c,v 1.40 2002/07/11 21:14:26 augustss Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -1100,7 +1100,6 @@ cue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct cue_softc *sc = ifp->if_softc; struct ifaddr *ifa = (struct ifaddr *)data; - struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; if (sc->cue_dying) @@ -1122,13 +1121,6 @@ cue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU) - error = EINVAL; - else - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1150,26 +1142,17 @@ cue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) sc->cue_if_flags = ifp->if_flags; error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - cue_setmulti(sc); - error = 0; - } - break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + cue_setmulti(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c index d6757cdf7b5..a909ecbea24 100644 --- a/sys/dev/usb/if_kue.c +++ b/sys/dev/usb/if_kue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_kue.c,v 1.57 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_kue.c,v 1.58 2008/11/28 02:44:18 brad Exp $ */ /* $NetBSD: if_kue.c,v 1.50 2002/07/16 22:00:31 augustss Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -1052,7 +1052,6 @@ kue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct kue_softc *sc = ifp->if_softc; struct ifaddr *ifa = (struct ifaddr *)data; - struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; DPRINTFN(5,("%s: %s: enter\n", sc->kue_dev.dv_xname,__func__)); @@ -1083,13 +1082,6 @@ kue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU) - error = EINVAL; - else - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1113,26 +1105,17 @@ kue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) sc->kue_if_flags = ifp->if_flags; error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - kue_setmulti(sc); - error = 0; - } - break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + kue_setmulti(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c index cb96fc006e3..93c17bb2527 100644 --- a/sys/dev/usb/if_udav.c +++ b/sys/dev/usb/if_udav.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_udav.c,v 1.42 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_udav.c,v 1.43 2008/11/28 02:44:18 brad Exp $ */ /* $NetBSD: if_udav.c,v 1.3 2004/04/23 17:25:25 itojun Exp $ */ /* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */ /* @@ -1223,6 +1223,7 @@ udav_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) mii = GET_MII(sc); error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd); break; + case SIOCSIFADDR: ifp->if_flags |= IFF_UP; udav_init(ifp); @@ -1236,12 +1237,6 @@ udav_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU) - error = EINVAL; - else - ifp->if_mtu = ifr->ifr_mtu; - break; case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1260,22 +1255,17 @@ udav_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_ac) : - ether_delmulti(ifr, &sc->sc_ac); - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - udav_setmulti(sc); - error = 0; - } - break; default: error = ether_ioctl(ifp, &sc->sc_ac, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + udav_setmulti(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/usb/if_url.c b/sys/dev/usb/if_url.c index adb06f86c58..9c2dbcc6ec2 100644 --- a/sys/dev/usb/if_url.c +++ b/sys/dev/usb/if_url.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_url.c,v 1.53 2008/11/06 02:32:29 brad Exp $ */ +/* $OpenBSD: if_url.c,v 1.54 2008/11/28 02:44:18 brad Exp $ */ /* $NetBSD: if_url.c,v 1.6 2002/09/29 10:19:21 martin Exp $ */ /* * Copyright (c) 2001, 2002 @@ -1116,13 +1116,6 @@ url_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU) - error = EINVAL; - else - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1141,27 +1134,23 @@ url_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_ac) : - ether_delmulti(ifr, &sc->sc_ac); - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - url_setmulti(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: mii = GET_MII(sc); error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd); break; + default: error = ether_ioctl(ifp, &sc->sc_ac, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + url_setmulti(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c index f42bd810eb9..36e4bf3319e 100644 --- a/sys/net/if_trunk.c +++ b/sys/net/if_trunk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_trunk.c,v 1.60 2008/11/16 03:42:13 brad Exp $ */ +/* $OpenBSD: if_trunk.c,v 1.61 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Reyk Floeter @@ -742,13 +742,6 @@ trunk_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) #endif /* INET */ error = ENETRESET; break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU) { - error = EINVAL; - break; - } - ifp->if_mtu = ifr->ifr_mtu; - break; case SIOCSIFFLAGS: error = ENETRESET; break; -- cgit v1.2.3