Fw: Failed to load trusted user certificate
by Martin Tesar
Hello,
it looks like the IWD is not able to load trusted user certificates.
Basically if the certificate is enclosed in
-----BEGIN TRUSTED CERTIFICATE-----
-----END TRUSTED CERTIFICATE-----
I'm always getting an error "Failed to load". Once the user cert is
converted using OpenSSL and is enclosed in
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
it can be loaded without any problem. But such a converted certificate
is not accepted by the RADIUS in my case.
Below is the network configuration file and related syslog output
[Security]
EAP-Method=TLS
EAP-Identity=someuser
EAP-TLS-ClientCert=/usr/local/share/ca-certificates/user.crt
EAP-TLS-ClientKey=/usr/local/share/ca-certificates/key.crt
EAP-TLS-CACert=/usr/local/share/ca-certificates/root.crt
Jun 2 01:19:41 somehost systemd[1]: Starting Wireless service...
Jun 2 01:19:41 somehost iwd[767]: No Diffie-Hellman support found, WPS will not be available
Jun 2 01:19:41 somehost iwd[767]: The following options are missing in the kernel:
Jun 2 01:19:41 somehost iwd[767]: #011CONFIG_KEY_DH_OPERATIONS
Jun 2 01:19:41 somehost iwd[767]: Wireless daemon version 1.7
Jun 2 01:19:41 somehost systemd[1]: Started Wireless service.
Jun 2 01:19:41 somehost iwd[767]: netconfig: Network configuration is disabled.
Jun 2 01:19:41 somehost iwd[767]: Wiphy: 0, Name: phy0
Jun 2 01:19:41 somehost iwd[767]: #011Permanent Address: dc:a6:32:49:d4:66
Jun 2 01:19:41 somehost iwd[767]: #011Bands: 2.4 GHz 5 GHz
Jun 2 01:19:41 somehost iwd[767]: #011Ciphers: CCMP TKIP BIP
Jun 2 01:19:41 somehost iwd[767]: #011Supported iftypes: ad-hoc station ap p2p-client p2p-go p2p-device
Jun 2 01:19:41 somehost iwd[767]: Wiphy phy0 will only use the default interface
Jun 2 01:19:41 somehost kernel: [ 169.433109] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save disabled
Jun 2 01:19:41 somehost iwd[767]: Failed to load /usr/local/share/ca-certificates/user.crt
Thanks!
Martin
-- System Information:
Debian Release: bullseye/sid
Architecture: armhf (armv7l)
Kernel: Linux 5.6.14-v7l+ (SMP w/4 CPU cores)
Kernel taint flags: TAINT_CRAP
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8),
LANGUAGE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages iwd depends on:
ii libc6 2.30-8+rpi1
ii libreadline8 8.0-4
iwd recommends no packages.
iwd suggests no packages.
-- no debconf information
8 months, 1 week
IWD on arch64 startup errors
by KeithG
I have been running iwd on armv6 and v7 for a while without issue. I
finally got an image or Arch aarch64 on my RPI running (kernel 5.4.44) and
cannot start the already compiled for aarch64 version of iwd on this
kernel. The journal shows this:
Jun 18 23:34:02 rune64 systemd[1]: Starting Wireless service...
Jun 18 23:34:03 rune64 iwd[4088]: No HMAC(SHA1) support found
Jun 18 23:34:03 rune64 iwd[4088]: No HMAC(MD5) support found
Jun 18 23:34:03 rune64 iwd[4088]: No CMAC(AES) support found
Jun 18 23:34:03 rune64 iwd[4088]: No HMAC(SHA256) support not found
Jun 18 23:34:03 rune64 iwd[4088]: No HMAC(SHA512) support found, certain
TLS connections might fail
Jun 18 23:34:03 rune64 iwd[4088]: No Diffie-Hellman support found, WPS will
not be available
Jun 18 23:34:03 rune64 iwd[4088]: The following options are missing in the
kernel:
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_USER_API_HASH
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_KEY_DH_OPERATIONS
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_MD5
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_SHA256
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_AES
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_CMAC
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_USER_API_HASH
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_USER_API_HASH
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_USER_API_HASH
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_HMAC
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_HMAC
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_HMAC
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_SHA512
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_SHA1
Jun 18 23:34:03 rune64 iwd[4088]: The following optimized implementations
might be available:
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_SHA1_SSSE3
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_AES_NI_INTEL
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_SHA512_SSSE3
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_AES_X86_64
Jun 18 23:34:03 rune64 iwd[4088]: CONFIG_CRYPTO_SHA256_SSSE3
Jun 18 23:34:03 rune64 systemd[1]: iwd.service: Main process exited,
code=exited, status=1/FAILURE
Jun 18 23:34:03 rune64 systemd[1]: iwd.service: Failed with result
'exit-code'.
Jun 18 23:34:03 rune64 systemd[1]: Failed to start Wireless service.
I recently built this kernel on a system that was running 5.7.x and iwd
1.7.1 was also built on this kernel. When I run iwd on 5.7.x, it runs and
functions. I checked the config and most of these appear as modules but are
not built in. Must they be built in?
Keith
8 months, 1 week
[PATCH 0/1] Work around hanging ofono
by James Prestwood
Not sure if anyone else has experienced this, but occationally any
of the tests using ofono will hang on exit. I traced this into glib
waiting for something, but that something never happens. The test
itself is executing fine and successful but ofono seems to not want
to exit gracefully. It looks to be timing dependent as it rarely
happens, and when it does adding a debug print or any other code
usually makes it go away. Even this patch itself made the issue
'go away' for me.
Obviously the proper fix is figuring out where the race condition
is in ofono, but I also think having an ultimate timeout on
kill_process() would be useful which is what this patch is adding.
James Prestwood (1):
test-runner: use WNOHANG option waiting for PID
tools/test-runner.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
--
2.21.1
8 months, 1 week
[PATCH v3 1/4] station: add ANQP state watch API
by James Prestwood
This is to allow network to watch for ANQP activity in order to
fix the race condition between scanning finishing and ANQP finishing.
Without this it is possible for a DBus Connect() to come in before
ANQP has completed and causing the network to return NotConfigured,
when its actually in the process of obtaining all the network info.
The watch was made globally in station due to network not having
a station object until each individual network is created. Adding a
watch during network creation would result in many watchers as well
as a lot of removal/addition as networks are found and lost.
---
src/station.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++---
src/station.h | 13 +++++++++++++
2 files changed, 63 insertions(+), 3 deletions(-)
diff --git a/src/station.c b/src/station.c
index 87fadc3f..f0a0e810 100644
--- a/src/station.c
+++ b/src/station.c
@@ -59,6 +59,7 @@ static uint32_t netdev_watch;
static uint32_t mfp_setting;
static bool anqp_disabled;
static bool netconfig_enabled;
+static struct watchlist anqp_watches;
struct station {
enum station_state state;
@@ -434,6 +435,32 @@ static void network_add_foreach(struct network *network, void *user_data)
station_add_autoconnect_bss(station, network, bss);
}
+static bool match_pending(const void *a, const void *b)
+{
+ const struct anqp_entry *entry = a;
+
+ return entry->pending != 0;
+}
+
+static void remove_anqp(void *data)
+{
+ struct anqp_entry *entry = data;
+
+ l_free(entry);
+}
+
+static bool anqp_entry_foreach(void *data, void *user_data)
+{
+ struct anqp_entry *e = data;
+
+ WATCHLIST_NOTIFY(&anqp_watches, station_anqp_watch_func_t,
+ STATION_ANQP_FINISHED, e->network);
+
+ remove_anqp(e);
+
+ return true;
+}
+
static void station_anqp_response_cb(enum anqp_result result,
const void *anqp, size_t anqp_len,
void *user_data)
@@ -487,12 +514,15 @@ static void station_anqp_response_cb(enum anqp_result result,
l_strv_free(realms);
request_done:
- l_queue_remove(station->anqp_pending, entry);
+ entry->pending = 0;
- /* If no more requests, resume scanning */
- if (!l_queue_isempty(station->anqp_pending))
+ /* Return if there are other pending requests */
+ if (l_queue_find(station->anqp_pending, match_pending, NULL))
return;
+ /* Notify all watchers now that every ANQP request has finished */
+ l_queue_foreach_remove(station->anqp_pending, anqp_entry_foreach, NULL);
+
l_queue_destroy(station->autoconnect_list, l_free);
station->autoconnect_list = l_queue_new();
@@ -564,6 +594,8 @@ static bool station_start_anqp(struct station *station, struct network *network,
l_queue_push_head(station->anqp_pending, entry);
+ WATCHLIST_NOTIFY(&anqp_watches, station_anqp_watch_func_t,
+ STATION_ANQP_STARTED, network);
return true;
}
@@ -1217,6 +1249,18 @@ bool station_remove_state_watch(struct station *station, uint32_t id)
return watchlist_remove(&station->state_watches, id);
}
+uint32_t station_add_anqp_watch(station_anqp_watch_func_t func,
+ void *user_data,
+ station_destroy_func_t destroy)
+{
+ return watchlist_add(&anqp_watches, func, user_data, destroy);
+}
+
+void station_remove_anqp_watch(uint32_t id)
+{
+ watchlist_remove(&anqp_watches, id);
+}
+
bool station_set_autoconnect(struct station *station, bool autoconnect)
{
if (station->autoconnect == autoconnect)
@@ -3270,6 +3314,8 @@ static int station_init(void)
if (!netconfig_enabled)
l_info("station: Network configuration is disabled.");
+ watchlist_init(&anqp_watches, NULL);
+
return 0;
}
@@ -3279,6 +3325,7 @@ static void station_exit(void)
netdev_watch_remove(netdev_watch);
l_queue_destroy(station_list, NULL);
station_list = NULL;
+ watchlist_destroy(&anqp_watches);
}
IWD_MODULE(station, station_init, station_exit)
diff --git a/src/station.h b/src/station.h
index 4155081b..17a0f8df 100644
--- a/src/station.h
+++ b/src/station.h
@@ -43,8 +43,16 @@ enum station_state {
STATION_STATE_ROAMING
};
+enum station_anqp_state {
+ STATION_ANQP_STARTED,
+ STATION_ANQP_FINISHED,
+};
+
typedef void (*station_foreach_func_t)(struct station *, void *data);
typedef void (*station_state_watch_func_t)(enum station_state, void *userdata);
+typedef void (*station_anqp_watch_func_t)(enum station_anqp_state,
+ struct network *network,
+ void *user_data);
typedef void (*station_destroy_func_t)(void *userdata);
typedef void (*station_network_foreach_func_t)(struct network *, void *data);
@@ -66,6 +74,11 @@ uint32_t station_add_state_watch(struct station *station,
station_destroy_func_t destroy);
bool station_remove_state_watch(struct station *station, uint32_t id);
+uint32_t station_add_anqp_watch(station_anqp_watch_func_t func,
+ void *user_data,
+ station_destroy_func_t destroy);
+void station_remove_anqp_watch(uint32_t id);
+
bool station_set_autoconnect(struct station *station, bool autoconnect);
void station_ap_directed_roam(struct station *station,
--
2.21.1
8 months, 2 weeks
[PATCH v2 1/4] station: add ANQP state watch API
by James Prestwood
This is to allow network to watch for ANQP activity in order to
fix the race condition between scanning finishing and ANQP finishing.
Without this it is possible for a DBus Connect() to come in before
ANQP has completed and causing the network to return NotConfigured,
when its actually in the process of obtaining all the network info.
The watch was made globally in station due to network not having
a station object until each individual network is created. Adding a
watch during network creation would result in many watchers as well
as a lot of removal/addition as networks are found and lost.
---
src/station.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++---
src/station.h | 13 ++++++++++++
2 files changed, 67 insertions(+), 3 deletions(-)
v2:
- Changed to notify ANQP watches after all the requests come in, not
as each comes in. This prevents Connect() and ANQP requests happening
at the same time.
diff --git a/src/station.c b/src/station.c
index 87fadc3f..2514573e 100644
--- a/src/station.c
+++ b/src/station.c
@@ -59,6 +59,7 @@ static uint32_t netdev_watch;
static uint32_t mfp_setting;
static bool anqp_disabled;
static bool netconfig_enabled;
+static struct watchlist anqp_watches;
struct station {
enum station_state state;
@@ -434,6 +435,36 @@ static void network_add_foreach(struct network *network, void *user_data)
station_add_autoconnect_bss(station, network, bss);
}
+static bool match_pending(const void *a, const void *b)
+{
+ const struct anqp_entry *entry = a;
+
+ return entry->pending != 0;
+}
+
+static void remove_anqp(void *data)
+{
+ struct anqp_entry *entry = data;
+ uint64_t wdev_id = netdev_get_wdev_id(entry->station->netdev);
+
+ if (entry->pending)
+ anqp_cancel(wdev_id, entry->pending);
+
+ l_free(entry);
+}
+
+static bool anqp_entry_foreach(void *data, void *user_data)
+{
+ struct anqp_entry *e = data;
+
+ WATCHLIST_NOTIFY(&anqp_watches, station_anqp_watch_func_t,
+ STATION_ANQP_FINISHED, e->network);
+
+ remove_anqp(e);
+
+ return true;
+}
+
static void station_anqp_response_cb(enum anqp_result result,
const void *anqp, size_t anqp_len,
void *user_data)
@@ -487,12 +518,15 @@ static void station_anqp_response_cb(enum anqp_result result,
l_strv_free(realms);
request_done:
- l_queue_remove(station->anqp_pending, entry);
+ entry->pending = 0;
- /* If no more requests, resume scanning */
- if (!l_queue_isempty(station->anqp_pending))
+ /* Return if there are other pending requests */
+ if (l_queue_find(station->anqp_pending, match_pending, NULL))
return;
+ /* Notify all watchers now that every ANQP request has finished */
+ l_queue_foreach_remove(station->anqp_pending, anqp_entry_foreach, NULL);
+
l_queue_destroy(station->autoconnect_list, l_free);
station->autoconnect_list = l_queue_new();
@@ -564,6 +598,8 @@ static bool station_start_anqp(struct station *station, struct network *network,
l_queue_push_head(station->anqp_pending, entry);
+ WATCHLIST_NOTIFY(&anqp_watches, station_anqp_watch_func_t,
+ STATION_ANQP_STARTED, network);
return true;
}
@@ -1217,6 +1253,18 @@ bool station_remove_state_watch(struct station *station, uint32_t id)
return watchlist_remove(&station->state_watches, id);
}
+uint32_t station_add_anqp_watch(station_anqp_watch_func_t func,
+ void *user_data,
+ station_destroy_func_t destroy)
+{
+ return watchlist_add(&anqp_watches, func, user_data, destroy);
+}
+
+void station_remove_anqp_watch(uint32_t id)
+{
+ watchlist_remove(&anqp_watches, id);
+}
+
bool station_set_autoconnect(struct station *station, bool autoconnect)
{
if (station->autoconnect == autoconnect)
@@ -3270,6 +3318,8 @@ static int station_init(void)
if (!netconfig_enabled)
l_info("station: Network configuration is disabled.");
+ watchlist_init(&anqp_watches, NULL);
+
return 0;
}
@@ -3279,6 +3329,7 @@ static void station_exit(void)
netdev_watch_remove(netdev_watch);
l_queue_destroy(station_list, NULL);
station_list = NULL;
+ watchlist_destroy(&anqp_watches);
}
IWD_MODULE(station, station_init, station_exit)
diff --git a/src/station.h b/src/station.h
index 4155081b..17a0f8df 100644
--- a/src/station.h
+++ b/src/station.h
@@ -43,8 +43,16 @@ enum station_state {
STATION_STATE_ROAMING
};
+enum station_anqp_state {
+ STATION_ANQP_STARTED,
+ STATION_ANQP_FINISHED,
+};
+
typedef void (*station_foreach_func_t)(struct station *, void *data);
typedef void (*station_state_watch_func_t)(enum station_state, void *userdata);
+typedef void (*station_anqp_watch_func_t)(enum station_anqp_state,
+ struct network *network,
+ void *user_data);
typedef void (*station_destroy_func_t)(void *userdata);
typedef void (*station_network_foreach_func_t)(struct network *, void *data);
@@ -66,6 +74,11 @@ uint32_t station_add_state_watch(struct station *station,
station_destroy_func_t destroy);
bool station_remove_state_watch(struct station *station, uint32_t id);
+uint32_t station_add_anqp_watch(station_anqp_watch_func_t func,
+ void *user_data,
+ station_destroy_func_t destroy);
+void station_remove_anqp_watch(uint32_t id);
+
bool station_set_autoconnect(struct station *station, bool autoconnect);
void station_ap_directed_roam(struct station *station,
--
2.21.1
8 months, 2 weeks
[PATCH 0/4] Delay connect after ANQP (for release?)
by James Prestwood
These were part of a larger set, but refactored to be stand alone.
Since these are fixing a recently discovered race condition we may
want them in the next release.
James Prestwood (4):
station: add ANQP state watch API
network: delay connect if ANQP has not completed
auto-t: add 'Delay' property to hwsim python module
auto-t: add test for delayed ANQP response
autotests/testHotspot/anqp_delay_test.py | 85 ++++++++++++++++++++++++
autotests/util/hwsim.py | 8 +++
src/network.c | 58 ++++++++++++++++
src/station.c | 21 ++++++
src/station.h | 13 ++++
5 files changed, 185 insertions(+)
create mode 100644 autotests/testHotspot/anqp_delay_test.py
--
2.21.1
8 months, 2 weeks
[PATCH] network: Change func. signature
by Tim Kourt
Change signature of network_connect_new_hidden_network to take
reference to the caller's l_dbus_message struct. This allows to
set the caller's l_dbus_message struct to NULL after replying in
the case of a failure.
==201== at 0x467C15: l_dbus_message_unref (dbus-message.c:412)
==201== by 0x412A51: station_hidden_network_scan_results (station.c:2504)
==201== by 0x41EAEA: scan_finished (scan.c:1505)
==201== by 0x41EC10: get_scan_done (scan.c:1535)
==201== by 0x462592: destroy_request (genl.c:673)
==201== by 0x462987: process_unicast (genl.c:988)
==201== by 0x462987: received_data (genl.c:1087)
==201== by 0x45F5A2: io_callback (io.c:126)
==201== by 0x45E8FD: l_main_iterate (main.c:474)
==201== by 0x45E9BB: l_main_run (main.c:521)
==201== by 0x45EBCA: l_main_run_with_signal (main.c:643)
==201== by 0x403B15: main (main.c:512)
---
src/network.c | 12 ++++++------
src/network.h | 2 +-
src/station.c | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/network.c b/src/network.c
index c08d7e72..170db3e5 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1166,7 +1166,7 @@ static struct l_dbus_message *network_connect(struct l_dbus *dbus,
}
void network_connect_new_hidden_network(struct network *network,
- struct l_dbus_message *message)
+ struct l_dbus_message **message)
{
struct station *station = network->station;
struct scan_bss *bss;
@@ -1183,7 +1183,7 @@ void network_connect_new_hidden_network(struct network *network,
bss = network_bss_select(network, true);
if (!bss) {
/* This should never happened for the hidden networks. */
- error = dbus_error_not_supported(message);
+ error = dbus_error_not_supported(*message);
goto reply_error;
}
@@ -1192,13 +1192,13 @@ void network_connect_new_hidden_network(struct network *network,
switch (network_get_security(network)) {
case SECURITY_PSK:
- error = network_connect_psk(network, bss, message);
+ error = network_connect_psk(network, bss, *message);
break;
case SECURITY_NONE:
- station_connect_network(station, network, bss, message);
+ station_connect_network(station, network, bss, *message);
return;
default:
- error = dbus_error_not_supported(message);
+ error = dbus_error_not_supported(*message);
break;
}
@@ -1208,7 +1208,7 @@ void network_connect_new_hidden_network(struct network *network,
return;
reply_error:
- dbus_pending_reply(&message, error);
+ dbus_pending_reply(message, error);
}
void network_blacklist_add(struct network *network, struct scan_bss *bss)
diff --git a/src/network.h b/src/network.h
index 8e0ed636..fbb120a7 100644
--- a/src/network.h
+++ b/src/network.h
@@ -70,7 +70,7 @@ int network_rank_compare(const void *a, const void *b, void *user);
void network_rank_update(struct network *network, bool connected);
void network_connect_new_hidden_network(struct network *network,
- struct l_dbus_message *message);
+ struct l_dbus_message **message);
void network_blacklist_add(struct network *network, struct scan_bss *bss);
diff --git a/src/station.c b/src/station.c
index 583016ab..87fadc3f 100644
--- a/src/station.c
+++ b/src/station.c
@@ -2500,7 +2500,7 @@ next:
network = network_psk ? : network_open;
- network_connect_new_hidden_network(network, msg);
+ network_connect_new_hidden_network(network, &msg);
l_dbus_message_unref(msg);
return true;
--
2.13.6
8 months, 2 weeks
[PATCH v2 1/3] station: Use separate msg holder for hidden connections
by Tim Kourt
Introduce hidden_pending to keep reference to the dbus message object
while we wait for the scan results to be returned while trying to
connect to a hidden network. This simplifies the logic by separating it
into two independent logical units: scanning, connecting and eliminates
a possibility of a memory leak in the case when Network.Connect being
initiated while Station.ConnectHiddenNetwork is in progress.
---
src/station.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/station.c b/src/station.c
index ca6a0b8e..583016ab 100644
--- a/src/station.c
+++ b/src/station.c
@@ -73,6 +73,7 @@ struct station {
struct l_hashmap *networks;
struct l_queue *networks_sorted;
struct l_dbus_message *connect_pending;
+ struct l_dbus_message *hidden_pending;
struct l_dbus_message *disconnect_pending;
struct l_dbus_message *scan_pending;
struct signal_agent *signal_agent;
@@ -2433,8 +2434,8 @@ static void station_hidden_network_scan_triggered(int err, void *user_data)
if (!err)
return;
- dbus_pending_reply(&station->connect_pending,
- dbus_error_failed(station->connect_pending));
+ dbus_pending_reply(&station->hidden_pending,
+ dbus_error_failed(station->hidden_pending));
}
static bool station_hidden_network_scan_results(int err,
@@ -2452,8 +2453,8 @@ static bool station_hidden_network_scan_results(int err,
l_debug("");
- msg = station->connect_pending;
- station->connect_pending = NULL;
+ msg = station->hidden_pending;
+ station->hidden_pending = NULL;
if (err) {
dbus_pending_reply(&msg, dbus_error_failed(msg));
@@ -2527,7 +2528,7 @@ static struct l_dbus_message *station_dbus_connect_hidden_network(
l_debug("");
- if (station->connect_pending || station_is_busy(station))
+ if (station->hidden_pending || station_is_busy(station))
return dbus_error_busy(message);
if (!l_dbus_message_get_arguments(message, "s", &ssid))
@@ -2553,7 +2554,7 @@ static struct l_dbus_message *station_dbus_connect_hidden_network(
if (!station->hidden_network_scan_id)
return dbus_error_failed(message);
- station->connect_pending = l_dbus_message_ref(message);
+ station->hidden_pending = l_dbus_message_ref(message);
return NULL;
}
@@ -3132,6 +3133,10 @@ static void station_free(struct station *station)
dbus_pending_reply(&station->connect_pending,
dbus_error_aborted(station->connect_pending));
+ if (station->hidden_pending)
+ dbus_pending_reply(&station->hidden_pending,
+ dbus_error_aborted(station->hidden_pending));
+
if (station->disconnect_pending)
dbus_pending_reply(&station->disconnect_pending,
dbus_error_aborted(station->disconnect_pending));
--
2.13.6
8 months, 2 weeks
[PATCH v2 1/2] scan: refactor start_next_scan_request to not send duplicate requests
by Alvin Šipraga
If start_scan_next_request() is called while a scan request
(NL80211_CMD_TRIGGER_SCAN) is still running, the same scan request will
be sent again. Add a check in the function to avoid sending a request if
one is already in progress.
This also fixes a crash that occurs if the following conditions are met:
- the duplicated request is the only request in the scan request
queue, and
- both scan requests fail with an error not EBUSY.
In this case, the first callback to scan_request_triggered() will delete
the request from the scan request queue. The second callback will find
an empty queue and consequently pass a NULL scan_request pointer to
scan_request_failed(), causing a segmentation fault.
---
src/scan.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/scan.c b/src/scan.c
index 718f7497..106fa81c 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -839,6 +839,9 @@ static bool start_next_scan_request(struct scan_context *sc)
if (sc->state != SCAN_STATE_NOT_RUNNING)
return true;
+ if (sc->start_cmd_id)
+ return true;
+
while (sr) {
if (!scan_request_send_trigger(sc, sr))
return true;
--
2.26.2
8 months, 2 weeks
[PATCH] station: Use separate msg holder for hidden connections
by Tim Kourt
Introduce hidden_pending to keep reference to the dbus message object
while we wait for the scan results to be returned while trying to
connect to a hidden network. This simplifies the logic by separating it
into two independent logical units: scanning, connecting and eliminates
a possibility of a memory leak in the case when Network.Connect being
initiated while Station.ConnectHiddenNetwork is in progress.
---
src/station.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/station.c b/src/station.c
index ca6a0b8e..583016ab 100644
--- a/src/station.c
+++ b/src/station.c
@@ -73,6 +73,7 @@ struct station {
struct l_hashmap *networks;
struct l_queue *networks_sorted;
struct l_dbus_message *connect_pending;
+ struct l_dbus_message *hidden_pending;
struct l_dbus_message *disconnect_pending;
struct l_dbus_message *scan_pending;
struct signal_agent *signal_agent;
@@ -2433,8 +2434,8 @@ static void station_hidden_network_scan_triggered(int err, void *user_data)
if (!err)
return;
- dbus_pending_reply(&station->connect_pending,
- dbus_error_failed(station->connect_pending));
+ dbus_pending_reply(&station->hidden_pending,
+ dbus_error_failed(station->hidden_pending));
}
static bool station_hidden_network_scan_results(int err,
@@ -2452,8 +2453,8 @@ static bool station_hidden_network_scan_results(int err,
l_debug("");
- msg = station->connect_pending;
- station->connect_pending = NULL;
+ msg = station->hidden_pending;
+ station->hidden_pending = NULL;
if (err) {
dbus_pending_reply(&msg, dbus_error_failed(msg));
@@ -2527,7 +2528,7 @@ static struct l_dbus_message *station_dbus_connect_hidden_network(
l_debug("");
- if (station->connect_pending || station_is_busy(station))
+ if (station->hidden_pending || station_is_busy(station))
return dbus_error_busy(message);
if (!l_dbus_message_get_arguments(message, "s", &ssid))
@@ -2553,7 +2554,7 @@ static struct l_dbus_message *station_dbus_connect_hidden_network(
if (!station->hidden_network_scan_id)
return dbus_error_failed(message);
- station->connect_pending = l_dbus_message_ref(message);
+ station->hidden_pending = l_dbus_message_ref(message);
return NULL;
}
@@ -3132,6 +3133,10 @@ static void station_free(struct station *station)
dbus_pending_reply(&station->connect_pending,
dbus_error_aborted(station->connect_pending));
+ if (station->hidden_pending)
+ dbus_pending_reply(&station->hidden_pending,
+ dbus_error_aborted(station->hidden_pending));
+
if (station->disconnect_pending)
dbus_pending_reply(&station->disconnect_pending,
dbus_error_aborted(station->disconnect_pending));
--
2.13.6
8 months, 2 weeks