mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 17:59:25 +01:00
netdev: Send SET STATION in pairwise key callback
When the 4-Way Handshake is done eapol.c calls netdev_set_tk, then optionally netdev_set_gtk and netdev_set_igtk. To support the no group key option send the final SET STATION enabling the controlled port inside the callback for the netdev_set_tk operation which always means the end of a 4-Way Handshake rather than in the netdev_set_gtk callback. The spec says exactly that the controlled port is enabled at the end of the 4-Way Handshake. The netlink operations will still be queued in the same order because the netdev_set_tk/netdev_set_gtk/netdev_set_igtk calls happen in one main loop iteration but even if the order changed it wouldn't matter. On failure of any of the three operations netdev_setting_keys_failed gets called and the remaining operations are cancelled.
This commit is contained in:
parent
ffcda135d2
commit
a03839f8ef
29
src/netdev.c
29
src/netdev.c
@ -949,19 +949,10 @@ static void netdev_new_group_key_cb(struct l_genl_msg *msg, void *data)
|
||||
|
||||
netdev->group_new_key_cmd_id = 0;
|
||||
|
||||
if (l_genl_msg_get_error(msg) < 0) {
|
||||
l_error("New Key for Group Key failed for ifindex: %d",
|
||||
netdev->index);
|
||||
goto error;
|
||||
}
|
||||
|
||||
msg = netdev_build_cmd_set_station(netdev);
|
||||
|
||||
if (l_genl_family_send(nl80211, msg, netdev_set_station_cb,
|
||||
netdev, NULL) > 0)
|
||||
if (l_genl_msg_get_error(msg) >= 0)
|
||||
return;
|
||||
|
||||
error:
|
||||
l_error("New Key for Group Key failed for ifindex: %d", netdev->index);
|
||||
netdev_setting_keys_failed(netdev, MMPDU_REASON_CODE_UNSPECIFIED);
|
||||
}
|
||||
|
||||
@ -1125,11 +1116,21 @@ static void netdev_set_pairwise_key_cb(struct l_genl_msg *msg, void *data)
|
||||
|
||||
netdev->pairwise_set_key_cmd_id = 0;
|
||||
|
||||
if (l_genl_msg_get_error(msg) >= 0)
|
||||
if (l_genl_msg_get_error(msg) < 0) {
|
||||
l_error("Set Key for Pairwise Key failed for ifindex: %d",
|
||||
netdev->index);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (netdev->operational)
|
||||
return;
|
||||
|
||||
l_error("Set Key for Pairwise Key failed for ifindex: %d",
|
||||
netdev->index);
|
||||
msg = netdev_build_cmd_set_station(netdev);
|
||||
|
||||
l_genl_family_send(nl80211, msg, netdev_set_station_cb, netdev, NULL);
|
||||
return;
|
||||
|
||||
error:
|
||||
netdev_setting_keys_failed(netdev, MMPDU_REASON_CODE_UNSPECIFIED);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user