aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2020-04-02 00:45:55 -0500
committerDenis Kenzior <denkenz@gmail.com>2020-04-06 15:56:46 -0500
commitaba3da32ac847a6d430f917855d30ae34af6cc90 (patch)
tree86a996324561df71f87f0348670ccbc23faf2480
parent5576722d2930c720c5ae867b194d5119b0bf7169 (diff)
downloadiwd-aba3da32ac847a6d430f917855d30ae34af6cc90.tar.gz
netdev: work around APs that send igtk in big endian
It seems some APs send the IGTK key in big endian format (it is a uin16). The kernel rightly reports an -EINVAL error when iwd issues a NEW_KEY with such a value, resulting in the connection being aborted. Work around this by trying to detect big-endian key indexes and 'fixing' them up.
-rw-r--r--src/netdev.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/netdev.c b/src/netdev.c
index 799f01e3b..f999a14c0 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -1297,6 +1297,14 @@ static void netdev_set_igtk(struct handshake_state *hs, uint16_t key_index,
return;
}
+ if (key_index == 0x0400 || key_index == 0x0500) {
+ l_warn("Received an invalid IGTK key index (%04hx)"
+ " that is likely in"
+ " big endian format. Trying to fix and"
+ " proceed anyway", key_index);
+ key_index = bswap_16(key_index);
+ }
+
msg = nl80211_build_new_key_group(netdev->index, cipher, key_index,
igtk_buf, igtk_len, ipn, ipn_len, NULL);