Subject: Re: [802.11] Enabling beacon frames reception in hostap mode
To: David Young <dyoung@pobox.com>
From: None <jacereda@users.sourceforge.net (Jorge Ramon Acereda\>
List: tech-net
Date: 01/20/2004 18:22:11
Hi David, thanks for your response,

David Young <dyoung@pobox.com> writes:
> It looks like you have found a bug in ath(4). I cannot receive beacons
> in hostap mode, either. Monitor mode just crashes the computer (Maybe
> I am using an out-of-date HAL.)

Mine (NETGEAR PCI WG311) seems to work fine in monitor mode. 

> 
> If you could receive the beacons, I am not sure that it will solve
> the problem. Can you explain what you are trying to do with the
> beacons? Locate the other APs?

I want to have several NetBSD machines acting as access points. At the
same time, those machines should be capable of monitoring the signal
strength level of nearby devices, even those associated to other
access point.

What I have done is a program that uses libpcap to put the interface
in monitor mode and capture DLT_IEEE802_11_RADIO packets. With that, I
can get samples of the signal strength, but only when the nearby
devices are under activity (for instance, pinging the access point) or
when the interface is in monitor mode.

If I could get the beacon frames in hostap mode, there would be no
need to have activity in the nearby devices to actually measure the
signal.

Now, I've tried the following and it seems to work, but I've
serious doubts it is The Right Thing :-)


*** ath.c.~1.18.~	Tue Dec 16 16:50:56 2003
--- ath.c	Tue Jan 20 18:14:23 2004
***************
*** 1325,1333 ****
  	if (ic->ic_opmode != IEEE80211_M_HOSTAP &&
  	    (ifp->if_flags & IFF_PROMISC))
  		rfilt |= HAL_RX_FILTER_PROM;
! 	if (ic->ic_opmode == IEEE80211_M_STA ||
  	    ic->ic_opmode == IEEE80211_M_IBSS ||
! 	    ic->ic_state == IEEE80211_S_SCAN)
  		rfilt |= HAL_RX_FILTER_BEACON;
  	return rfilt;
  }
--- 1325,1338 ----
  	if (ic->ic_opmode != IEEE80211_M_HOSTAP &&
  	    (ifp->if_flags & IFF_PROMISC))
  		rfilt |= HAL_RX_FILTER_PROM;
! 	if (
! #if defined ATH_HOSTAP_PROCESS_BEACONS
! 	    ic->ic_opmode == IEEE80211_M_HOSTAP ||
! #endif	    
! 	    ic->ic_opmode == IEEE80211_M_STA ||
  	    ic->ic_opmode == IEEE80211_M_IBSS ||
! 	    ic->ic_state == IEEE80211_S_SCAN
! 	    )
  		rfilt |= HAL_RX_FILTER_BEACON;
  	return rfilt;
  }
***************
*** 1696,1703 ****
--- 1701,1710 ----
  		ath_hal_intrset(ah, 0);
  		ath_hal_beaconinit(ah, ic->ic_opmode,
  			nexttbtt, ni->ni_intval);
+ #if !defined(ATH_HOSTAP_PROCESS_BEACONS)
  		if (ic->ic_opmode != IEEE80211_M_MONITOR)
  			sc->sc_imask |= HAL_INT_SWBA;	/* beacon prepare */
+ #endif // !defined(ATH_HOSTAP_PROCESS_BEACONS)
  		ath_hal_intrset(ah, sc->sc_imask);
  	}
  }