diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-01-22 18:05:46 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 15:46:43 -0500 |
commit | 615aab4b75dfa77b00c372330d6f70edd2458bf9 (patch) | |
tree | 587bfa08b616a7149209c46383a61bc51b85bed6 /net/wireless | |
parent | 1f304e4e3bb161163d9f5bc3c6467a2a6fa9b3ae (diff) |
cfg80211: Fix sanity check on 5 GHz when processing country IE
This fixes two issues with the sanity check loop when processing
the country IE:
1. Do not use frequency for the current subband channel check,
this was a big fat typo.
2. Apply the 5 GHz 4-channel steps when considering max channel
on each subband as was done with a recent patch.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/reg.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index bc494cef2102..61698095e1ad 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -498,6 +498,7 @@ static struct ieee80211_regdomain *country_ie_2_rd( | |||
498 | * calculate the number of reg rules we will need. We will need one | 498 | * calculate the number of reg rules we will need. We will need one |
499 | * for each channel subband */ | 499 | * for each channel subband */ |
500 | while (country_ie_len >= 3) { | 500 | while (country_ie_len >= 3) { |
501 | int end_channel = 0; | ||
501 | struct ieee80211_country_ie_triplet *triplet = | 502 | struct ieee80211_country_ie_triplet *triplet = |
502 | (struct ieee80211_country_ie_triplet *) country_ie; | 503 | (struct ieee80211_country_ie_triplet *) country_ie; |
503 | int cur_sub_max_channel = 0, cur_channel = 0; | 504 | int cur_sub_max_channel = 0, cur_channel = 0; |
@@ -509,9 +510,25 @@ static struct ieee80211_regdomain *country_ie_2_rd( | |||
509 | continue; | 510 | continue; |
510 | } | 511 | } |
511 | 512 | ||
513 | /* 2 GHz */ | ||
514 | if (triplet->chans.first_channel <= 14) | ||
515 | end_channel = triplet->chans.first_channel + | ||
516 | triplet->chans.num_channels; | ||
517 | else | ||
518 | /* | ||
519 | * 5 GHz -- For example in country IEs if the first | ||
520 | * channel given is 36 and the number of channels is 4 | ||
521 | * then the individual channel numbers defined for the | ||
522 | * 5 GHz PHY by these parameters are: 36, 40, 44, and 48 | ||
523 | * and not 36, 37, 38, 39. | ||
524 | * | ||
525 | * See: http://tinyurl.com/11d-clarification | ||
526 | */ | ||
527 | end_channel = triplet->chans.first_channel + | ||
528 | (4 * (triplet->chans.num_channels - 1)); | ||
529 | |||
512 | cur_channel = triplet->chans.first_channel; | 530 | cur_channel = triplet->chans.first_channel; |
513 | cur_sub_max_channel = ieee80211_channel_to_frequency( | 531 | cur_sub_max_channel = end_channel; |
514 | cur_channel + triplet->chans.num_channels); | ||
515 | 532 | ||
516 | /* Basic sanity check */ | 533 | /* Basic sanity check */ |
517 | if (cur_sub_max_channel < cur_channel) | 534 | if (cur_sub_max_channel < cur_channel) |
@@ -590,15 +607,6 @@ static struct ieee80211_regdomain *country_ie_2_rd( | |||
590 | end_channel = triplet->chans.first_channel + | 607 | end_channel = triplet->chans.first_channel + |
591 | triplet->chans.num_channels; | 608 | triplet->chans.num_channels; |
592 | else | 609 | else |
593 | /* | ||
594 | * 5 GHz -- For example in country IEs if the first | ||
595 | * channel given is 36 and the number of channels is 4 | ||
596 | * then the individual channel numbers defined for the | ||
597 | * 5 GHz PHY by these parameters are: 36, 40, 44, and 48 | ||
598 | * and not 36, 37, 38, 39. | ||
599 | * | ||
600 | * See: http://tinyurl.com/11d-clarification | ||
601 | */ | ||
602 | end_channel = triplet->chans.first_channel + | 610 | end_channel = triplet->chans.first_channel + |
603 | (4 * (triplet->chans.num_channels - 1)); | 611 | (4 * (triplet->chans.num_channels - 1)); |
604 | 612 | ||