cfg80211: fix syntax error on user regulatory hints
[safe/jmp/linux-2.6] / net / wireless / reg.c
index 6ab56f0..7a0754c 100644 (file)
@@ -141,62 +141,35 @@ static const struct ieee80211_regdomain us_regdom = {
        .reg_rules = {
                /* IEEE 802.11b/g, channels 1..11 */
                REG_RULE(2412-10, 2462+10, 40, 6, 27, 0),
-               /* IEEE 802.11a, channel 36 */
-               REG_RULE(5180-10, 5180+10, 40, 6, 23, 0),
-               /* IEEE 802.11a, channel 40 */
-               REG_RULE(5200-10, 5200+10, 40, 6, 23, 0),
-               /* IEEE 802.11a, channel 44 */
-               REG_RULE(5220-10, 5220+10, 40, 6, 23, 0),
+               /* IEEE 802.11a, channel 36..48 */
+               REG_RULE(5180-10, 5240+10, 40, 6, 17, 0),
                /* IEEE 802.11a, channels 48..64 */
-               REG_RULE(5240-10, 5320+10, 40, 6, 23, 0),
+               REG_RULE(5260-10, 5320+10, 40, 6, 20, NL80211_RRF_DFS),
+               /* IEEE 802.11a, channels 100..124 */
+               REG_RULE(5500-10, 5590+10, 40, 6, 20, NL80211_RRF_DFS),
+               /* IEEE 802.11a, channels 132..144 */
+               REG_RULE(5660-10, 5700+10, 40, 6, 20, NL80211_RRF_DFS),
                /* IEEE 802.11a, channels 149..165, outdoor */
                REG_RULE(5745-10, 5825+10, 40, 6, 30, 0),
        }
 };
 
 static const struct ieee80211_regdomain jp_regdom = {
-       .n_reg_rules = 3,
+       .n_reg_rules = 6,
        .alpha2 =  "JP",
        .reg_rules = {
-               /* IEEE 802.11b/g, channels 1..14 */
-               REG_RULE(2412-10, 2484+10, 40, 6, 20, 0),
-               /* IEEE 802.11a, channels 34..48 */
-               REG_RULE(5170-10, 5240+10, 40, 6, 20,
-                       NL80211_RRF_PASSIVE_SCAN),
+               /* IEEE 802.11b/g, channels 1..11 */
+               REG_RULE(2412-10, 2462+10, 40, 6, 20, 0),
+               /* IEEE 802.11b/g, channels 12..13 */
+               REG_RULE(2467-10, 2472+10, 20, 6, 20, 0),
+               /* IEEE 802.11b/g, channel 14 */
+               REG_RULE(2484-10, 2484+10, 20, 6, 20, NL80211_RRF_NO_OFDM),
+               /* IEEE 802.11a, channels 36..48 */
+               REG_RULE(5180-10, 5240+10, 40, 6, 20, 0),
                /* IEEE 802.11a, channels 52..64 */
-               REG_RULE(5260-10, 5320+10, 40, 6, 20,
-                       NL80211_RRF_NO_IBSS |
-                       NL80211_RRF_DFS),
-       }
-};
-
-static const struct ieee80211_regdomain eu_regdom = {
-       .n_reg_rules = 6,
-       /*
-        * This alpha2 is bogus, we leave it here just for stupid
-        * backward compatibility
-        */
-       .alpha2 =  "EU",
-       .reg_rules = {
-               /* IEEE 802.11b/g, channels 1..13 */
-               REG_RULE(2412-10, 2472+10, 40, 6, 20, 0),
-               /* IEEE 802.11a, channel 36 */
-               REG_RULE(5180-10, 5180+10, 40, 6, 23,
-                       NL80211_RRF_PASSIVE_SCAN),
-               /* IEEE 802.11a, channel 40 */
-               REG_RULE(5200-10, 5200+10, 40, 6, 23,
-                       NL80211_RRF_PASSIVE_SCAN),
-               /* IEEE 802.11a, channel 44 */
-               REG_RULE(5220-10, 5220+10, 40, 6, 23,
-                       NL80211_RRF_PASSIVE_SCAN),
-               /* IEEE 802.11a, channels 48..64 */
-               REG_RULE(5240-10, 5320+10, 40, 6, 20,
-                       NL80211_RRF_NO_IBSS |
-                       NL80211_RRF_DFS),
-               /* IEEE 802.11a, channels 100..140 */
-               REG_RULE(5500-10, 5700+10, 40, 6, 30,
-                       NL80211_RRF_NO_IBSS |
-                       NL80211_RRF_DFS),
+               REG_RULE(5260-10, 5320+10, 40, 6, 20, NL80211_RRF_DFS),
+               /* IEEE 802.11a, channels 100..144 */
+               REG_RULE(5500-10, 5700+10, 40, 6, 23, NL80211_RRF_DFS),
        }
 };
 
