mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-24 15:22:34 +01:00
wiphy: Use CMD_DISCONNECT, not CMD_DEAUTHENTICATE
CMD_DEAUTHENTICATE seems to carry only the management frame pdu information. CMD_DISCONNECT is carrying the information that is actually needed by us: > Event: Disconnect (0x30) len 28 1140.118545 Wiphy: 0 (0x00000000) Interface Index: 3 (0x00000003) Reason Code: 2 (0x0002) Disconnect by AP: true
This commit is contained in:
parent
313dcbb8ff
commit
0b48ba3a4a
53
src/wiphy.c
53
src/wiphy.c
@ -1181,49 +1181,55 @@ error:
|
|||||||
|
|
||||||
static void mlme_deauthenticate_event(struct l_genl_msg *msg,
|
static void mlme_deauthenticate_event(struct l_genl_msg *msg,
|
||||||
struct netdev *netdev)
|
struct netdev *netdev)
|
||||||
|
{
|
||||||
|
l_debug("");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void mlme_disconnect_event(struct l_genl_msg *msg,
|
||||||
|
struct netdev *netdev)
|
||||||
{
|
{
|
||||||
struct l_genl_attr attr;
|
struct l_genl_attr attr;
|
||||||
uint16_t type, len;
|
uint16_t type, len;
|
||||||
const void *data;
|
const void *data;
|
||||||
struct l_dbus_message *reply;
|
uint16_t reason_code = 0;
|
||||||
int err;
|
bool disconnect_by_ap = false;
|
||||||
|
|
||||||
l_debug("");
|
l_debug("");
|
||||||
|
|
||||||
err = l_genl_msg_get_error(msg);
|
|
||||||
if (err < 0) {
|
|
||||||
l_error("authentication failed %s (%d)", strerror(-err), err);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!l_genl_attr_init(&attr, msg)) {
|
if (!l_genl_attr_init(&attr, msg)) {
|
||||||
l_debug("attr init failed");
|
l_error("attr init failed");
|
||||||
goto error;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
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_REASON_CODE:
|
||||||
l_warn("deauthentication timed out");
|
if (len != sizeof(uint16_t))
|
||||||
goto error;
|
l_warn("Invalid reason code attribute");
|
||||||
|
else
|
||||||
|
reason_code = *((uint16_t *) data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NL80211_ATTR_DISCONNECTED_BY_AP:
|
||||||
|
disconnect_by_ap = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
l_info("Deauthentication completed");
|
l_info("Received Deauthentication event, reason: %hu, from_ap: %s",
|
||||||
netdev->connected_bss = NULL;
|
reason_code, disconnect_by_ap ? "true" : "false");
|
||||||
|
|
||||||
if (!netdev->connect_pending)
|
if (!disconnect_by_ap)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
reply = l_dbus_message_new_method_return(netdev->connect_pending);
|
if (netdev->connect_pending) {
|
||||||
l_dbus_message_set_arguments(reply, "");
|
struct network *network = netdev->connected_bss->network;
|
||||||
dbus_pending_reply(&netdev->connect_pending, reply);
|
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
error:
|
|
||||||
dbus_pending_reply(&netdev->connect_pending,
|
dbus_pending_reply(&netdev->connect_pending,
|
||||||
dbus_error_failed(netdev->connect_pending));
|
dbus_error_failed(netdev->connect_pending));
|
||||||
|
}
|
||||||
|
|
||||||
netdev->connected_bss = NULL;
|
netdev->connected_bss = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1979,6 +1985,9 @@ static void wiphy_mlme_notify(struct l_genl_msg *msg, void *user_data)
|
|||||||
case NL80211_CMD_DEAUTHENTICATE:
|
case NL80211_CMD_DEAUTHENTICATE:
|
||||||
mlme_deauthenticate_event(msg, netdev);
|
mlme_deauthenticate_event(msg, netdev);
|
||||||
break;
|
break;
|
||||||
|
case NL80211_CMD_DISCONNECT:
|
||||||
|
mlme_disconnect_event(msg, netdev);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user