diff options
| author | Hanumanth Reddy Pothula <c_hpothu@codeaurora.org> | 2017-02-16 12:27:39 +0530 |
|---|---|---|
| committer | qcabuildsw <qcabuildsw@localhost> | 2017-02-17 01:54:32 -0800 |
| commit | 2e1ad213dd71373fab7d092f33882b2cf4012ffc (patch) | |
| tree | 0c7caa5b397da2747aa6165be46a80283607fc8c | |
| parent | 257ed3e379f590b5718a3a0d8e5c079d54025cfe (diff) | |
qcacld-2.0: Handle 0 count White list SSID/ black list BSSID
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.c | 154 |
1 files changed, 87 insertions, 67 deletions
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c index 0b5acbbc880e..f0b72106cdd1 100644 --- a/CORE/HDD/src/wlan_hdd_cfg80211.c +++ b/CORE/HDD/src/wlan_hdd_cfg80211.c @@ -1856,7 +1856,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; @@ -1898,47 +1898,62 @@ __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)) { - hddLog(LOGE, FL("nla_parse failed")); - goto fail; - } - /* Parse and Fetch allowed SSID list*/ - if (!tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID]) { - hddLog(LOGE, FL("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(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; - hddLog(VOS_TRACE_LEVEL_DEBUG, - FL("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 { - hddLog(LOGE, FL("Invalid SSID len %d,idx %d"), - buf_len, i); + if (tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID_NUM_NETWORKS]) { + count = nla_get_u32( + tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID_NUM_NETWORKS]); + } else { + hddLog(LOGE, FL("Number of networks is not provided")); + goto fail; + } + + if (count && + tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID_LIST]) { + 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)) { + hddLog(LOGE, FL("nla_parse failed")); + goto fail; + } + /* Parse and Fetch allowed SSID list*/ + if (!tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID]) { + hddLog(LOGE, FL("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(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; + hddLog(VOS_TRACE_LEVEL_DEBUG, + FL("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 { + hddLog(LOGE, FL("Invalid SSID len %d,idx %d"), + buf_len, i); + } } } + if (i != count) { + hddLog(LOGE, FL("Invalid number of SSIDs i = %d, count = %d"), + i, count); + goto fail; + } roam_params.num_ssid_allowed_list = i; hddLog(VOS_TRACE_LEVEL_DEBUG, FL("Num of Allowed SSID %d"), roam_params.num_ssid_allowed_list); @@ -2109,34 +2124,39 @@ __wlan_hdd_cfg80211_set_ext_roam_params(struct wiphy *wiphy, hddLog(VOS_TRACE_LEVEL_DEBUG, FL("Num of blacklist BSSID: %d"), count); i = 0; - nla_for_each_nested(curr_attr, - tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_BSSID_PARAMS], - rem) { - - if (i == count) { - hddLog(LOGW, FL("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)) { - hddLog(LOGE, FL("nla_parse failed")); - goto fail; - } - /* Parse and fetch MAC address */ - if (!tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_BSSID_PARAMS_BSSID]) { - hddLog(LOGE, FL("attr blacklist addr failed")); - goto fail; + 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) { + hddLog(LOGW, FL("Ignoring excess Blacklist BSSID")); + break; + } + if (curr_attr == NULL) { + hddLog(LOGW, FL("Blacklist BSSID, curr_attr is null")); + continue; + } + if (nla_parse(tb2, + QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_MAX, + nla_data(curr_attr), nla_len(curr_attr), + NULL)) { + hddLog(LOGE, FL("nla_parse failed")); + goto fail; + } + /* Parse and fetch MAC address */ + if (!tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_BSSID_PARAMS_BSSID]) { + hddLog(LOGE, FL("attr blacklist addr failed")); + goto fail; + } + nla_memcpy(roam_params.bssid_avoid_list[i], + tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_BSSID_PARAMS_BSSID], + sizeof(tSirMacAddr)); + hddLog(VOS_TRACE_LEVEL_DEBUG, MAC_ADDRESS_STR, + MAC_ADDR_ARRAY( + roam_params.bssid_avoid_list[i])); + i++; } - nla_memcpy(roam_params.bssid_avoid_list[i], - tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_BSSID_PARAMS_BSSID], - sizeof(tSirMacAddr)); - hddLog(VOS_TRACE_LEVEL_DEBUG, MAC_ADDRESS_STR, - MAC_ADDR_ARRAY( - roam_params.bssid_avoid_list[i])); - i++; } if (i < count) hddLog(LOGW, |
