Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Bug fix: use the MAC that the firmware tells us, ...



details:   https://anonhg.NetBSD.org/src/rev/f66454312e0b
branches:  trunk
changeset: 573878:f66454312e0b
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Sun Feb 13 07:33:06 2005 +0000

description:
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.)

diffstat:

 sys/dev/ic/wi.c |  17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diffs (42 lines):

diff -r 438bd5d42cc7 -r f66454312e0b sys/dev/ic/wi.c
--- a/sys/dev/ic/wi.c   Sun Feb 13 07:05:03 2005 +0000
+++ b/sys/dev/ic/wi.c   Sun Feb 13 07:33:06 2005 +0000
@@ -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 @@
                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));
 



Home | Main Index | Thread Index | Old Index