3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00

netdev: differentiate connect/auth timeouts

The warnings in the authenticate and connect events were identical
so it could be difficult knowing which print it was if IWD is not
in debug mode (to see more context). The prints were changed to
indicate which event it was and for the connect event the reason
attribute is also parsed.

Note the resp_ies_len is also initialized to zero now. After making
the changes gcc was throwing a warning.
This commit is contained in:
James Prestwood 2022-09-26 15:39:10 -07:00 committed by Denis Kenzior
parent dd80bbf397
commit a484b928ac

View File

@ -2734,8 +2734,10 @@ static void netdev_connect_event(struct l_genl_msg *msg, struct netdev *netdev)
size_t ies_len = 0; size_t ies_len = 0;
struct ie_tlv_iter iter; struct ie_tlv_iter iter;
const uint8_t *resp_ies = NULL; const uint8_t *resp_ies = NULL;
size_t resp_ies_len; size_t resp_ies_len = 0;
struct handshake_state *hs = netdev->handshake; struct handshake_state *hs = netdev->handshake;
bool timeout = false;
uint32_t timeout_reason = 0;
l_debug(""); l_debug("");
@ -2763,8 +2765,14 @@ static void netdev_connect_event(struct l_genl_msg *msg, struct netdev *netdev)
while (l_genl_attr_next(&attr, &type, &len, &data)) { while (l_genl_attr_next(&attr, &type, &len, &data)) {
switch (type) { switch (type) {
case NL80211_ATTR_TIMED_OUT: case NL80211_ATTR_TIMED_OUT:
l_warn("authentication timed out"); timeout = true;
goto error; break;
case NL80211_ATTR_TIMEOUT_REASON:
if (len != 4)
break;
timeout_reason = l_get_u32(data);
break;
case NL80211_ATTR_STATUS_CODE: case NL80211_ATTR_STATUS_CODE:
if (len == sizeof(uint16_t)) if (len == sizeof(uint16_t))
status_code = data; status_code = data;
@ -2780,6 +2788,11 @@ static void netdev_connect_event(struct l_genl_msg *msg, struct netdev *netdev)
} }
} }
if (timeout) {
l_warn("connect event timed out, reason=%u", timeout_reason);
goto error;
}
if (netdev->expect_connect_failure) { if (netdev->expect_connect_failure) {
/* /*
* The kernel may think we are connected when we are actually * The kernel may think we are connected when we are actually
@ -3106,7 +3119,7 @@ static void netdev_authenticate_event(struct l_genl_msg *msg,
while (l_genl_attr_next(&attr, &type, &len, &data)) { while (l_genl_attr_next(&attr, &type, &len, &data)) {
switch (type) { switch (type) {
case NL80211_ATTR_TIMED_OUT: case NL80211_ATTR_TIMED_OUT:
l_warn("authentication timed out"); l_warn("authentication event timed out");
if (auth_proto_auth_timeout(netdev->ap)) if (auth_proto_auth_timeout(netdev->ap))
return; return;