3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-21 03:32:42 +01:00

wsc: report session overlap error

This commit is contained in:
Denis Kenzior 2016-09-13 14:55:13 -05:00
parent 1627b3a2bd
commit f3d5adfc3c

View File

@ -52,6 +52,14 @@ struct wsc {
uint32_t scan_id; uint32_t scan_id;
}; };
static struct l_dbus_message *wsc_error_session_overlap(
struct l_dbus_message *msg)
{
return l_dbus_message_new_error(msg,
IWD_WSC_INTERFACE ".SessionOverlap",
"Multiple sessions detected");
}
static bool scan_results(uint32_t wiphy_id, uint32_t ifindex, static bool scan_results(uint32_t wiphy_id, uint32_t ifindex,
struct l_queue *bss_list, void *userdata) struct l_queue *bss_list, void *userdata)
{ {
@ -109,7 +117,7 @@ static bool scan_results(uint32_t wiphy_id, uint32_t ifindex,
case SCAN_BAND_2_4_GHZ: case SCAN_BAND_2_4_GHZ:
if (bss_2g) { if (bss_2g) {
l_debug("2G Session overlap error"); l_debug("2G Session overlap error");
return false; goto session_overlap;
} }
bss_2g = bss; bss_2g = bss;
@ -119,7 +127,7 @@ static bool scan_results(uint32_t wiphy_id, uint32_t ifindex,
case SCAN_BAND_5_GHZ: case SCAN_BAND_5_GHZ:
if (bss_5g) { if (bss_5g) {
l_debug("5G Session overlap error"); l_debug("5G Session overlap error");
return false; goto session_overlap;
} }
bss_5g = bss; bss_5g = bss;
@ -133,7 +141,7 @@ static bool scan_results(uint32_t wiphy_id, uint32_t ifindex,
if (bss_2g && bss_5g && memcmp(uuid_2g, uuid_5g, 16)) { if (bss_2g && bss_5g && memcmp(uuid_2g, uuid_5g, 16)) {
l_debug("Found two PBC APs on different bands"); l_debug("Found two PBC APs on different bands");
return false; goto session_overlap;
} }
if (bss_5g) if (bss_5g)
@ -152,6 +160,15 @@ static bool scan_results(uint32_t wiphy_id, uint32_t ifindex,
util_address_to_string(target->addr)); util_address_to_string(target->addr));
return false; return false;
session_overlap:
dbus_pending_reply(&wsc->pending,
wsc_error_session_overlap(wsc->pending));
l_free(wsc->wsc_ies);
wsc->wsc_ies = 0;
return false;
} }
static bool wsc_start_pushbutton(struct wsc *wsc) static bool wsc_start_pushbutton(struct wsc *wsc)