@@ -206,15 +179,17 @@ static const struct ieee80211_regdomain *static_regdom(char *alpha2)
                return &us_regdom;
        if (alpha2[0] == 'J' && alpha2[1] == 'P')
                return &jp_regdom;
+       /* Use world roaming rules for "EU", since it was a pseudo
+          domain anyway... */
        if (alpha2[0] == 'E' && alpha2[1] == 'U')
-               return &eu_regdom;
-       /* Default, as per the old rules */
-       return &us_regdom;
+               return &world_regdom;
+       /* Default, world roaming rules */
+       return &world_regdom;
 }
 
 static bool is_old_static_regdom(const struct ieee80211_regdomain *rd)
 {
-       if (rd == &us_regdom || rd == &jp_regdom || rd == &eu_regdom)
+       if (rd == &us_regdom || rd == &jp_regdom || rd == &world_regdom)
                return true;
        return false;
 }
@@ -1008,7 +983,7 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
 
        if (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER &&
            request_wiphy && request_wiphy == wiphy &&
-           request_wiphy->strict_regulatory) {
+           request_wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) {
                /*
                 * This gaurantees the driver's requested regulatory domain
                 * will always be used as a base for further regulatory
@@ -1018,7 +993,6 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
                        map_regdom_flags(reg_rule->flags) | bw_flags;
                chan->max_antenna_gain = chan->orig_mag =
                        (int) MBI_TO_DBI(power_rule->max_antenna_gain);
-               chan->max_bandwidth = KHZ_TO_MHZ(desired_bw_khz);
                chan->max_power = chan->orig_mpwr =
                        (int) MBM_TO_DBM(power_rule->max_eirp);
                return;
@@ -1027,7 +1001,6 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
        chan->flags = flags | bw_flags | map_regdom_flags(reg_rule->flags);
        chan->max_antenna_gain = min(chan->orig_mag,
                (int) MBI_TO_DBI(power_rule->max_antenna_gain));
-       chan->max_bandwidth = KHZ_TO_MHZ(desired_bw_khz);
        if (chan->orig_mpwr)
                chan->max_power = min(chan->orig_mpwr,
                        (int) MBM_TO_DBM(power_rule->max_eirp));
@@ -1053,13 +1026,13 @@ static bool ignore_reg_update(struct wiphy *wiphy,
        if (!last_request)
                return true;
        if (initiator == NL80211_REGDOM_SET_BY_CORE &&
-                 wiphy->custom_regulatory)
+           wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY)
                return true;
        /*
         * wiphy->regd will be set once the device has its own
         * desired regulatory domain set
         */
-       if (wiphy->strict_regulatory && !wiphy->regd &&
+       if (wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY && !wiphy->regd &&
            !is_world_regdom(last_request->alpha2))
                return true;
        return false;
@@ -1095,17 +1068,18 @@ static void handle_reg_beacon(struct wiphy *wiphy,
 
        chan->beacon_found = true;
 
+       if (wiphy->flags & WIPHY_FLAG_DISABLE_BEACON_HINTS)
+               return;
+
        chan_before.center_freq = chan->center_freq;
        chan_before.flags = chan->flags;
 
-       if ((chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) &&
-           !(chan->orig_flags & IEEE80211_CHAN_PASSIVE_SCAN)) {
+       if (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) {
                chan->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN;
                channel_changed = true;
        }
 
-       if ((chan->flags & IEEE80211_CHAN_NO_IBSS) &&
-           !(chan->orig_flags & IEEE80211_CHAN_NO_IBSS)) {
+       if (chan->flags & IEEE80211_CHAN_NO_IBSS) {
                chan->flags &= ~IEEE80211_CHAN_NO_IBSS;
                channel_changed = true;
        }
@@ -1165,7 +1139,7 @@ static bool reg_is_world_roaming(struct wiphy *wiphy)
                return true;
        if (last_request &&
            last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
-           wiphy->custom_regulatory)
+           wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY)
                return true;
        return false;
 }
@@ -1328,7 +1302,6 @@ static void handle_channel_custom(struct wiphy *wiphy,
 
        chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags;
        chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain);
-       chan->max_bandwidth = KHZ_TO_MHZ(desired_bw_khz);
        chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp);
 }
 
@@ -1426,7 +1399,7 @@ static int ignore_request(struct wiphy *wiphy,
                        if (last_wiphy != wiphy) {
                                /*
                                 * Two cards with two APs claiming different
-                                * different Country IE alpha2s. We could
+                                * Country IE alpha2s. We could
                                 * intersect them, but that seems unlikely
                                 * to be correct. Reject second one for now.
                                 */
@@ -1593,7 +1566,8 @@ static void reg_process_hint(struct regulatory_request *reg_request)
 
        r = __regulatory_hint(wiphy, reg_request);
        /* This is required so that the orig_* parameters are saved */
-       if (r == -EALREADY && wiphy && wiphy->strict_regulatory)
+       if (r == -EALREADY && wiphy &&
+           wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY)
                wiphy_update_regulatory(wiphy, reg_request->initiator);
 out:
        mutex_unlock(&reg_mutex);
@@ -1716,7 +1690,7 @@ int regulatory_hint_user(const char *alpha2)
        request->wiphy_idx = WIPHY_IDX_STALE;
        request->alpha2[0] = alpha2[0];
        request->alpha2[1] = alpha2[1];
-       request->initiator = NL80211_REGDOM_SET_BY_USER,
+       request->initiator = NL80211_REGDOM_SET_BY_USER;
 
        queue_regulatory_request(request);
 
@@ -1822,10 +1796,7 @@ void regulatory_hint_11d(struct wiphy *wiphy,
                env = ENVIRON_OUTDOOR;
 
        /*
-        * We will run this for *every* beacon processed for the BSSID, so
-        * we optimize an early check to exit out early if we don't have to
-        * do anything
-        *
+        * We will run this only upon a successful connection on cfg80211.
         * We leave conflict resolution to the workqueue, where can hold
         * cfg80211_mutex.
         */
@@ -1878,7 +1849,6 @@ free_rd_out:
 out:
        mutex_unlock(&reg_mutex);
 }
-EXPORT_SYMBOL(regulatory_hint_11d);
 
 static bool freq_is_chan_12_13_14(u16 freq)
 {
@@ -1936,7 +1906,7 @@ static void print_rd_rules(const struct ieee80211_regdomain *rd)
        const struct ieee80211_freq_range *freq_range = NULL;
        const struct ieee80211_power_rule *power_rule = NULL;
 
-       printk(KERN_INFO "\t(start_freq - end_freq @ bandwidth), "
+       printk(KERN_INFO "    (start_freq - end_freq @ bandwidth), "
                "(max_antenna_gain, max_eirp)\n");
 
        for (i = 0; i < rd->n_reg_rules; i++) {
@@ -1949,7 +1919,7 @@ static void print_rd_rules(const struct ieee80211_regdomain *rd)
                 * in certain regions
                 */
                if (power_rule->max_antenna_gain)
-                       printk(KERN_INFO "\t(%d KHz - %d KHz @ %d KHz), "
+                       printk(KERN_INFO "    (%d KHz - %d KHz @ %d KHz), "
                                "(%d mBi, %d mBm)\n",
                                freq_range->start_freq_khz,
                                freq_range->end_freq_khz,
@@ -1957,7 +1927,7 @@ static void print_rd_rules(const struct ieee80211_regdomain *rd)
                                power_rule->max_antenna_gain,
                                power_rule->max_eirp);
                else
-                       printk(KERN_INFO "\t(%d KHz - %d KHz @ %d KHz), "
+                       printk(KERN_INFO "    (%d KHz - %d KHz @ %d KHz), "
                                "(N/A, %d mBm)\n",
                                freq_range->start_freq_khz,
                                freq_range->end_freq_khz,