3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 23:09:34 +01:00

network: add __network_connect

This is to support the ConnectBssid developer method which
bypasses the BSS selection logic in order to force a connection
to a specific BSS.
This commit is contained in:
James Prestwood 2021-08-06 16:02:09 -07:00 committed by Denis Kenzior
parent 80fec3f5f4
commit a4d18ecf8f
2 changed files with 40 additions and 27 deletions

View File

@ -1497,35 +1497,11 @@ error:
return reply;
}
static struct l_dbus_message *network_connect(struct l_dbus *dbus,
struct l_dbus_message *message,
void *user_data)
struct l_dbus_message *__network_connect(struct network *network,
struct scan_bss *bss,
struct l_dbus_message *message)
{
struct network *network = user_data;
struct station *station = network->station;
struct scan_bss *bss;
l_debug("");
if (network == station_get_connected_network(station))
/*
* The requested network is already connected, return success.
*/
return l_dbus_message_new_method_return(message);
if (network->agent_request)
return dbus_error_busy(message);
/*
* Select the best BSS to use at this time. If we have to query the
* agent this may not be the final choice because BSS visibility can
* change while we wait for the agent.
*/
bss = network_bss_select(network, true);
/* None of the BSSes is compatible with our stack */
if (!bss)
return dbus_error_not_supported(message);
switch (network_get_security(network)) {
case SECURITY_PSK:
@ -1559,6 +1535,39 @@ static struct l_dbus_message *network_connect(struct l_dbus *dbus,
}
}
static struct l_dbus_message *network_connect(struct l_dbus *dbus,
struct l_dbus_message *message,
void *user_data)
{
struct network *network = user_data;
struct station *station = network->station;
struct scan_bss *bss;
l_debug("");
if (network == station_get_connected_network(station))
/*
* The requested network is already connected, return success.
*/
return l_dbus_message_new_method_return(message);
if (network->agent_request)
return dbus_error_busy(message);
/*
* Select the best BSS to use at this time. If we have to query the
* agent this may not be the final choice because BSS visibility can
* change while we wait for the agent.
*/
bss = network_bss_select(network, true);
/* None of the BSSes is compatible with our stack */
if (!bss)
return dbus_error_not_supported(message);
return __network_connect(network, bss, message);
}
/*
* Returns an error message in case an error occurs. Otherwise this function
* returns NULL and takes a reference to message. Callers should unref

View File

@ -89,3 +89,7 @@ struct erp_cache_entry *network_get_erp_cache(struct network *network);
const struct l_queue_entry *network_bss_list_get_entries(
struct network *network);
struct l_dbus_message *__network_connect(struct network *network,
struct scan_bss *bss,
struct l_dbus_message *message);