Bug fix: use the MAC that the firmware tells us, resorting to the

CIS MAC only on error.

(NetBSD these days tries to read the MAC address from the PCMCIA
CIS.  Prism cards made by Senao set the MAC in every PCMCIA CIS to
00:02:6f:00:02:15.  In a network of Senao cards, this causes MAC
duplication.)
This commit is contained in:
dyoung 2005-02-13 07:33:06 +00:00
parent 6bad99a279
commit 6e9d895c23
1 changed files with 9 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: wi.c,v 1.194 2005/01/17 01:48:56 dyoung Exp $ */
/* $NetBSD: wi.c,v 1.195 2005/02/13 07:33:06 dyoung Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -106,7 +106,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.194 2005/01/17 01:48:56 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.195 2005/02/13 07:33:06 dyoung Exp $");
#define WI_HERMES_AUTOINC_WAR /* Work around data write autoinc bug. */
#define WI_HERMES_STATS_WAR /* Work around stats counter bug. */
@ -320,16 +320,17 @@ wi_attach(struct wi_softc *sc, const u_int8_t *macaddr)
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));