3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-21 11:52:34 +01:00

wiphy: Move handshake_failed handler out of wiphy.c

This commit is contained in:
Denis Kenzior 2016-06-16 11:35:45 -05:00
parent 64d382cc89
commit c714b20102
2 changed files with 23 additions and 18 deletions

View File

@ -311,6 +311,27 @@ static void netdev_operstate_cb(bool success, void *user_data)
netdev->connect_cb(netdev, result, netdev->user_data);
}
static void netdev_handshake_failed(uint32_t ifindex,
const uint8_t *aa, const uint8_t *spa,
uint16_t reason_code, void *user_data)
{
struct l_genl_msg *msg;
struct netdev *netdev;
netdev = netdev_find(ifindex);
if (!netdev)
return;
l_error("4-Way Handshake failed for ifindex: %d", ifindex);
msg = netdev_build_cmd_deauthenticate(netdev, reason_code);
l_genl_family_send(nl80211, msg, NULL, NULL, NULL);
if (netdev->connect_cb)
netdev->connect_cb(netdev, NETDEV_RESULT_HANDSHAKE_FAILED,
netdev->user_data);
}
static void netdev_associate_event(struct l_genl_msg *msg,
struct netdev *netdev)
{
@ -772,6 +793,8 @@ bool netdev_init(struct l_genl_family *in)
NULL, NULL))
l_error("Registering for MLME notification failed");
__eapol_set_deauthenticate_func(netdev_handshake_failed);
return true;
}

View File

@ -495,23 +495,6 @@ static void setting_keys_failed(struct device *device, uint16_t reason_code)
device_enter_state(device, DEVICE_STATE_DISCONNECTING);
}
static void handshake_failed(uint32_t ifindex,
const uint8_t *aa, const uint8_t *spa,
uint16_t reason_code, void *user_data)
{
struct device *device = user_data;
struct l_genl_msg *msg;
l_error("4-Way Handshake failed for ifindex: %d", ifindex);
msg = l_genl_msg_new_sized(NL80211_CMD_DEAUTHENTICATE, 512);
msg_append_attr(msg, NL80211_ATTR_IFINDEX, 4, &ifindex);
msg_append_attr(msg, NL80211_ATTR_REASON_CODE, 2, &reason_code);
msg_append_attr(msg, NL80211_ATTR_MAC, ETH_ALEN, aa);
l_genl_family_send(nl80211, msg, deauthenticate_cb, device, NULL);
device_enter_state(device, DEVICE_STATE_DISCONNECTING);
}
static void mlme_set_pairwise_key_cb(struct l_genl_msg *msg, void *data)
{
struct device *device = data;
@ -1445,7 +1428,6 @@ bool wiphy_init(struct l_genl_family *in)
__eapol_set_install_tk_func(wiphy_set_tk);
__eapol_set_install_gtk_func(wiphy_set_gtk);
__eapol_set_deauthenticate_func(handshake_failed);
wiphy_list = l_queue_new();
device_list = l_queue_new();