diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2008-11-28 02:44:19 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2008-11-28 02:44:19 +0000 |
commit | 7da313a2f65e39b86488c21555c356ca3a9100e5 (patch) | |
tree | 391b806058ca43cb3ba624dce63764bce2b9b2b1 /sys/arch | |
parent | 37778efb0de37bd00e9269e32ac772f743cce430 (diff) |
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@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/mac68k/dev/if_mc.c | 29 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/if_sn.c | 30 | ||||
-rw-r--r-- | sys/arch/macppc/dev/if_bm.c | 29 | ||||
-rw-r--r-- | sys/arch/macppc/dev/if_mc.c | 26 | ||||
-rw-r--r-- | sys/arch/mvme68k/dev/if_ie.c | 26 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/if_ie.c | 26 | ||||
-rw-r--r-- | sys/arch/sgi/dev/if_mec.c | 31 | ||||
-rw-r--r-- | sys/arch/socppc/dev/if_tsec.c | 28 | ||||
-rw-r--r-- | sys/arch/sparc/dev/be.c | 25 | ||||
-rw-r--r-- | sys/arch/sparc/dev/hme.c | 25 | ||||
-rw-r--r-- | sys/arch/sparc/dev/if_ie.c | 26 | ||||
-rw-r--r-- | sys/arch/sparc/dev/qe.c | 25 | ||||
-rw-r--r-- | sys/arch/vax/bi/if_ni.c | 29 | ||||
-rw-r--r-- | sys/arch/vax/if/if_qe.c | 28 | ||||
-rw-r--r-- | sys/arch/vax/if/sgec.c | 33 |
15 files changed, 114 insertions, 302 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); } |