提交 2083c499 编写于 作者: J Johannes Berg 提交者: John W. Linville

wireless: clean up regulatory ignore_request function

This function has a few WARNs that may eventually trigger
when an AP sends rogue beacons, those must be removed. Some
of the comments in the function are also inappropriate as
this function is concerned with the global hint, not a per-
wiphy thing (which a multidomain flag on a wiphy would imply).

I'm convinced that we don't need to do anything to implement
multi-domain capability as 802.11-2007 specifies it because
it makes only two things mandatory:
 * starting of BSS/IBSS must have country information
   (this can easily be done with a mac80211 patch)
 * a STA must adopt the country information (we already have
   the framework for this)

But we don't have anything implemented anyway for now.
Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 be3d4810
...@@ -311,24 +311,25 @@ static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by, ...@@ -311,24 +311,25 @@ static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by,
case REGDOM_SET_BY_INIT: case REGDOM_SET_BY_INIT:
return -EINVAL; return -EINVAL;
case REGDOM_SET_BY_CORE: case REGDOM_SET_BY_CORE:
/* Always respect new wireless core hints, should only /*
* come in for updating the world regulatory domain at init * Always respect new wireless core hints, should only happen
* anyway */ * when updating the world regulatory domain at init.
*/
return 0; return 0;
case REGDOM_SET_BY_COUNTRY_IE: case REGDOM_SET_BY_COUNTRY_IE:
if (unlikely(!is_an_alpha2(alpha2)))
return -EINVAL;
if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) { if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) {
if (last_request->wiphy != wiphy) { if (last_request->wiphy != wiphy) {
/* Two cards with two APs claiming different /*
* different Country IE alpha2s! * Two cards with two APs claiming different
* You're special!! */ * different Country IE alpha2s. We could
if (!alpha2_equal(last_request->alpha2, * intersect them, but that seems unlikely
cfg80211_regdomain->alpha2)) { * to be correct. Reject second one for now.
/* XXX: Deal with conflict, consider */
* building a new one out of the if (!alpha2_equal(alpha2,
* intersection */ cfg80211_regdomain->alpha2))
WARN_ON(1);
return -EOPNOTSUPP; return -EOPNOTSUPP;
}
return -EALREADY; return -EALREADY;
} }
/* Two consecutive Country IE hints on the same wiphy */ /* Two consecutive Country IE hints on the same wiphy */
...@@ -336,42 +337,28 @@ static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by, ...@@ -336,42 +337,28 @@ static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by,
return 0; return 0;
return -EALREADY; return -EALREADY;
} }
if (WARN_ON(!is_alpha2_set(alpha2) || !is_an_alpha2(alpha2)), /*
"Invalid Country IE regulatory hint passed " * Ignore Country IE hints for now, need to think about
"to the wireless core\n") * what we need to do to support multi-domain operation.
return -EINVAL; */
/* We ignore Country IE hints for now, as we haven't yet return -EOPNOTSUPP;
* added the dot11MultiDomainCapabilityEnabled flag
* for wiphys */
return 1;
case REGDOM_SET_BY_DRIVER: case REGDOM_SET_BY_DRIVER:
BUG_ON(!wiphy);
if (last_request->initiator == REGDOM_SET_BY_DRIVER) if (last_request->initiator == REGDOM_SET_BY_DRIVER)
return -EALREADY; return -EALREADY;
if (last_request->initiator == REGDOM_SET_BY_CORE)
return 0;
/* XXX: Handle intersection, and add the
* dot11MultiDomainCapabilityEnabled flag to wiphy. For now
* we assume the driver has this set to false, following the
* 802.11d dot11MultiDomainCapabilityEnabled documentation */
if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE)
return 0;
return 0; return 0;
case REGDOM_SET_BY_USER: case REGDOM_SET_BY_USER:
if (last_request->initiator == REGDOM_SET_BY_USER || /*
last_request->initiator == REGDOM_SET_BY_CORE) * If the user wants to override the AP's hint, we may
return 0; * need to follow both and use the intersection. For now,
/* Drivers can use their wiphy's reg_notifier() * reject any such attempt (but we don't support country
* to override any information */ * IEs right now anyway.)
if (last_request->initiator == REGDOM_SET_BY_DRIVER) */
return 0;
/* XXX: Handle intersection */
if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return 0; return 0;
default:
return -EINVAL;
} }
return -EINVAL;
} }
/* Used by nl80211 before kmalloc'ing our regulatory domain */ /* Used by nl80211 before kmalloc'ing our regulatory domain */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册