@@ -140,6 +140,36 @@ nla_put_failure:
return -1;
}
+static int put_dom_reg_rule(struct ieee80211_reg_rule *rule, struct
+nl_msg *msg, int i) {
+ int r;
+ struct nlattr *nl_reg_rule;
+ unsigned long width;
+
+ width = rule->freq_range.end_freq_khz -
rule->freq_range.start_freq_khz;
+ if (width <= 0)
+ return 0; // nothing to do -- assert success
+
+ nl_reg_rule = nla_nest_start(msg, i);
+ if (!nl_reg_rule)
+ return 1;
+
+ if (width < rule->freq_range.max_bandwidth_khz) {
+ if (width >= 160000) rule->freq_range.max_bandwidth_khz =
160000;
+ else if (width >= 80000) rule->freq_range.max_bandwidth_khz
= 80000;
+ else if (width >= 40000) rule->freq_range.max_bandwidth_khz
= 40000;
+ else if (width >= 20000) rule->freq_range.max_bandwidth_khz
= 20000;
+ else if (width >= 10000) rule->freq_range.max_bandwidth_khz
= 10000;
+ else rule->freq_range.max_bandwidth_khz = 5000;
+ }
+ r = put_reg_rule(rule, msg);
+ if (r)
+ return 1;
+
+ nla_nest_end(msg, nl_reg_rule);