On Tue, Apr 05, 2016 at 09:29:11PM +0000, Andriy Voskoboinyk wrote:
A> Author: avos
A> Date: Tue Apr  5 21:29:11 2016
A> New Revision: 297592
A> URL: https://svnweb.freebsd.org/changeset/base/297592
A> 
A> Log:
A>   net80211: copy MAC address into iv_myaddr[] instead of aliasing it.
A>   
A>   Since IF_LLADDR() returns a non-constant pointer to the MAC address
A>   preserve a copy of it in iv_myaddr.
A>   
A>   PR:                208505

This is actually a bug of ifnet layer, not of ieee80211. So this fix is
a workaround.

You are welcome to try to improve the situation with ifnet :) Meanwhile,
can you please put a comment into 'struct ieee80211vap' declaration:

/*
 * XXX: we copy the address, since address returned by IF_LLADDR() isn't
 * constant. See PR 208505.
 */

A> Modified:
A>   head/sys/net80211/ieee80211.c
A>   head/sys/net80211/ieee80211_var.h
A> 
A> Modified: head/sys/net80211/ieee80211.c
A> 
==============================================================================
A> --- head/sys/net80211/ieee80211.c    Tue Apr  5 21:12:03 2016        
(r297591)
A> +++ head/sys/net80211/ieee80211.c    Tue Apr  5 21:29:11 2016        
(r297592)
A> @@ -483,7 +483,7 @@ ieee80211_vap_setup(struct ieee80211com 
A>      vap->iv_htextcaps = ic->ic_htextcaps;
A>      vap->iv_opmode = opmode;
A>      vap->iv_caps |= ieee80211_opcap[opmode];
A> -    vap->iv_myaddr = ic->ic_macaddr;
A> +    IEEE80211_ADDR_COPY(vap->iv_myaddr, ic->ic_macaddr);
A>      switch (opmode) {
A>      case IEEE80211_M_WDS:
A>              /*
A> @@ -603,7 +603,7 @@ ieee80211_vap_attach(struct ieee80211vap
A>              ifp->if_baudrate = IF_Mbps(maxrate);
A>  
A>      ether_ifattach(ifp, macaddr);
A> -    vap->iv_myaddr = IF_LLADDR(ifp);
A> +    IEEE80211_ADDR_COPY(vap->iv_myaddr, IF_LLADDR(ifp));
A>      /* hook output method setup by ether_ifattach */
A>      vap->iv_output = ifp->if_output;
A>      ifp->if_output = ieee80211_output;
A> 
A> Modified: head/sys/net80211/ieee80211_var.h
A> 
==============================================================================
A> --- head/sys/net80211/ieee80211_var.h        Tue Apr  5 21:12:03 2016        
(r297591)
A> +++ head/sys/net80211/ieee80211_var.h        Tue Apr  5 21:29:11 2016        
(r297592)
A> @@ -362,7 +362,8 @@ struct ieee80211vap {
A>  
A>      TAILQ_ENTRY(ieee80211vap) iv_next;      /* list of vap instances */
A>      struct ieee80211com     *iv_ic;         /* back ptr to common state */
A> -    const uint8_t           *iv_myaddr;     /* MAC address: ifp or ic */
A> +    /* MAC address: ifp or ic */
A> +    uint8_t                 iv_myaddr[IEEE80211_ADDR_LEN];
A>      uint32_t                iv_debug;       /* debug msg flags */
A>      struct ieee80211_stats  iv_stats;       /* statistics */
A>  
A> _______________________________________________
A> svn-src-...@freebsd.org mailing list
A> https://lists.freebsd.org/mailman/listinfo/svn-src-all
A> To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

-- 
Totus tuus, Glebius.
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to