Author: avos
Date: Thu Mar  3 20:06:16 2016
New Revision: 296356
URL: https://svnweb.freebsd.org/changeset/base/296356

Log:
  zyd, run, ural: do not corrupt MAC address
  
  Do not use ic_macaddr as a storage for current BSSID;
  it may be reused in vap creation procedure;
  similar to r288619.
  
  Approved by:  adrian (mentor)
  Differential Revision:        https://reviews.freebsd.org/D5513

Modified:
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/usb/wlan/if_runvar.h
  head/sys/dev/usb/wlan/if_ural.c
  head/sys/dev/usb/wlan/if_uralvar.h
  head/sys/dev/usb/wlan/if_zyd.c
  head/sys/dev/usb/wlan/if_zydreg.h

Modified: head/sys/dev/usb/wlan/if_run.c
==============================================================================
--- head/sys/dev/usb/wlan/if_run.c      Thu Mar  3 19:53:46 2016        
(r296355)
+++ head/sys/dev/usb/wlan/if_run.c      Thu Mar  3 20:06:16 2016        
(r296356)
@@ -2141,8 +2141,8 @@ run_newstate(struct ieee80211vap *vap, e
                        run_set_txpreamble(sc);
                        run_set_basicrates(sc);
                        ni = ieee80211_ref_node(vap->iv_bss);
-                       IEEE80211_ADDR_COPY(ic->ic_macaddr, ni->ni_bssid);
-                       run_set_bssid(sc, ni->ni_bssid);
+                       IEEE80211_ADDR_COPY(sc->sc_bssid, ni->ni_bssid);
+                       run_set_bssid(sc, sc->sc_bssid);
                        ieee80211_free_node(ni);
                        run_enable_tsf_sync(sc);
 
@@ -4811,8 +4811,7 @@ run_scan_end(struct ieee80211com *ic)
        RUN_LOCK(sc);
 
        run_enable_tsf_sync(sc);
-       /* XXX keep local copy */
-       run_set_bssid(sc, ic->ic_macaddr);
+       run_set_bssid(sc, sc->sc_bssid);
 
        RUN_UNLOCK(sc);
 

Modified: head/sys/dev/usb/wlan/if_runvar.h
==============================================================================
--- head/sys/dev/usb/wlan/if_runvar.h   Thu Mar  3 19:53:46 2016        
(r296355)
+++ head/sys/dev/usb/wlan/if_runvar.h   Thu Mar  3 20:06:16 2016        
(r296356)
@@ -248,6 +248,8 @@ struct run_softc {
        uint8_t                         rvp_bmap;
        uint8_t                         sc_detached;
 
+       uint8_t                         sc_bssid[IEEE80211_ADDR_LEN];
+
        union {
                struct run_rx_radiotap_header th;
                uint8_t pad[64];

Modified: head/sys/dev/usb/wlan/if_ural.c
==============================================================================
--- head/sys/dev/usb/wlan/if_ural.c     Thu Mar  3 19:53:46 2016        
(r296355)
+++ head/sys/dev/usb/wlan/if_ural.c     Thu Mar  3 20:06:16 2016        
(r296356)
@@ -706,8 +706,8 @@ ural_newstate(struct ieee80211vap *vap, 
                        ural_update_slot(sc);
                        ural_set_txpreamble(sc);
                        ural_set_basicrates(sc, ic->ic_bsschan);
-                       IEEE80211_ADDR_COPY(ic->ic_macaddr, ni->ni_bssid);
-                       ural_set_bssid(sc, ic->ic_macaddr);
+                       IEEE80211_ADDR_COPY(sc->sc_bssid, ni->ni_bssid);
+                       ural_set_bssid(sc, sc->sc_bssid);
                }
 
                if (vap->iv_opmode == IEEE80211_M_HOSTAP ||
@@ -1582,7 +1582,7 @@ ural_scan_end(struct ieee80211com *ic)
 
        RAL_LOCK(sc);
        ural_enable_tsf_sync(sc);
-       ural_set_bssid(sc, ic->ic_macaddr);
+       ural_set_bssid(sc, sc->sc_bssid);
        RAL_UNLOCK(sc);
 
 }

Modified: head/sys/dev/usb/wlan/if_uralvar.h
==============================================================================
--- head/sys/dev/usb/wlan/if_uralvar.h  Thu Mar  3 19:53:46 2016        
(r296355)
+++ head/sys/dev/usb/wlan/if_uralvar.h  Thu Mar  3 20:06:16 2016        
(r296356)
@@ -97,7 +97,7 @@ struct ural_softc {
        uint32_t                        asic_rev;
        uint8_t                         rf_rev;
 
-       struct usb_xfer         *sc_xfer[URAL_N_TRANSFER];
+       struct usb_xfer                 *sc_xfer[URAL_N_TRANSFER];
 
        struct ural_tx_data             tx_data[RAL_TX_LIST_COUNT];
        ural_txdhead                    tx_q;
@@ -113,6 +113,8 @@ struct ural_softc {
        u_int                           sc_detached:1,
                                        sc_running:1;
 
+       uint8_t                         sc_bssid[IEEE80211_ADDR_LEN];
+
        struct {
                uint8_t                 val;
                uint8_t                 reg;

Modified: head/sys/dev/usb/wlan/if_zyd.c
==============================================================================
--- head/sys/dev/usb/wlan/if_zyd.c      Thu Mar  3 19:53:46 2016        
(r296355)
+++ head/sys/dev/usb/wlan/if_zyd.c      Thu Mar  3 20:06:16 2016        
(r296356)
@@ -609,8 +609,8 @@ zyd_newstate(struct ieee80211vap *vap, e
                /* make data LED blink upon Tx */
                zyd_write32_m(sc, sc->sc_fwbase + ZYD_FW_LINK_STATUS, 1);
 
-               IEEE80211_ADDR_COPY(ic->ic_macaddr, vap->iv_bss->ni_bssid);
-               zyd_set_bssid(sc, ic->ic_macaddr);
+               IEEE80211_ADDR_COPY(sc->sc_bssid, vap->iv_bss->ni_bssid);
+               zyd_set_bssid(sc, sc->sc_bssid);
                break;
        default:
                break;
@@ -2860,7 +2860,7 @@ zyd_scan_end(struct ieee80211com *ic)
 
        ZYD_LOCK(sc);
        /* restore previous bssid */
-       zyd_set_bssid(sc, ic->ic_macaddr);
+       zyd_set_bssid(sc, sc->sc_bssid);
        ZYD_UNLOCK(sc);
 }
 

Modified: head/sys/dev/usb/wlan/if_zydreg.h
==============================================================================
--- head/sys/dev/usb/wlan/if_zydreg.h   Thu Mar  3 19:53:46 2016        
(r296355)
+++ head/sys/dev/usb/wlan/if_zydreg.h   Thu Mar  3 20:06:16 2016        
(r296356)
@@ -1291,6 +1291,7 @@ struct zyd_softc {
        uint8_t                 sc_ofdm36_cal[14];
        uint8_t                 sc_ofdm48_cal[14];
        uint8_t                 sc_ofdm54_cal[14];
+       uint8_t                 sc_bssid[IEEE80211_ADDR_LEN];
 
        struct mtx              sc_mtx;
        struct zyd_tx_data      tx_data[ZYD_TX_LIST_CNT];
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to