|
@@ -2768,6 +2768,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
|
|
@@ -2791,7 +2797,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;
|
|
@@ -2835,45 +2841,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);
|
|
@@ -3035,34 +3059,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",
|
|
@@ -3076,6 +3104,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
|