commit a4d18ecf8f4935f733b140da3f5777c455f2ad25
parent 80fec3f5f4e284c4b1555a0c1ac7279d9e54fe2f
Author: James Prestwood <prestwoj@gmail.com>
Date: Fri, 6 Aug 2021 16:02:09 -0700
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.
Diffstat:
2 files changed, 40 insertions(+), 27 deletions(-)
diff --git a/src/network.c b/src/network.c
@@ -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
diff --git a/src/network.h b/src/network.h
@@ -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);