diff mbox series

[v2,2/3] dpp: make station connected check better, remove duplicate

Message ID 20231110141620.80195-2-prestwoj@gmail.com (mailing list archive)
State New
Headers show
Series [v2,1/3] dpp: scan to pick up extra frequencies when enrolling | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

James Prestwood Nov. 10, 2023, 2:16 p.m. UTC
Checking if station has a connected network set was fine, but
checking the state is more clear/explicit.

This also removes a duplicate check.
---
 src/dpp.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/src/dpp.c b/src/dpp.c
index daa49410..f1ea01ff 100644
--- a/src/dpp.c
+++ b/src/dpp.c
@@ -4067,14 +4067,8 @@  static void dpp_pkex_scan_destroy(void *user_data)
 static bool dpp_start_pkex_enrollee(struct dpp_sm *dpp, const char *key,
 				const char *identifier)
 {
-	struct station *station = station_find(netdev_get_ifindex(dpp->netdev));
 	_auto_(l_ecc_point_free) struct l_ecc_point *qi = NULL;
 
-	if (station && station_get_connected_network(station)) {
-		l_debug("Already connected, disconnect before enrolling");
-		return false;
-	}
-
 	if (identifier)
 		dpp->pkex_id = l_strdup(identifier);
 
@@ -4194,7 +4188,7 @@  static struct l_dbus_message *dpp_dbus_pkex_start_enrollee(struct l_dbus *dbus,
 				dpp->interface != DPP_INTERFACE_UNBOUND)
 		return dbus_error_busy(message);
 
-	if (station_get_connected_network(station))
+	if (station && station_get_state(station) != STATION_STATE_DISCONNECTED)
 		return dbus_error_busy(message);
 
 	if (!dpp_parse_pkex_args(message, &key, &id))