[CUWiN-Dev] patch: prevent mac duplication

David Young dyoung at pobox.com
Mon Feb 7 14:03:29 CST 2005


NetBSD these days tries to read the MAC address from the PCMCIA CIS.
Senao sets the MAC in every PCMCIA CIS to 00:02:6f:00:02:15.  This is
probably the bug that bit the nodes east of Vine, causing the MAC
duplication.

This patch uses the MAC that the firmware tells us, resorting to the
CIS MAC only on error.

I humbly ask our beleaguered release manager to apply this patch to the
C-U Wireless NetBSD sources.

Dave

-- 
David Young             OJC Technologies
dyoung at ojctech.com      Urbana, IL * (217) 278-3933
-------------- next part --------------
Index: sys/dev/ic/wi.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/wi.c,v
retrieving revision 1.194
diff -u -r1.194 wi.c
--- sys/dev/ic/wi.c	17 Jan 2005 01:48:56 -0000	1.194
+++ sys/dev/ic/wi.c	7 Feb 2005 19:51:31 -0000
@@ -320,16 +320,17 @@
 		return 1;
 	}
 
-	if (!macaddr) {
-		if (wi_read_xrid(sc, WI_RID_MAC_NODE, ic->ic_myaddr,
-		                 IEEE80211_ADDR_LEN) != 0 ||
-		    IEEE80211_ADDR_EQ(ic->ic_myaddr, empty_macaddr)) {
+	if (wi_read_xrid(sc, WI_RID_MAC_NODE, ic->ic_myaddr,
+			 IEEE80211_ADDR_LEN) != 0 ||
+	    IEEE80211_ADDR_EQ(ic->ic_myaddr, empty_macaddr)) {
+		if (macaddr != NULL)
+			memcpy(ic->ic_myaddr, macaddr, IEEE80211_ADDR_LEN);
+		else {
 			printf(" could not get mac address, attach failed\n");
 			splx(s);
 			return 1;
 		}
-	} else
-		memcpy(ic->ic_myaddr, macaddr, IEEE80211_ADDR_LEN);
+	}
 
 	printf(" 802.11 address %s\n", ether_sprintf(ic->ic_myaddr));
 


More information about the CU-Wireless-Dev mailing list