From: Johannes Berg <johannes@sipsolutions.net>
To: "Luis R. Rodriguez" <lrodriguez@atheros.com>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org
Subject: Re: [RFC] wireless: Add 802.11d support
Date: Fri, 31 Oct 2008 11:15:43 +0100 [thread overview]
Message-ID: <1225448143.3535.17.camel@johannes.berg> (raw)
In-Reply-To: <1225428211-17353-1-git-send-email-lrodriguez@atheros.com> (sfid-20081031_054338_414241_747AA340)
[-- Attachment #1: Type: text/plain, Size: 3139 bytes --]
On Thu, 2008-10-30 at 21:43 -0700, Luis R. Rodriguez wrote:
> +struct ieee80211_regdomain *ieee80211_country_ie_2_rd(
> + u8 *country_ie, u8 country_ie_len)
> +{
> + struct ieee80211_regdomain *rd = NULL;
> + u32 flags = 0;
> + u32 num_rules = 0, size_of_regd = 0;
> + u8 *triplets_start = NULL;
> + u8 len_at_triplet = 0;
> + unsigned int i = 0;
> + /* Used too often */
> + int triplet_size = sizeof(struct ieee80211_country_ie_triplet);
> +
> + rd->alpha2[0] = country_ie[0];
> + rd->alpha2[1] = country_ie[1];
> +
> + /*
> + * Third octet can be:
> + * 'I' - Indoor
> + * 'O' - Outdoor
> + *
> + * anything else we assume is no restrictions
> + */
> + if (country_ie[2] == 'I')
> + flags = NL80211_RRF_NO_OUTDOOR;
> + else if (country_ie[2] == 'O')
> + flags = NL80211_RRF_NO_INDOOR;
> +
> + country_ie += 3;
> + country_ie_len -= 3;
This needs to verify that the country IE is valid to start with, i.e. >=
3 bytes long.
<snipped, will review algorithm and stuff later>
> +#ifdef CONFIG_WIRELESS_OLD_REGULATORY
> + /* We can't expect to have anything to intersect with...
> + * so use standard low values */
> + freq_range->max_bandwidth_khz = MHZ_TO_KHZ(40);
> + power_rule->max_antenna_gain = DBI_TO_MBI(6);
> + power_rule->max_eirp = DBM_TO_MBM(20);
> +#else
> + /* Large arbitrary values, we intersect later */
> + /* Increment this if we ever support >= 40 MHz channels
> + * in IEEE 802.11 */
> + freq_range->max_bandwidth_khz = MHZ_TO_KHZ(40);
> + power_rule->max_antenna_gain = DBI_TO_MBI(100);
> + power_rule->max_eirp = DBM_TO_MBM(100);
> +#endif
Why is this necessary? In case of OLD_REGULATORY we _do_ have values to
intersect with, from the old hardcoded stuff. Please don't treat that so
special, just treat old regulatory as though we had pre-loaded some
regulatory information into the kernel.
> +#ifdef CONFIG_WIRELESS_OLD_REGULATORY
> + /* If the userspace regulatory agent is installed when
> + * OLD_REGULATORY is enabled then great, if not then oh well,
> + * we'll use low ball values */
> + return 0;
> +#endif
Same here.
> + if (!r) {
> + printk(KERN_ERR "cfg80211: calling CRDA failed - "
> + "unable to get country regulatory information "
> + "for country IE\n");
> + return -EINVAL;
> + }
This printk is misplaced, if it should be there at all it should be in
cfg80211, mac80211 need not know anything about crda. Also, !r is
incorrect, just remove the whole code block and do
return regulatory_hint_ie(...);
Also, the printk shouldn't be there at all because otherwise it'll
happen all the time when a country IE is received w/o crda installed,
flooding the logs.
> + if (elems.country_elem) {
> + r = ieee80211_sta_process_country_ie(ifsta, local,
> + elems.country_elem, elems.country_elem_len);
Some code here or in the processing function should compare the country
element and only process it if it changed to avoid calling crda 10 times
per second....
> +#ifdef CONFIG_MAC80211_VERBOSE_SPECT_MGMT_DEBUG
> + if (!r)
!r is wrong again
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2008-10-31 10:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-31 4:43 [RFC] wireless: Add 802.11d support Luis R. Rodriguez
2008-10-31 5:16 ` pat-lkml
2008-10-31 6:10 ` Luis R. Rodriguez
2008-10-31 10:07 ` Johannes Berg
2008-10-31 10:15 ` Johannes Berg [this message]
2008-10-31 18:49 ` Luis R. Rodriguez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1225448143.3535.17.camel@johannes.berg \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=lrodriguez@atheros.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox