Search Linux Wireless

[PATCH] crda: handle AUTO bw setting in db2rd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Handle AUTO bandwidth setting in db2rd.
Don't add NL80211_ATTR_FREQ_RANGE_MAX_BW attribute
in case of AUTO bw calculation.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@xxxxxxxxx>
---
 crda.c   |    3 ++-
 reglib.c |    9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/crda.c b/crda.c
index 0bf83a1..2fc5bce 100644
--- a/crda.c
+++ b/crda.c
@@ -127,7 +127,8 @@ static int put_reg_rule(const struct ieee80211_reg_rule *rule, struct nl_msg *ms
 	NLA_PUT_U32(msg, NL80211_ATTR_REG_RULE_FLAGS,		rule->flags);
 	NLA_PUT_U32(msg, NL80211_ATTR_FREQ_RANGE_START,		freq_range->start_freq_khz);
 	NLA_PUT_U32(msg, NL80211_ATTR_FREQ_RANGE_END,		freq_range->end_freq_khz);
-	NLA_PUT_U32(msg, NL80211_ATTR_FREQ_RANGE_MAX_BW,	freq_range->max_bandwidth_khz);
+	if (freq_range->max_bandwidth_khz)
+		NLA_PUT_U32(msg, NL80211_ATTR_FREQ_RANGE_MAX_BW, freq_range->max_bandwidth_khz);
 	NLA_PUT_U32(msg, NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN,	power_rule->max_antenna_gain);
 	NLA_PUT_U32(msg, NL80211_ATTR_POWER_RULE_MAX_EIRP,	power_rule->max_eirp);
 
diff --git a/reglib.c b/reglib.c
index af38fe7..bb8ce96 100644
--- a/reglib.c
+++ b/reglib.c
@@ -1116,7 +1116,7 @@ reglib_parse_rule_args_cac(char *line, struct ieee80211_reg_rule *reg_rule)
 static int reglib_parse_rule(FILE *fp, struct ieee80211_reg_rule *reg_rule)
 {
 	char line[1024];
-	char *line_p;
+	char *line_p, *auto_p;
 	unsigned int i;
 	int r = 0;
 	struct reglib_rule_parse_list *reglib_rule_parsers;
@@ -1150,6 +1150,13 @@ static int reglib_parse_rule(FILE *fp, struct ieee80211_reg_rule *reg_rule)
 		return -EINVAL;
 	}
 
+	auto_p = strstr(line_p, "@ AUTO");
+	if (auto_p) {
+		/* This will be much easier instead of adding new parser! */
+		memcpy(&auto_p[0], "@ 0", 3);
+		memcpy(&auto_p[3], &auto_p[6], strlen(line_p) + 1 - (auto_p + 3 - line_p));
+	}
+
 	for (i = 0; i < reglib_rule_parsers->n_parsers; i++) {
 		r = reglib_rule_parsers->rule_parsers[i](line, reg_rule);
 		if (r == 0)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux