Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bwl: dwpal: fix nl msg set
Browse files Browse the repository at this point in the history
Fixed wrong error condition validation for dwpal_nl_cmd_set()
Also, cast changed to cpp style.

Signed-off-by: Alex Kanter <[email protected]>
Alex Kanter committed Feb 10, 2020
1 parent b6c5cbd commit 6727741
Showing 3 changed files with 12 additions and 11 deletions.
11 changes: 6 additions & 5 deletions common/beerocks/bwl/dwpal/base_wlan_hal_dwpal.cpp
Original file line number Diff line number Diff line change
@@ -587,17 +587,18 @@ bool base_wlan_hal_dwpal::process_nl_events()
}

bool base_wlan_hal_dwpal::dwpal_nl_cmd_set(const std::string &ifname, unsigned int nl_cmd,
unsigned char *vendor_data, size_t vendor_data_size)
const void *vendor_data, size_t vendor_data_size)
{
if (vendor_data == nullptr) {
LOG(ERROR) << __func__ << "vendor_data is NULL ==> Abort!";
return false;
}

if (dwpal_driver_nl_cmd_send(m_dwpal_nl_ctx, DWPAL_NL_UNSOLICITED_EVENT, (char *)ifname.c_str(),
NL80211_CMD_VENDOR, DWPAL_NETDEV_ID,
(enum ltq_nl80211_vendor_subcmds)nl_cmd, vendor_data,
vendor_data_size) != DWPAL_SUCCESS) {
if (dwpal_driver_nl_cmd_send(
m_dwpal_nl_ctx, DWPAL_NL_UNSOLICITED_EVENT, (char *)ifname.c_str(), NL80211_CMD_VENDOR,
DWPAL_NETDEV_ID, ltq_nl80211_vendor_subcmds(nl_cmd),
const_cast<unsigned char *>(reinterpret_cast<const unsigned char *>(vendor_data)),
vendor_data_size) != DWPAL_SUCCESS) {
LOG(ERROR) << __func__ << "ERROR for cmd = " << nl_cmd;
return false;
}
4 changes: 2 additions & 2 deletions common/beerocks/bwl/dwpal/base_wlan_hal_dwpal.h
Original file line number Diff line number Diff line change
@@ -83,8 +83,8 @@ class base_wlan_hal_dwpal : public virtual base_wlan_hal,
* @return true on success
* @return false on failure
*/
bool dwpal_nl_cmd_set(const std::string &ifname, unsigned int nl_cmd,
unsigned char *vendor_data, size_t vendor_data_size);
bool dwpal_nl_cmd_set(const std::string &ifname, unsigned int nl_cmd, const void *vendor_data,
size_t vendor_data_size);
bool dwpal_nl_cmd_scan_dump();
void *get_dwpal_nl_ctx() const { return (m_dwpal_nl_ctx); }

8 changes: 4 additions & 4 deletions common/beerocks/bwl/dwpal/mon_wlan_hal_dwpal.h
Original file line number Diff line number Diff line change
@@ -92,8 +92,8 @@ class mon_wlan_hal_dwpal : public base_wlan_hal_dwpal, public mon_wlan_hal {

bool dwpal_set_scan_params_fg(const sScanCfgParams &params)
{
if (dwpal_nl_cmd_set(m_radio_info.iface_name, LTQ_NL80211_VENDOR_SUBCMD_SET_SCAN_PARAMS,
(unsigned char *)&params, sizeof(params))) {
if (!dwpal_nl_cmd_set(m_radio_info.iface_name, LTQ_NL80211_VENDOR_SUBCMD_SET_SCAN_PARAMS,
&params, sizeof(params))) {
LOG(ERROR) << __func__ << " LTQ_NL80211_VENDOR_SUBCMD_SET_SCAN_PARAMS failed!";
return false;
}
@@ -102,8 +102,8 @@ class mon_wlan_hal_dwpal : public base_wlan_hal_dwpal, public mon_wlan_hal {

bool dwpal_set_scan_params_bg(const sScanCfgParamsBG &params)
{
if (dwpal_nl_cmd_set(m_radio_info.iface_name, LTQ_NL80211_VENDOR_SUBCMD_SET_SCAN_PARAMS_BG,
(unsigned char *)&params, sizeof(params))) {
if (!dwpal_nl_cmd_set(m_radio_info.iface_name, LTQ_NL80211_VENDOR_SUBCMD_SET_SCAN_PARAMS_BG,
&params, sizeof(params))) {
LOG(ERROR) << __func__ << " LTQ_NL80211_VENDOR_SUBCMD_SET_SCAN_PARAMS_BG failed!";
return false;
}

0 comments on commit 6727741

Please sign in to comment.