diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2013-11-27 08:56:32 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2013-11-27 08:56:32 +0000 |
commit | d70b558eaecf6823288e17f5683065768969bdad (patch) | |
tree | b98894a95e829c95bc340d7b1b383debc1a5a540 /sys | |
parent | 6cdb5c8b6ea31a7a272ec3e4207a0fe258f8e4c6 (diff) |
Instead of comparing the lower and higher addresses of all the multicast
entries to decide if the IFF_ALLMULTI flag should be set, check if there
is at least one real range between them.
This should not change the behavior of any driver but if you encounter
any problem, feel free to revert the offending chunk and ping me about
it.
ok naddy@, dlg@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/mvme68k/dev/if_ie.c | 18 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/if_ie.c | 18 | ||||
-rw-r--r-- | sys/arch/sparc/dev/be.c | 24 | ||||
-rw-r--r-- | sys/arch/sparc/dev/if_ie.c | 18 | ||||
-rw-r--r-- | sys/arch/sparc/dev/qe.c | 22 | ||||
-rw-r--r-- | sys/arch/vax/if/if_qe.c | 19 | ||||
-rw-r--r-- | sys/arch/vax/if/sgec.c | 18 |
7 files changed, 67 insertions, 70 deletions
diff --git a/sys/arch/mvme68k/dev/if_ie.c b/sys/arch/mvme68k/dev/if_ie.c index bbeb3fda705..e0cfceadd0a 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.41 2013/09/05 20:55:57 bluhm Exp $ */ +/* $OpenBSD: if_ie.c,v 1.42 2013/11/27 08:56:31 mpi Exp $ */ /*- * Copyright (c) 1999 Steve Murphree, Jr. @@ -1870,19 +1870,25 @@ void mc_reset(sc) struct ie_softc *sc; { + struct arpcom *ac = sc->sc_arpcom; struct ether_multi *enm; struct ether_multistep step; + if (ac->ac_multirangecnt > 0) { + ac->ac_if.if_flags |= IFF_ALLMULTI; + ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0); + goto setflag; + } + /* * Step through the list of addresses. */ sc->mcast_count = 0; - ETHER_FIRST_MULTI(step, &sc->sc_arpcom, enm); + ETHER_FIRST_MULTI(step, ac, enm); while (enm) { - if (sc->mcast_count >= MAXMCAST || - bcmp(enm->enm_addrlo, enm->enm_addrhi, 6) != 0) { - sc->sc_arpcom.ac_if.if_flags |= IFF_ALLMULTI; - ieioctl(&sc->sc_arpcom.ac_if, SIOCSIFFLAGS, (void *)0); + if (sc->mcast_count >= MAXMCAST) { + ac->ac_if.if_flags |= IFF_ALLMULTI; + ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0); goto setflag; } diff --git a/sys/arch/mvme88k/dev/if_ie.c b/sys/arch/mvme88k/dev/if_ie.c index 2084d6c9348..a1935773a94 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.46 2013/09/05 20:55:57 bluhm Exp $ */ +/* $OpenBSD: if_ie.c,v 1.47 2013/11/27 08:56:31 mpi Exp $ */ /*- * Copyright (c) 1998 Steve Murphree, Jr. @@ -1857,19 +1857,25 @@ void mc_reset(sc) struct ie_softc *sc; { + struct arpcom *ac = sc->sc_arpcom; struct ether_multi *enm; struct ether_multistep step; + if (ac->ac_multirangecnt > 0) { + ac->ac_if.if_flags |= IFF_ALLMULTI; + ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0); + goto setflag; + } + /* * Step through the list of addresses. */ sc->mcast_count = 0; - ETHER_FIRST_MULTI(step, &sc->sc_arpcom, enm); + ETHER_FIRST_MULTI(step, ac, enm); while (enm) { - if (sc->mcast_count >= MAXMCAST || - bcmp(enm->enm_addrlo, enm->enm_addrhi, 6) != 0) { - sc->sc_arpcom.ac_if.if_flags |= IFF_ALLMULTI; - ieioctl(&sc->sc_arpcom.ac_if, SIOCSIFFLAGS, (void *)0); + if (sc->mcast_count >= MAXMCAST) { + ac->ac_if.if_flags |= IFF_ALLMULTI; + ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0); goto setflag; } diff --git a/sys/arch/sparc/dev/be.c b/sys/arch/sparc/dev/be.c index b9574463bb3..7a28147cd6e 100644 --- a/sys/arch/sparc/dev/be.c +++ b/sys/arch/sparc/dev/be.c @@ -1,4 +1,4 @@ -/* $OpenBSD: be.c,v 1.44 2013/09/05 20:55:58 bluhm Exp $ */ +/* $OpenBSD: be.c,v 1.45 2013/11/27 08:56:31 mpi Exp $ */ /* * Copyright (c) 1998 Theo de Raadt and Jason L. Wright. @@ -1158,6 +1158,9 @@ be_mcreset(sc) else br->rx_cfg &= ~BE_BR_RXCFG_PMISC; + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI) { br->htable3 = 0xffff; br->htable2 = 0xffff; @@ -1170,25 +1173,6 @@ be_mcreset(sc) ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - /* - * We must listen to a range of multicast - * addresses. For now, just accept all - * multicasts, rather than trying to set only - * those filter bits needed to match the range. - * (At this time, the only use of address - * ranges is for IP multicast routing, for - * which the range is big enough to require - * all bits set.) - */ - br->htable3 = 0xffff; - br->htable2 = 0xffff; - br->htable1 = 0xffff; - br->htable0 = 0xffff; - ifp->if_flags |= IFF_ALLMULTI; - return; - } - crc = 0xffffffff; for (i = 0; i < ETHER_ADDR_LEN; i++) { diff --git a/sys/arch/sparc/dev/if_ie.c b/sys/arch/sparc/dev/if_ie.c index 95977853445..5423a8edfcf 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.43 2013/09/05 20:55:58 bluhm Exp $ */ +/* $OpenBSD: if_ie.c,v 1.44 2013/11/27 08:56:31 mpi Exp $ */ /* $NetBSD: if_ie.c,v 1.33 1997/07/29 17:55:38 fair Exp $ */ /*- @@ -2017,19 +2017,25 @@ static void mc_reset(sc) struct ie_softc *sc; { + struct arpcom *ac = sc->sc_arpcom; struct ether_multi *enm; struct ether_multistep step; + if (ac->ac_multirangecnt > 0) { + ac->ac_if.if_flags |= IFF_ALLMULTI; + ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0); + goto setflag; + } + /* * Step through the list of addresses. */ sc->mcast_count = 0; - ETHER_FIRST_MULTI(step, &sc->sc_arpcom, enm); + ETHER_FIRST_MULTI(step, ac, enm); while (enm) { - if (sc->mcast_count >= MAXMCAST || - bcmp(enm->enm_addrlo, enm->enm_addrhi, 6) != 0) { - sc->sc_arpcom.ac_if.if_flags |= IFF_ALLMULTI; - ieioctl(&sc->sc_arpcom.ac_if, SIOCSIFFLAGS, (void *)0); + if (sc->mcast_count >= MAXMCAST) { + ac->ac_if.if_flags |= IFF_ALLMULTI; + ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0); goto setflag; } diff --git a/sys/arch/sparc/dev/qe.c b/sys/arch/sparc/dev/qe.c index 4c15756fd0c..e00ae00e460 100644 --- a/sys/arch/sparc/dev/qe.c +++ b/sys/arch/sparc/dev/qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qe.c,v 1.34 2013/09/05 20:55:58 bluhm Exp $ */ +/* $OpenBSD: qe.c,v 1.35 2013/11/27 08:56:31 mpi Exp $ */ /* * Copyright (c) 1998, 2000 Jason L. Wright. @@ -805,7 +805,9 @@ qe_mcreset(sc) u_int8_t octet, *ladrp = (u_int8_t *)&hash[0]; int i, j; -allmulti: + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI) { mr->iac = QE_MR_IAC_ADDRCHG | QE_MR_IAC_LOGADDR; for (i = 100; i > 0; i--) { @@ -822,22 +824,6 @@ allmulti: ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, - ETHER_ADDR_LEN)) { - /* - * We must listen to a range of multicast - * addresses. For now, just accept all - * multicasts, rather than trying to set only - * those filter bits needed to match the range. - * (At this time, the only use of address - * ranges is for IP multicast routing, for - * which the range is big enough to require - * all bits set.) - */ - ifp->if_flags |= IFF_ALLMULTI; - goto allmulti; - } - crc = 0xffffffff; for (i = 0; i < ETHER_ADDR_LEN; i++) { diff --git a/sys/arch/vax/if/if_qe.c b/sys/arch/vax/if/if_qe.c index 7d815f78543..105ae1d0609 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.25 2010/09/20 06:33:47 matthew Exp $ */ +/* $OpenBSD: if_qe.c,v 1.26 2013/11/27 08:56:31 mpi 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. @@ -747,7 +747,8 @@ qe_setup(struct qe_softc *sc) struct ether_multistep step; struct qe_cdata *qc = sc->sc_qedata; struct ifnet *ifp = &sc->sc_if; - u_int8_t *enaddr = sc->sc_ac.ac_enaddr; + struct arpcom *ac = &sc->sc_ac; + u_int8_t *enaddr = ac->ac_enaddr; int i, j, k, idx, s; s = splnet(); @@ -770,12 +771,14 @@ qe_setup(struct qe_softc *sc) */ j = 3; k = 0; ifp->if_flags &= ~IFF_ALLMULTI; - ETHER_FIRST_MULTI(step, &sc->sc_ac, enm); + + if (ac->ac_multirangecnt > 0) { + ifp->if_flags |= IFF_ALLMULTI; + goto setit; + } + + ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (memcmp(enm->enm_addrlo, enm->enm_addrhi, 6)) { - ifp->if_flags |= IFF_ALLMULTI; - break; - } for (i = 0; i < ETHER_ADDR_LEN; i++) qc->qc_setup[i * 8 + j + k] = enm->enm_addrlo[i]; j++; @@ -788,6 +791,8 @@ qe_setup(struct qe_softc *sc) } ETHER_NEXT_MULTI(step, enm); } + +setit: idx = sc->sc_nexttx; qc->qc_xmit[idx].qe_buf_len = -64; diff --git a/sys/arch/vax/if/sgec.c b/sys/arch/vax/if/sgec.c index 11abaa67089..88d6a649432 100644 --- a/sys/arch/vax/if/sgec.c +++ b/sys/arch/vax/if/sgec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sgec.c,v 1.20 2011/09/26 21:44:04 miod Exp $ */ +/* $OpenBSD: sgec.c,v 1.21 2013/11/27 08:56:31 mpi 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. @@ -767,7 +767,8 @@ ze_setup(sc) struct ether_multistep step; struct ze_cdata *zc = sc->sc_zedata; struct ifnet *ifp = &sc->sc_if; - u_int8_t *enaddr = sc->sc_ac.ac_enaddr; + struct arpcom *ac = &sc->sc_ac; + u_int8_t *enaddr = ac->ac_enaddr; int j, idx, s, reg; s = splnet(); @@ -790,12 +791,14 @@ ze_setup(sc) */ j = 16; ifp->if_flags &= ~IFF_ALLMULTI; - ETHER_FIRST_MULTI(step, &sc->sc_ac, enm); + + if (ac->ac_multirangecnt > 0) { + ifp->if_flags |= IFF_ALLMULTI; + goto setit; + } + + ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, 6)) { - ifp->if_flags |= IFF_ALLMULTI; - break; - } bcopy(enm->enm_addrlo, &zc->zc_setup[j], ETHER_ADDR_LEN); j += 8; ETHER_NEXT_MULTI(step, enm); @@ -805,6 +808,7 @@ ze_setup(sc) } } +setit: /* * Fiddle with the receive logic. */ |