[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Zebra/ospf multicast problem



Petter Lindquist <petter_(_at_)_hig_(_dot_)_se> wrote:

> OpenBSD 3.4 on i386 generic kernel, "em" gigabit ethernet.

Due to an oversight, multicast reception is never enabled for em(4).
Patch below.  May not be completely right, but it works for me.

Looking at the driver, I suspect multicast reception is also broken
for bge(4), but I haven't found anybody yet who can test this.

Index: dev/pci/if_em.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_em.c,v
retrieving revision 1.13
diff -u -r1.13 if_em.c
--- dev/pci/if_em.c	13 Oct 2003 21:19:29 -0000	1.13
+++ dev/pci/if_em.c	28 Oct 2003 21:10:49 -0000
@@ -1325,13 +1325,11 @@
 {
 	u_int32_t reg_rctl = 0;
 	u_int8_t  mta[MAX_NUM_MULTICAST_ADDRESSES * ETH_LENGTH_OF_ADDRESS];
-#ifdef __FreeBSD__
-	struct ifmultiaddr  *ifma;
-#endif
+	struct arpcom *ac = &sc->interface_data;
+	struct ether_multi *enm;
+	struct ether_multistep step;
 	int mcnt = 0;
-#ifdef __FreeBSD__
-	struct ifnet   *ifp = &sc->interface_data.ac_if;
-#endif
+	struct ifnet *ifp = &sc->interface_data.ac_if;
 
 	IOCTL_DEBUGOUT("em_set_multi: begin");
 
@@ -1345,22 +1343,19 @@
 		msec_delay(5);
 	}
 
-#ifdef __FreeBSD__
-#if __FreeBSD_version < 500000 
-	LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
-#else
-	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
-#endif
-		if (ifma->ifma_addr->sa_family != AF_LINK)
-			continue;
-
-		if (mcnt == MAX_NUM_MULTICAST_ADDRESSES) break;
-
-		bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
-		      &mta[mcnt*ETH_LENGTH_OF_ADDRESS], ETH_LENGTH_OF_ADDRESS);
+	ETHER_FIRST_MULTI(step, ac, enm);
+	while (enm != NULL) {
+		if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
+			ifp->if_flags |= IFF_ALLMULTI;
+			mcnt = MAX_NUM_MULTICAST_ADDRESSES;
+		}
+		if (mcnt == MAX_NUM_MULTICAST_ADDRESSES)
+			break;
+		bcopy(enm->enm_addrlo, &mta[mcnt*ETH_LENGTH_OF_ADDRESS],
+		      ETH_LENGTH_OF_ADDRESS);
 		mcnt++;
+		ETHER_NEXT_MULTI(step, enm);
 	}
-#endif /* __FreeBSD__ */
 
 	if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES) {
 		reg_rctl = E1000_READ_REG(&sc->hw, RCTL);
-- 
Christian "naddy" Weisgerber                          naddy_(_at_)_mips_(_dot_)_inka_(_dot_)_de