A beacon should never have a Channel Switch Announcement information
element with a count of 0, because a count of 1 means switch just
before the next beacon. So, if a count of 0 was valid in a beacon, it
would have been transmitted in the next channel already, which is
useless. A CSA count equal to zero is only meaningful in action
frames or probe_responses.
Fix the ieee80211_csa_is_complete() and ieee80211_update_csa()
functions accordingly.
Cc: Simon Wunderlich <[email protected]>
Signed-off-by: Luciano Coelho <[email protected]>
---
Hi Simon (et al),
I identified this issue while playing around with CSA. I noticed that
we are sending a CSA beaon with count == 0, which should not happen.
The last beacon visible in the current channel (ie. before the switch)
contains a CSA IE with count == 1.
I wanted to check with you if my proposed change would have any
side-effects, especially with the ath9k driver, which is the only user
of this code in the mainline at the moment.
The potential danger here is if you don't check
ieee80211_csa_is_complete() before you send the first CSA beacon out.
With the previous code, there would always be a beacon with CSA (count
== 0), but now, if the count starts with 1, there won't be any. If
you don't check, my patch will probably introduce a WARN when the
ath9k driver tries to get the beacon without checking for CSA
completion..
Any other comments or a sanity check would also be appreciated.
--
Cheers,
Luca.
net/mac80211/tx.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 9993fcb..1e0d40f 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2376,8 +2376,12 @@ static void ieee80211_update_csa(struct ieee80211_sub_if_data *sdata,
if (WARN_ON(counter_offset_beacon >= beacon_data_len))
return;
- /* warn if the driver did not check for/react to csa completeness */
- if (WARN_ON(beacon_data[counter_offset_beacon] == 0))
+ /* Warn if the driver did not check for/react to csa
+ * completeness. A beacon with CSA counter set to 0 should
+ * never occur, because a counter of 1 means switch just
+ * before the next beacon.
+ */
+ if (WARN_ON(beacon_data[counter_offset_beacon] == 1))
return;
beacon_data[counter_offset_beacon]--;
@@ -2434,7 +2438,7 @@ bool ieee80211_csa_is_complete(struct ieee80211_vif *vif)
if (WARN_ON(counter_beacon > beacon_data_len))
goto out;
- if (beacon_data[counter_beacon] == 0)
+ if (beacon_data[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wgcHJvYmFibHkgc3RhcnQgbG9va2luZyBpbnRvIHRoZSBhY3Rpb24gZnJh
bWUgaW1wbGVtZW50YXRpb24gc29vbi4NCg0KDQo+IEN1cnJlbnRseSwgDQo+IGF0aDlrIGNhbGxz
IHRoZSBjc2FfZmluaXNoKCkgYWZ0ZXIgY2hlY2tpbmcgd2hldGhlciBiZWFjb24gc2VuZGluZyB3
YXMgY29tcGxldGUgDQo+IC4uLiBzbyB0aGlzIHdvdWxkIGhhdmUgdG8gYmUgY2hhbmdlZC4NCg0K
WWVhaCwgdGhhdCdzIHdoYXQgSSBzdXNwZWN0ZWQgZnJvbSBteSB2ZXJ5IHF1aWNrIGxvb2sgYXQg
dGhlIGF0aDlrIGNvZGUuDQpJJ2xsIHNlZSBpZiBJIGNhbiBjaGFuZ2UgdGhpcyBlYXNpbHkuICBJ
J2xsIHByb2JhYmx5IG5lZWQgc29tZSBoZWxwIHdpdGgNCnRlc3RpbmcsIGJlY2F1c2UgSSBkb24n
dCBoYXZlIGFuIGF0aDlrIGRldmljZS4gOlwNCg0KLS0NCkNoZWVycywNCkx1Y2EuDQoNCg==
> On Mon, 2013-11-04 at 15:31 +0100, Simon Wunderlich wrote:
> > > > Thanks for checking back - I've read the part in the spec again [1],
> > > > and appearently you are right.
> > > >
> > > > With your proposed change, shouldn't we also change the behaviour if
> > > > the userspace requests a channel switch with count = 0? I guess we
> > > > should immediately change the channel then without waiting for
> > > > beacons? I don't see the point in changing the beacons if we don't
> > > > send them, after all.
> > >
> > > You're right, changing the beacons doesn't make sense in this case.
> > > I'll change that and send v2.
> > >
> > > Another thing is that we are missing the action frames. The idea with
> > > the count == 0 is that the STA's should start listening on the other
> > > channel immediately after receiving the action frame (because the
> > > switch will happen at any time).
> > >
> > > If we don't send the action frame, passing context == 0 from the
> > > userspace doesn't much make sense, because the clients won't know we're
> > > switching. Well, maybe it makes a bit of sense, if there are no
> > > clients connected, but nevertheless.
> >
> > Yeah, switching without actionframe and count == 0 is pretty useless.
>
> Actually, if the userspace requests count == 1, we won't have any
> beacons either, because 1 means "just before the next TBTT". So for
> count == 1 (coming from the userspace) we shouldn't configure the
> beacon, since we won't send it. We need the action frame for this case
> too.
>
Hmm, right, we will decrement the counter before sending it out ...
> > For AP mode, I guess the right place to implement the action frames would
> > be hostap? This would at least allow great flexibility with CSA, ECSA
> > and all the new channel switch IEs coming now. The beacons are also
> > generated in userspace, after all.
>
> What new channel channel switch IEs?
Right now we also have extendended channel switch announcements (ECSA), and
secondary channel offset, and there are more to come with 802.11ac I think. I
have not studied it yet (and I don't have access to 802.11 drafts), but have a
look at that:
https://mentor.ieee.org/802.11/dcn/13/11-13-0105-00-00ac-lb190-proposed-
resolution-on-cid-7367-and-7368.docx&ei=T_N4UuHWGcmt4ATQj4DwBg&usg=AFQjCNE5E-
bpqRGQM7-QwG0L4TiU3OOLig&bvm=bv.55980276,d.bGE&cad=rja
(not only the .doc format is ugly)
>
> You're right that it might make sense to implement the action frames in
> hostap. But OTOH, the action frame is quite simple and mac80211 should
> have all the information needed to send it out.
>
> > BTW, I've just checked and the WiFi Alliance requires at least 5 beacons
> > with CSA-IEs to pass the 802.11h test. :)
>
> Do you mean that the tests only check when count starts as > 5?
>
It checks if the last beacon hast a CSA IE in the beacon, and also if there
are 4 beacons before that including a CSA IE. It does not check for the count
though, but that's implicitly given ...
Cheers,
Simon
Hey Luca,
> >
> > Thanks for checking back - I've read the part in the spec again [1], and
> > appearently you are right.
> >
> > With your proposed change, shouldn't we also change the behaviour if the
> > userspace requests a channel switch with count = 0? I guess we should
> > immediately change the channel then without waiting for beacons? I don't
> > see the point in changing the beacons if we don't send them, after all.
>
> You're right, changing the beacons doesn't make sense in this case.
> I'll change that and send v2.
>
> Another thing is that we are missing the action frames. The idea with
> the count == 0 is that the STA's should start listening on the other
> channel immediately after receiving the action frame (because the switch
> will happen at any time).
>
> If we don't send the action frame, passing context == 0 from the
> userspace doesn't much make sense, because the clients won't know we're
> switching. Well, maybe it makes a bit of sense, if there are no clients
> connected, but nevertheless.
Yeah, switching without actionframe and count == 0 is pretty useless.
>
> count == 0 should probably be avoided, because the specs are not that
> clear about it. In case transmission on our channel needs to be stopped
> immediately (eg. with DSS), we can always use the channel switch mode
> (ie. no TX until the switch happens).
Hmm, we probably need to review the IBSS part too - we adopt the channel
switch from others here, and adopting with count = 0 works now but would
create a warning with your change ...
>
> I'll probably start looking into the action frame implementation soon.
I've recently added CSA action frame support for the IBSS mode, because the
distributed beaconing may lead to slow adoption of the CSA IEs in the IBSS.
Check ieee80211_send_action_csa() for that. I guess it would be useful to send
at least the action frames out if we want to change "fast" (count=0).
For AP mode, I guess the right place to implement the action frames would be
hostap? This would at least allow great flexibility with CSA, ECSA and all the
new channel switch IEs coming now. The beacons are also generated in
userspace, after all.
BTW, I've just checked and the WiFi Alliance requires at least 5 beacons with
CSA-IEs to pass the 802.11h test. :)
>
> > Currently,
> > ath9k calls the csa_finish() after checking whether beacon sending was
> > complete ... so this would have to be changed.
>
> Yeah, that's what I suspected from my very quick look at the ath9k code.
> I'll see if I can change this easily. I'll probably need some help with
> testing, because I don't have an ath9k device. :\
No problem, I can test here, just tell me what to test. :)
Cheers,
Simon
T24gTW9uLCAyMDEzLTExLTA0IGF0IDE1OjMxICswMTAwLCBTaW1vbiBXdW5kZXJsaWNoIHdyb3Rl
Og0KPiA+ID4gVGhhbmtzIGZvciBjaGVja2luZyBiYWNrIC0gSSd2ZSByZWFkIHRoZSBwYXJ0IGlu
IHRoZSBzcGVjIGFnYWluIFsxXSwgYW5kDQo+ID4gPiBhcHBlYXJlbnRseSB5b3UgYXJlIHJpZ2h0
Lg0KPiA+ID4gDQo+ID4gPiBXaXRoIHlvdXIgcHJvcG9zZWQgY2hhbmdlLCBzaG91bGRuJ3Qgd2Ug
YWxzbyBjaGFuZ2UgdGhlIGJlaGF2aW91ciBpZiB0aGUNCj4gPiA+IHVzZXJzcGFjZSByZXF1ZXN0
cyBhIGNoYW5uZWwgc3dpdGNoIHdpdGggY291bnQgPSAw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UgdG8gYmUgY2hh
bmdlZC4NCj4gPiANCj4gPiBZZWFoLCB0aGF0J3Mgd2hhdCBJIHN1c3BlY3RlZCBmcm9tIG15IHZl
cnkgcXVpY2sgbG9vayBhdCB0aGUgYXRoOWsgY29kZS4NCj4gPiBJJ2xsIHNlZSBpZiBJIGNhbiBj
aGFuZ2UgdGhpcyBlYXNpbHkuICBJJ2xsIHByb2JhYmx5IG5lZWQgc29tZSBoZWxwIHdpdGgNCj4g
PiB0ZXN0aW5nLCBiZWNhdXNlIEkgZG9uJ3QgaGF2ZSBhbiBhdGg5ayBkZXZpY2UuIDpcDQo+IA0K
PiBObyBwcm9ibGVtLCBJIGNhbiB0ZXN0IGhlcmUsIGp1c3QgdGVsbCBtZSB3aGF0IHRvIHRlc3Qu
IDopDQoNCkNvb2whIEJhc2ljYWxseSBJIGp1c3Qgd2FudCB5b3UgdG8gbWFrZSBzdXJlIHdoYXQg
SSBkbyBzdGlsbCB3b3JrcyBhbmQgSQ0KZG9uJ3QgYnJlYWsgYW55dGhpbmcgb2Ygd2hhdCB5b3Ug
aGF2ZSBiZWVuIGRvaW5nLiA7KQ0KDQotLQ0KQ2hlZXJzLA0KTHVjYS4NCg0K
Hey Luca,
> A beacon should never have a Channel Switch Announcement information
> element with a count of 0, because a count of 1 means switch just
> before the next beacon. So, if a count of 0 was valid in a beacon, it
> would have been transmitted in the next channel already, which is
> useless. A CSA count equal to zero is only meaningful in action
> frames or probe_responses.
>
> Fix the ieee80211_csa_is_complete() and ieee80211_update_csa()
> functions accordingly.
>
> Cc: Simon Wunderlich <[email protected]>
> Signed-off-by: Luciano Coelho <[email protected]>
> ---
>
> Hi Simon (et al),
>
> I identified this issue while playing around with CSA. I noticed that
> we are sending a CSA beaon with count == 0, which should not happen.
> The last beacon visible in the current channel (ie. before the switch)
> contains a CSA IE with count == 1.
>
> I wanted to check with you if my proposed change would have any
> side-effects, especially with the ath9k driver, which is the only user
> of this code in the mainline at the moment.
>
> The potential danger here is if you don't check
> ieee80211_csa_is_complete() before you send the first CSA beacon out.
> With the previous code, there would always be a beacon with CSA (count
> == 0), but now, if the count starts with 1, there won't be any. If
> you don't check, my patch will probably introduce a WARN when the
> ath9k driver tries to get the beacon without checking for CSA
> completion..
>
> Any other comments or a sanity check would also be appreciated.
Thanks for checking back - I've read the part in the spec again [1], and
appearently you are right.
With your proposed change, shouldn't we also change the behaviour if the
userspace requests a channel switch with count = 0? I guess we should
immediately change the channel then without waiting for beacons? I don't see
the point in changing the beacons if we don't send them, after all. Currently,
ath9k calls the csa_finish() after checking whether beacon sending was complete
... so this would have to be changed.
Cheers,
Simon
[1] IEEE 802.11-2012, 8.4.2.21
For nonmesh STAs, the Channel Switch Count field either is set to the number of
TBTTs until the STA sending the Channel Switch Announcement element switches
to the new channel or is set to 0. A value of 1 indicates that the switch
occurs immediately before the next TBTT. A value of 0 indicates that the
switch occurs at any time after the frame containing the element is
transmitted.
> On Tue, 2013-11-05 at 10:27 +0200, Luciano Coelho wrote:
> > On Mon, 2013-11-04 at 15:31 +0100, Simon Wunderlich wrote:
> > > > > Thanks for checking back - I've read the part in the spec again
> > > > > [1], and appearently you are right.
> > > > >
> > > > > With your proposed change, shouldn't we also change the behaviour
> > > > > if the userspace requests a channel switch with count = 0? I guess
> > > > > we should immediately change the channel then without waiting for
> > > > > beacons? I don't see the point in changing the beacons if we don't
> > > > > send them, after all.
> > > >
> > > > You're right, changing the beacons doesn't make sense in this case.
> > > > I'll change that and send v2.
> > > >
> > > > Another thing is that we are missing the action frames. The idea
> > > > with the count == 0 is that the STA's should start listening on the
> > > > other channel immediately after receiving the action frame (because
> > > > the switch will happen at any time).
> > > >
> > > > If we don't send the action frame, passing context == 0 from the
> > > > userspace doesn't much make sense, because the clients won't know
> > > > we're switching. Well, maybe it makes a bit of sense, if there are
> > > > no clients connected, but nevertheless.
> > >
> > > Yeah, switching without actionframe and count == 0 is pretty useless.
> >
> > Actually, if the userspace requests count == 1, we won't have any
> > beacons either, because 1 means "just before the next TBTT". So for
> > count == 1 (coming from the userspace) we shouldn't configure the
> > beacon, since we won't send it. We need the action frame for this case
> > too.
>
> Hmmm... Now there's something that is a bit unclear to me in the specs:
>
> "For nonmesh STAs, the Channel Switch Count field either is set to the
> number of TBTTs until the STA sending the Channel Switch Announcement
> element switches to the new channel or is set to 0."
>
> There's nothing specifying exactly when, relative to the beacon, the
> switch actually happens. Just before? Just after? Is the beacon that
> matches that TBTT transmitted in the current or in the next channel?
>
> For a value of 1, it's pretty clear:
>
> "A value of 1 indicates that the switch occurs immediately before the
> next TBTT."
If it says for 1 "just before the next TBTT", then this would mean the next
beacon is on the next channel. I'd interpret then that for count=0, the
channel switch happens as soon as possible, and may happen any time before the
next TBTT.
>
> I don't think we're doing that now. At least in the ath9k case, you
> switch the channel immediately after the beacon with count == 1, by
> calling ieee80211_csa_finish(). The correct would be just before the
> next beacon is sent.
Hm, I think you are right, although I'm not sure how easy that would be
implementation-wise.
BTW, for that case I think we also have to fix the client side, which is
currently switching immediately for count = 1 and not waiting for the next
TBTT. (see end of ieee80211_sta_process_chanswitch(), the rest appears correct
though).
>
> A value of 0 is also unclear, because it doesn't refer to any TBTTs at
> all. So if you read it literally, the following would mean that it
> could at *any* time in the future:
>
> "A value of 0 indicates that the switch occurs at any time after the
> frame containing the element is transmitted."
>
> Am I missing something? What do you think?
As said above, I'd interpret it as the change should happen as soon as
possible. If count = 1 means the change will happen "immediately before the
next TBTT", I would guess 0 would mean even before that, or at least not after
the "before the next TBTT".
I agree that the spec is not perfectly clear about that, but I currently don't
see any other reasonable interpretation here ...
Cheers,
Simon
T24gVHVlLCAyMDEzLTExLTA1IGF0IDE0OjM2ICswMTAwLCBTaW1vbiBXdW5kZXJsaWNoIHdyb3Rl
Og0KPiA+IE9uIE1vbiwgMjAxMy0xMS0wNCBhdCAxNTozMSArMDEwMCwgU2ltb24gV3VuZGVybGlj
aCB3cm90ZToNCj4gPiA+ID4gPiBUaGFua3MgZm9yIGNoZWNraW5nIGJhY2sgLSBJJ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