Subject: Re: 80211 scan issue.
To: Sean Boudreau <seanb@qnx.com>
From: Sam Leffler <sam@errno.com>
List: tech-net
Date: 05/03/2006 09:36:51
Sean Boudreau wrote:
> Hi:
> 
> I'm seeing an issue when scanning for APs where
> they are not all reported when found.  This
> occurs when management frames are received during
> the scan of the last channel.  When the WI_RID_READ_APS
> ioctl is processed, ieee80211_iterate_nodes() ignores
> those APs since the scangen number matches.  It looks 
> like FreeBSD has seen this as well.  The following
> is from their 1.72 of ieee80211_node.c:
> 
> 
> Index: net80211/ieee80211_node.c
> ===================================================================
> RCS file: /cvsroot/src/sys/net80211/ieee80211_node.c,v
> retrieving revision 1.55
> diff -c -r1.55 ieee80211_node.c
> *** net80211/ieee80211_node.c	28 Mar 2006 00:48:10 -0000	1.55
> --- net80211/ieee80211_node.c	3 May 2006 16:19:55 -0000
> ***************
> *** 1874,1880 ****
>   	isadhoc = (ic->ic_opmode == IEEE80211_M_IBSS ||
>   		   ic->ic_opmode == IEEE80211_M_AHDEMO);
>   	IEEE80211_SCAN_LOCK(nt);
> ! 	gen = nt->nt_scangen++;
>   	IEEE80211_DPRINTF(ic, IEEE80211_MSG_NODE,
>   		"%s: %s scangen %u\n", __func__, nt->nt_name, gen);
>   restart:
> --- 1874,1880 ----
>   	isadhoc = (ic->ic_opmode == IEEE80211_M_IBSS ||
>   		   ic->ic_opmode == IEEE80211_M_AHDEMO);
>   	IEEE80211_SCAN_LOCK(nt);
> ! 	gen = ++nt->nt_scangen;
>   	IEEE80211_DPRINTF(ic, IEEE80211_MSG_NODE,
>   		"%s: %s scangen %u\n", __func__, nt->nt_name, gen);
>   restart:
> ***************
> *** 2018,2024 ****
>   	u_int gen;
>   
>   	IEEE80211_SCAN_LOCK(nt);
> ! 	gen = nt->nt_scangen++;
>   restart:
>   	IEEE80211_NODE_LOCK(nt);
>   	TAILQ_FOREACH(ni, &nt->nt_node, ni_list) {
> --- 2018,2024 ----
>   	u_int gen;
>   
>   	IEEE80211_SCAN_LOCK(nt);
> ! 	gen = ++nt->nt_scangen;
>   restart:
>   	IEEE80211_NODE_LOCK(nt);
>   	TAILQ_FOREACH(ni, &nt->nt_node, ni_list) {
> 
> 

Not sure how this relates to receiving frames on the last channel but 
this change was to deal with entries in the scan table being assigned an 
initial scangen of 0 which caused the first request for the scan results 
to return nothing (for the reason you described).  It is a safe change 
and was one I've been meaning to bring over from freebsd.

	Sam