if_run in hostap mode: issue with stations in the power save mode

Alexander Zagrebin alex at zagrebin.ru
Fri Feb 4 22:33:43 UTC 2011


Hi!

On 04.02.2011 09:51:34 +0100, Bernhard Schmidt wrote:

> On Friday 04 February 2011 07:08:08 Alexander Zagrebin wrote:
> > I'm using an Ralink RT2870 based adapter (run(4) driver) in the
> > hostap mode. and I've noticed that if_run doesn't support stations
> > working in the power save mode (PSM). The reason is in lack of the
> > TIM in beacons. The attached patch adds this functionality and
> > completely fixes this issue. Despite the fact that patch is working,
> > it seems that it needs an additional work. For example, now the
> > result of ieee80211_beacon_update is ignored with a corresponding
> > message, but may be necessary to process it...
> > 
> > Can somebody review it?
> 
> That looks about right, good catch!
> 
> Handling ieee80211_beacon_update()'s return value doesn't seem to be 
> necessary, the mbuf's length is handled in the next few lines of code 
> anyways, doesn't matter if it changed or not.
> 
> Though, I have a some doubts about just restoring bo_flags is enough 
> (Can't prove that with some obvious code, still..). It feels saner to me 
> if we just reuse the whole mbuf, similar to what ath(4) does. Can you 
> look at attached patch? Completely untested, so I'm not sure what does 
> happen on e.g. changing the SSID.

I've tried the slightly modified version of your patch (see attached files),
and found that it is working too. Moreover, it looks more safe.
For example, suppose we need update the beacon due to a new TIM.
Immediately after updating, but before the beacon with a TIM will be
transmitted, we need update the beacon again for any other reason. With
the first version of the patch the beacon will completely recreated, so
a TIM will be lost. But if we are using the second version of the patch,
then TIM will be preserved.

I had the doubts about ability to change or hide/unhide the SSID, but it
works too. It seems that after `ifconfig wlan0 ssid ...` or `ifconfig wlan0
(hidessid|-hidessid)` the following occurs:
1. run_newstate() is called
2. run_newstate() invokes run_update_beacon_cb()
3. run_update_beacon_cb() invokes ieee80211_beacon_update()
But I couldn't understand where ieee80211_beacon_update() can change a SSID...

-- 
Alexander Zagrebin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-if_run.c
Type: text/x-patch
Size: 1758 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20110204/2f592abe/patch-if_run.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-if_runvar.h
Type: text/x-patch
Size: 450 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20110204/2f592abe/patch-if_runvar.bin


More information about the freebsd-net mailing list