Commit dd75a8f2 authored by Janusz Dziedzic's avatar Janusz Dziedzic Committed by Luis R. Rodriguez

crda: db2rd, parse/print CAC time

db2rd, parse and print DFS CAC time
Signed-off-by: 's avatarJanusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: 's avatarLuis R. Rodriguez <mcgrof@do-not-panic.com>
parent 2019d708
......@@ -131,6 +131,9 @@ static int put_reg_rule(const struct ieee80211_reg_rule *rule, struct nl_msg *ms
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);
if (rule->dfs_cac_ms)
NLA_PUT_U32(msg, NL80211_ATTR_DFS_CAC_TIME, rule->dfs_cac_ms);
return 0;
nla_put_failure:
......
......@@ -723,6 +723,11 @@ static void print_reg_rule(const struct ieee80211_reg_rule *rule)
else
printf("N/A)");
if (rule->dfs_cac_ms)
printf(", (%u)", rule->dfs_cac_ms);
else
printf(", (N/A)");
if (rule->flags & RRF_NO_OFDM)
printf(", NO-OFDM");
if (rule->flags & RRF_NO_CCK)
......@@ -801,6 +806,7 @@ static int reglib_parse_rule(FILE *fp, struct ieee80211_reg_rule *reg_rule)
char *line_p;
int hits, r = 0;
float start_freq_khz, end_freq_khz, max_bandwidth_khz, max_eirp;
unsigned int dfs_cac_ms = 0;
memset(line, 0, sizeof(line));
line_p = fgets(line, sizeof(line), fp);
......@@ -846,8 +852,15 @@ static int reglib_parse_rule(FILE *fp, struct ieee80211_reg_rule *reg_rule)
/* Next get optional arguments (flags ...) */
strsep(&line_p, ",");
if (line_p)
if (line_p) {
/* Check DFS CAC time */
hits = sscanf(line_p, " (%u)", &dfs_cac_ms);
if (hits == 1)
reg_rule->dfs_cac_ms = dfs_cac_ms;
/* Check flags */
reg_rule->flags = reglib_parse_rule_flag(line_p);
}
return r;
}
......
......@@ -28,6 +28,7 @@ struct ieee80211_reg_rule {
struct ieee80211_freq_range freq_range;
struct ieee80211_power_rule power_rule;
uint32_t flags;
uint32_t dfs_cac_ms;
};
struct ieee80211_regdomain {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment