summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanumanth Reddy Pothula <c_hpothu@codeaurora.org>2017-02-21 17:14:43 +0530
committerqcabuildsw <qcabuildsw@localhost>2017-02-24 08:46:58 -0800
commit87ff6f7baaa91e64d026ac7a4a4ce30ff2ff4d1b (patch)
tree0b04f2d87307982b759026ddbf4aa28be66a9d59
parent1f3dfb961a1ed1302ec732514444b792b1b1789c (diff)
qcacld-3.0: Handle 0 count White list SSID/ black list BSSID
qcacld2.0 to qcacld-3.0 propagation 1) Roam enhancement change needs to handle the case of White list SSID value count can be zero. This zero count is reset mechanism to clean up the existing configuration. 2) The Blacklist BSSID count can also be zero and used as reset of existing list. Change-Id: I9c753b571138ab7533e6e897b820ca1db72c3880 CRs-fixed: 2007708
-rw-r--r--core/hdd/src/wlan_hdd_cfg80211.c147
1 files changed, 90 insertions, 57 deletions
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index 51354a33f2c6..053012dd0ce4 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -2299,6 +2299,12 @@ wlan_hdd_cfg80211_get_features(struct wiphy *wiphy,
return ret;
}
+#define PARAM_NUM_NW \
+ QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID_NUM_NETWORKS
+#define PARAM_SET_BSSID \
+ QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_BSSID_PARAMS_BSSID
+#define PRAM_SSID_LIST QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID_LIST
+#define PARAM_LIST_SSID QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID
/**
* __wlan_hdd_cfg80211_set_ext_roam_params() - Settings for roaming parameters
@@ -2322,7 +2328,7 @@ __wlan_hdd_cfg80211_set_ext_roam_params(struct wiphy *wiphy,
uint8_t session_id;
struct roam_ext_params roam_params;
uint32_t cmd_type, req_id;
- struct nlattr *curr_attr;
+ struct nlattr *curr_attr = NULL;
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_MAX + 1];
struct nlattr *tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_MAX + 1];
int rem, i;
@@ -2366,45 +2372,63 @@ __wlan_hdd_cfg80211_set_ext_roam_params(struct wiphy *wiphy,
switch (cmd_type) {
case QCA_WLAN_VENDOR_ATTR_ROAM_SUBCMD_SSID_WHITE_LIST:
i = 0;
- nla_for_each_nested(curr_attr,
- tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID_LIST],
- rem) {
- if (nla_parse(tb2,
- QCA_WLAN_VENDOR_ATTR_ROAM_SUBCMD_MAX,
- nla_data(curr_attr), nla_len(curr_attr),
- NULL)) {
- hdd_err("nla_parse failed");
- goto fail;
- }
- /* Parse and Fetch allowed SSID list*/
- if (!tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID]) {
- hdd_err("attr allowed ssid failed");
- goto fail;
- }
- buf_len = nla_len(tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID]);
- /*
- * Upper Layers include a null termination character.
- * Check for the actual permissible length of SSID and
- * also ensure not to copy the NULL termination
- * character to the driver buffer.
- */
- if (buf_len && (i < MAX_SSID_ALLOWED_LIST) &&
- ((buf_len - 1) <= SIR_MAC_MAX_SSID_LENGTH)) {
- nla_memcpy(
+ if (tb[PARAM_NUM_NW]) {
+ count = nla_get_u32(
+ tb[PARAM_NUM_NW]);
+ } else {
+ hdd_err("Number of networks is not provided");
+ goto fail;
+ }
+
+ if (count &&
+ tb[PRAM_SSID_LIST]) {
+ nla_for_each_nested(curr_attr,
+ tb[PRAM_SSID_LIST], rem) {
+ if (nla_parse(tb2,
+ QCA_WLAN_VENDOR_ATTR_ROAM_SUBCMD_MAX,
+ nla_data(curr_attr), nla_len(curr_attr),
+ NULL)) {
+ hdd_err("nla_parse failed");
+ goto fail;
+ }
+ /* Parse and Fetch allowed SSID list*/
+ if (!tb2[PARAM_LIST_SSID]) {
+ hdd_err("attr allowed ssid failed");
+ goto fail;
+ }
+ buf_len = nla_len(tb2[PARAM_LIST_SSID]);
+ /*
+ * Upper Layers include a null termination
+ * character. Check for the actual permissible
+ * length of SSID and also ensure not to copy
+ * the NULL termination character to the driver
+ * buffer.
+ */
+ if (buf_len && (i < MAX_SSID_ALLOWED_LIST) &&
+ ((buf_len - 1) <=
+ SIR_MAC_MAX_SSID_LENGTH)) {
+ nla_memcpy(
roam_params.ssid_allowed_list[i].ssId,
- tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID],
- buf_len - 1);
- roam_params.ssid_allowed_list[i].length =
- buf_len - 1;
- hdd_debug("SSID[%d]: %.*s,length = %d", i,
+ tb2[PARAM_LIST_SSID], buf_len - 1);
+ roam_params.ssid_allowed_list[i].length
+ = buf_len - 1;
+ hdd_debug("SSID[%d]: %.*s,length = %d",
+ i,
roam_params.ssid_allowed_list[i].length,
roam_params.ssid_allowed_list[i].ssId,
roam_params.ssid_allowed_list[i].length);
- i++;
- } else {
- hdd_err("Invalid buffer length");
+ i++;
+ } else {
+ hdd_err("Invalid buffer length");
+ }
}
}
+ if (i != count) {
+ hdd_err("Invalid number of SSIDs i = %d, count = %d",
+ i, count);
+ goto fail;
+ }
+
roam_params.num_ssid_allowed_list = i;
hdd_debug("Num of Allowed SSID %d",
roam_params.num_ssid_allowed_list);
@@ -2566,34 +2590,38 @@ __wlan_hdd_cfg80211_set_ext_roam_params(struct wiphy *wiphy,
}
hdd_debug("Num of blacklist BSSID (%d)", count);
i = 0;
- nla_for_each_nested(curr_attr,
+
+ if (count &&
+ tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_BSSID_PARAMS]) {
+ nla_for_each_nested(curr_attr,
tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_BSSID_PARAMS],
rem) {
- if (i == count) {
- hdd_warn("Ignoring excess Blacklist BSSID");
- break;
- }
+ if (i == count) {
+ hdd_warn("Ignoring excess Blacklist BSSID");
+ break;
+ }
- if (nla_parse(tb2,
- QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_MAX,
- nla_data(curr_attr), nla_len(curr_attr),
- NULL)) {
- hdd_err("nla_parse failed");
- goto fail;
- }
- /* Parse and fetch MAC address */
- if (!tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_BSSID_PARAMS_BSSID]) {
- hdd_err("attr blacklist addr failed");
- goto fail;
+ if (nla_parse(tb2,
+ QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_MAX,
+ nla_data(curr_attr), nla_len(curr_attr),
+ NULL)) {
+ hdd_err("nla_parse failed");
+ goto fail;
+ }
+ /* Parse and fetch MAC address */
+ if (!tb2[PARAM_SET_BSSID]) {
+ hdd_err("attr blacklist addr failed");
+ goto fail;
+ }
+ nla_memcpy(
+ roam_params.bssid_avoid_list[i].bytes,
+ tb2[PARAM_SET_BSSID], QDF_MAC_ADDR_SIZE);
+ hdd_debug(MAC_ADDRESS_STR,
+ MAC_ADDR_ARRAY(
+ roam_params.bssid_avoid_list[i].bytes));
+ i++;
}
- nla_memcpy(roam_params.bssid_avoid_list[i].bytes,
- tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_BSSID_PARAMS_BSSID],
- QDF_MAC_ADDR_SIZE);
- hdd_debug(MAC_ADDRESS_STR,
- MAC_ADDR_ARRAY(
- roam_params.bssid_avoid_list[i].bytes));
- i++;
}
if (i < count)
hdd_warn("Num Blacklist BSSID %u less than expected %u",
@@ -2607,6 +2635,11 @@ __wlan_hdd_cfg80211_set_ext_roam_params(struct wiphy *wiphy,
fail:
return -EINVAL;
}
+#undef PARAM_NUM_NW
+#undef PARAM_SET_BSSID
+#undef PRAM_SSID_LIST
+#undef PARAM_LIST_SSID
+
/**
* wlan_hdd_cfg80211_set_ext_roam_params() - set ext scan roam params