Skip to content

Commit

Permalink
cfg80211: separate intersection section in __set_regdom()
Browse files Browse the repository at this point in the history
So far the __set_regdom() code is pretty generic as the
intersection case is fairly straight forward; this will however
change when 802.11d support is added so lets separate intersection
code for now in preparation for 802.11d support.

This patch only has slight functional changes.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Luis R. Rodriguez authored and John W. Linville committed Nov 25, 2008
1 parent 8375af3 commit b8295ac
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions net/wireless/reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -826,27 +826,40 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
if (WARN_ON(!reg_is_valid_request(rd->alpha2)))
return -EINVAL;

reset_regdomains();

/* Country IE parsing coming soon */

if (!is_valid_rd(rd)) {
printk(KERN_ERR "cfg80211: Invalid "
"regulatory domain detected:\n");
print_regdomain_info(rd);
return -EINVAL;
}

if (unlikely(last_request->intersect)) {
if (!last_request->intersect) {
reset_regdomains();
cfg80211_regdomain = rd;
return 0;
}

/* Intersection requires a bit more work */

if (last_request->initiator != REGDOM_SET_BY_COUNTRY_IE) {

intersected_rd = regdom_intersect(rd, cfg80211_regdomain);
if (!intersected_rd)
return -EINVAL;

/* We can trash what CRDA provided now */
kfree(rd);
rd = intersected_rd;
rd = NULL;

reset_regdomains();
cfg80211_regdomain = intersected_rd;

return 0;
}

/* Tada! */
cfg80211_regdomain = rd;
/* Country IE parsing coming soon */
reset_regdomains();
WARN_ON(1);

return 0;
}
Expand Down

0 comments on commit b8295ac

Please sign in to comment.