aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2016-06-04 19:00:52 (GMT)
committerJouni Malinen <j@w1.fi>2016-06-04 21:13:32 (GMT)
commita5a187b0f4aab0bf239b05121e8a9a8c6f506616 (patch)
tree03a90e5f70e273c5528894ffb6e9611f0381e209
parentee854ff679aacecaa178ff7089d61084fcf2ceae (diff)
downloadhostap-a5a187b0f4aab0bf239b05121e8a9a8c6f506616.zip
hostap-a5a187b0f4aab0bf239b05121e8a9a8c6f506616.tar.gz
hostap-a5a187b0f4aab0bf239b05121e8a9a8c6f506616.tar.bz2
nl80211: Add TEST_FAIL() to command generation and set_mode
This makes it easier to test error paths for failing driver command cases. Signed-off-by: Jouni Malinen <j@w1.fi>
-rw-r--r--src/drivers/driver_nl80211.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 129ca7e..8e716eb 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -445,6 +445,8 @@ static int nl_get_multicast_id(struct nl80211_global *global,
void * nl80211_cmd(struct wpa_driver_nl80211_data *drv,
struct nl_msg *msg, int flags, uint8_t cmd)
{
+ if (TEST_FAIL())
+ return NULL;
return genlmsg_put(msg, 0, 0, drv->global->nl80211_id,
0, flags, cmd, 0);
}
@@ -5118,6 +5120,9 @@ static int wpa_driver_nl80211_set_mode_impl(
int res;
int mode_switch_res;
+ if (TEST_FAIL())
+ return -1;
+
mode_switch_res = nl80211_set_mode(drv, drv->ifindex, nlmode);
if (mode_switch_res && nlmode == nl80211_get_ifmode(bss))
mode_switch_res = 0;