From 3a2cf682677a24dc0f66604f7d0701f10275a58b Mon Sep 17 00:00:00 2001 From: Stuart Henderson Date: Tue, 25 Aug 2009 11:04:24 +0000 Subject: Don't setup multicast when in promiscuous mode. From Brad. This was in the diff Brad sent to tech@ and had tested by others and should have been in my previous commit, but I was working from and testing an earlier version of the diff. I've retested with multicast/promisc on my dual 82550. --- sys/dev/ic/fxp.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'sys/dev/ic/fxp.c') diff --git a/sys/dev/ic/fxp.c b/sys/dev/ic/fxp.c index 4514d6e3b3e..3250640588c 100644 --- a/sys/dev/ic/fxp.c +++ b/sys/dev/ic/fxp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fxp.c,v 1.98 2009/08/13 21:14:40 sthen Exp $ */ +/* $OpenBSD: fxp.c,v 1.99 2009/08/25 11:04:23 sthen Exp $ */ /* $NetBSD: if_fxp.c,v 1.2 1997/06/05 02:01:55 thorpej Exp $ */ /* @@ -1265,7 +1265,8 @@ fxp_init(void *xsc) cbp->mc_all = allm; #else cbp->cb_command = htole16(FXP_CB_COMMAND_CONFIG | FXP_CB_COMMAND_EL); - if (allm) + + if (allm && !prm) cbp->mc_all |= 0x08; /* accept all multicasts */ else cbp->mc_all &= ~0x08; /* reject all multicasts */ @@ -1706,20 +1707,17 @@ fxp_mc_setup(struct fxp_softc *sc, int doit) struct ether_multi *enm; int i, nmcasts = 0; - /* - * Initialize multicast setup descriptor. - */ - mcsp->cb_status = htole16(0); - mcsp->cb_command = htole16(FXP_CB_COMMAND_MCAS | FXP_CB_COMMAND_EL); - mcsp->link_addr = htole32(-1); + ifp->if_flags &= ~IFF_ALLMULTI; - if (ac->ac_multirangecnt > 0 || ac->ac_multicnt >= MAXMCADDR) + if (ifp->if_flags & IFF_PROMISC || ac->ac_multirangecnt > 0 || + ac->ac_multicnt >= MAXMCADDR) { ifp->if_flags |= IFF_ALLMULTI; - else { + } else { ETHER_FIRST_MULTI(step, &sc->sc_arpcom, enm); while (enm != NULL) { bcopy(enm->enm_addrlo, (void *)&mcsp->mc_addr[nmcasts][0], ETHER_ADDR_LEN); + nmcasts++; ETHER_NEXT_MULTI(step, enm); @@ -1729,6 +1727,12 @@ fxp_mc_setup(struct fxp_softc *sc, int doit) if (doit == 0) return; + /* + * Initialize multicast setup descriptor. + */ + mcsp->cb_status = htole16(0); + mcsp->cb_command = htole16(FXP_CB_COMMAND_MCAS | FXP_CB_COMMAND_EL); + mcsp->link_addr = htole32(-1); mcsp->mc_cnt = htole16(nmcasts * ETHER_ADDR_LEN); /* -- cgit v1.2.3