diff options
author | Denis Kenzior <denkenz@gmail.com> | 2020-06-12 15:21:39 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2020-06-12 15:21:39 -0500 |
commit | 254cefcc96a994c70cf7caf2822d77224f7ca173 (patch) | |
tree | c4a0a40967751a65a46b569a520a353792665ba9 | |
parent | e70b252e197690ec071c9ac0480dbfc2c5d06d52 (diff) | |
download | iwd-254cefcc96a994c70cf7caf2822d77224f7ca173.tar.gz |
station: Give network a connection failed hint
Right now, if the connection fails, then network always thinks that the
password should be re-asked. Loosen this to only do so if the
connection failed at least in the handshake phase. If the connection
failed due to Association / Authentication timeout, it is likely that
something is wrong with the AP and it can't respond.
-rw-r--r-- | src/network.c | 8 | ||||
-rw-r--r-- | src/network.h | 2 | ||||
-rw-r--r-- | src/station.c | 6 |
3 files changed, 10 insertions, 6 deletions
diff --git a/src/network.c b/src/network.c index 65a743781..70541b597 100644 --- a/src/network.c +++ b/src/network.c @@ -595,13 +595,13 @@ close_settings: return ret; } -void network_connect_failed(struct network *network) +void network_connect_failed(struct network *network, bool in_handshake) { /* - * Connection failed, if PSK try asking for the passphrase - * once more + * Connection failed during the handshake phase. If PSK try asking + * for the passphrase once more */ - if (network_get_security(network) == SECURITY_PSK) { + if (network_get_security(network) == SECURITY_PSK && in_handshake) { network->update_psk = false; network->ask_passphrase = true; } diff --git a/src/network.h b/src/network.h index fbb120a70..c008c04c0 100644 --- a/src/network.h +++ b/src/network.h @@ -53,7 +53,7 @@ const struct network_info *network_get_info(const struct network *network); void network_set_info(struct network *network, struct network_info *info); int network_autoconnect(struct network *network, struct scan_bss *bss); -void network_connect_failed(struct network *network); +void network_connect_failed(struct network *network, bool in_handshake); bool network_bss_add(struct network *network, struct scan_bss *bss); bool network_bss_list_isempty(struct network *network); void network_bss_list_clear(struct network *network); diff --git a/src/station.c b/src/station.c index f0a0e8103..80b6f07e7 100644 --- a/src/station.c +++ b/src/station.c @@ -2343,7 +2343,11 @@ static void station_connect_cb(struct netdev *netdev, enum netdev_result result, if (result != NETDEV_RESULT_OK) { if (result != NETDEV_RESULT_ABORTED) { - network_connect_failed(station->connected_network); + bool in_handshake = + result == NETDEV_RESULT_HANDSHAKE_FAILED; + + network_connect_failed(station->connected_network, + in_handshake); station_disassociated(station); } |