Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic In wi_newstate(), read the BSSID into a temporary...



details:   https://anonhg.NetBSD.org/src/rev/76e1b6e72a86
branches:  trunk
changeset: 554060:76e1b6e72a86
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Fri Oct 24 23:58:22 2003 +0000

description:
In wi_newstate(), read the BSSID into a temporary buffer that has guaranteed
alignment.  Fixes a really obscure failure mode on Alpha, and panics on other
machines.

diffstat:

 sys/dev/ic/wi.c    |  15 ++++++++-------
 sys/dev/ic/wireg.h |   9 ++++++---
 2 files changed, 14 insertions(+), 10 deletions(-)

diffs (75 lines):

diff -r f9ef0c3028a8 -r 76e1b6e72a86 sys/dev/ic/wi.c
--- a/sys/dev/ic/wi.c   Fri Oct 24 23:52:00 2003 +0000
+++ b/sys/dev/ic/wi.c   Fri Oct 24 23:58:22 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wi.c,v 1.137 2003/10/19 22:00:54 dyoung Exp $  */
+/*     $NetBSD: wi.c,v 1.138 2003/10/24 23:58:22 mycroft Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.137 2003/10/19 22:00:54 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.138 2003/10/24 23:58:22 mycroft Exp $");
 
 #define WI_HERMES_AUTOINC_WAR  /* Work around data write autoinc bug. */
 #define WI_HERMES_STATS_WAR    /* Work around stats counter bug. */
@@ -2334,7 +2334,7 @@
        int buflen;
        u_int16_t val;
        struct wi_ssid ssid;
-       u_int8_t old_bssid[IEEE80211_ADDR_LEN];
+       struct wi_macaddr bssid, old_bssid;
        enum ieee80211_state ostate;
 #ifdef WI_DEBUG
        static const char *stname[] =
@@ -2353,9 +2353,10 @@
        case IEEE80211_S_RUN:
                sc->sc_flags &= ~WI_FLAGS_OUTRANGE;
                buflen = IEEE80211_ADDR_LEN;
-               IEEE80211_ADDR_COPY(old_bssid, ni->ni_bssid);
-               wi_read_rid(sc, WI_RID_CURRENT_BSSID, ni->ni_bssid, &buflen);
-               IEEE80211_ADDR_COPY(ni->ni_macaddr, ni->ni_bssid);
+               IEEE80211_ADDR_COPY(old_bssid.wi_mac_addr, ni->ni_bssid);
+               wi_read_rid(sc, WI_RID_CURRENT_BSSID, &bssid, &buflen);
+               IEEE80211_ADDR_COPY(ni->ni_bssid, &bssid);
+               IEEE80211_ADDR_COPY(ni->ni_macaddr, &bssid);
                buflen = sizeof(val);
                wi_read_rid(sc, WI_RID_CURRENT_CHAN, &val, &buflen);
                if (!isset(ic->ic_chan_avail, le16toh(val)))
@@ -2363,7 +2364,7 @@
                            le16toh(val));
                ni->ni_chan = &ic->ic_channels[le16toh(val)];
 
-               if (IEEE80211_ADDR_EQ(old_bssid, ni->ni_bssid))
+               if (IEEE80211_ADDR_EQ(old_bssid.wi_mac_addr, ni->ni_bssid))
                        sc->sc_false_syns++;
                else
                        sc->sc_false_syns = 0;
diff -r f9ef0c3028a8 -r 76e1b6e72a86 sys/dev/ic/wireg.h
--- a/sys/dev/ic/wireg.h        Fri Oct 24 23:52:00 2003 +0000
+++ b/sys/dev/ic/wireg.h        Fri Oct 24 23:58:22 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wireg.h,v 1.46 2003/10/16 10:57:35 dyoung Exp $        */
+/*     $NetBSD: wireg.h,v 1.47 2003/10/24 23:58:22 mycroft Exp $       */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -409,10 +409,13 @@
 #define        WI_PORTTYPE_HOSTAP      0x6
 
 /*
- * Mac addresses. (0xFC01, 0xFC08)
+ * Mac addresses. (0xFC01, 0xFC08, 0xFD42)
  */
 struct wi_macaddr {
-       u_int8_t                wi_mac_addr[6];
+       union {
+               u_int16_t       wi_mac_addr_aligned[3];
+               u_int8_t        wi_mac_addr[6];
+       };
 };
 
 /*



Home | Main Index | Thread Index | Old Index