diff options
| author | Gleb Smirnoff <glebius@FreeBSD.org> | 2019-10-14 20:31:28 +0000 |
|---|---|---|
| committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2019-10-14 20:31:28 +0000 |
| commit | 2a5f6131884e963a913f5a4ec3a18fc157ad28cc (patch) | |
| tree | f582da716c659d477d87af1c472f55faddafd35e /sys/dev/usb/net | |
| parent | f8ef073e227f371b2365d2cd28fe0174458e4911 (diff) | |
Notes
Diffstat (limited to 'sys/dev/usb/net')
| -rw-r--r-- | sys/dev/usb/net/if_kue.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/sys/dev/usb/net/if_kue.c b/sys/dev/usb/net/if_kue.c index 05d39e566fd8b..82458a4612bc3 100644 --- a/sys/dev/usb/net/if_kue.c +++ b/sys/dev/usb/net/if_kue.c @@ -357,13 +357,25 @@ kue_setpromisc(struct usb_ether *ue) kue_setword(sc, KUE_CMD_SET_PKT_FILTER, sc->sc_rxfilt); } +static u_int +kue_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct kue_softc *sc = arg; + + if (cnt >= KUE_MCFILTCNT(sc)) + return (1); + + memcpy(KUE_MCFILT(sc, cnt), LLADDR(sdl), ETHER_ADDR_LEN); + + return (1); +} + static void kue_setmulti(struct usb_ether *ue) { struct kue_softc *sc = uether_getsc(ue); struct ifnet *ifp = uether_getifp(ue); - struct ifmultiaddr *ifma; - int i = 0; + int i; KUE_LOCK_ASSERT(sc, MA_OWNED); @@ -376,25 +388,9 @@ kue_setmulti(struct usb_ether *ue) sc->sc_rxfilt &= ~KUE_RXFILT_ALLMULTI; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) - { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - /* - * If there are too many addresses for the - * internal filter, switch over to allmulti mode. - */ - if (i == KUE_MCFILTCNT(sc)) - break; - memcpy(KUE_MCFILT(sc, i), - LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - ETHER_ADDR_LEN); - i++; - } - if_maddr_runlock(ifp); + i = if_foreach_llmaddr(ifp, kue_copy_maddr, sc); - if (i == KUE_MCFILTCNT(sc)) + if (i >= KUE_MCFILTCNT(sc)) sc->sc_rxfilt |= KUE_RXFILT_ALLMULTI; else { sc->sc_rxfilt |= KUE_RXFILT_MULTICAST; |
