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

netdev: Move CMD_DEAUTHENTICATE builder to nl80211util

This commit is contained in:
Denis Kenzior 2023-11-14 09:26:49 -06:00
parent 7498eaae62
commit 904373eee7
3 changed files with 21 additions and 16 deletions

View File

@ -1298,20 +1298,6 @@ static void netdev_deauthenticate_event(struct l_genl_msg *msg,
MMPDU_STATUS_CODE_UNSPECIFIED); MMPDU_STATUS_CODE_UNSPECIFIED);
} }
static struct l_genl_msg *netdev_build_cmd_deauthenticate(struct netdev *netdev,
uint16_t reason_code)
{
struct l_genl_msg *msg;
msg = l_genl_msg_new_sized(NL80211_CMD_DEAUTHENTICATE, 128);
l_genl_msg_append_attr(msg, NL80211_ATTR_IFINDEX, 4, &netdev->index);
l_genl_msg_append_attr(msg, NL80211_ATTR_REASON_CODE, 2, &reason_code);
l_genl_msg_append_attr(msg, NL80211_ATTR_MAC, ETH_ALEN,
netdev->handshake->aa);
return msg;
}
static struct l_genl_msg *netdev_build_cmd_del_station(struct netdev *netdev, static struct l_genl_msg *netdev_build_cmd_del_station(struct netdev *netdev,
const uint8_t *sta, const uint8_t *sta,
uint16_t reason_code, uint16_t reason_code,
@ -3028,7 +3014,8 @@ static void netdev_cmd_ft_reassociate_cb(struct l_genl_msg *msg,
netdev->result = NETDEV_RESULT_ASSOCIATION_FAILED; netdev->result = NETDEV_RESULT_ASSOCIATION_FAILED;
netdev->last_code = MMPDU_STATUS_CODE_UNSPECIFIED; netdev->last_code = MMPDU_STATUS_CODE_UNSPECIFIED;
cmd_deauth = netdev_build_cmd_deauthenticate(netdev, cmd_deauth = nl80211_build_deauthenticate(netdev->index,
netdev->handshake->aa,
MMPDU_REASON_CODE_UNSPECIFIED); MMPDU_REASON_CODE_UNSPECIFIED);
netdev->disconnect_cmd_id = l_genl_family_send(nl80211, netdev->disconnect_cmd_id = l_genl_family_send(nl80211,
cmd_deauth, cmd_deauth,
@ -3163,7 +3150,8 @@ static void netdev_authenticate_event(struct l_genl_msg *msg,
netdev->result = NETDEV_RESULT_ASSOCIATION_FAILED; netdev->result = NETDEV_RESULT_ASSOCIATION_FAILED;
netdev->last_code = MMPDU_STATUS_CODE_UNSPECIFIED; netdev->last_code = MMPDU_STATUS_CODE_UNSPECIFIED;
cmd_deauth = netdev_build_cmd_deauthenticate(netdev, cmd_deauth = nl80211_build_deauthenticate(netdev->index,
netdev->handshake->aa,
MMPDU_REASON_CODE_UNSPECIFIED); MMPDU_REASON_CODE_UNSPECIFIED);
netdev->disconnect_cmd_id = l_genl_family_send(nl80211, netdev->disconnect_cmd_id = l_genl_family_send(nl80211,
cmd_deauth, cmd_deauth,

View File

@ -284,6 +284,20 @@ done:
return ret; return ret;
} }
struct l_genl_msg *nl80211_build_deauthenticate(uint32_t ifindex,
const uint8_t addr[static 6],
uint16_t reason_code)
{
struct l_genl_msg *msg;
msg = l_genl_msg_new_sized(NL80211_CMD_DEAUTHENTICATE, 128);
l_genl_msg_append_attr(msg, NL80211_ATTR_IFINDEX, 4, &ifindex);
l_genl_msg_append_attr(msg, NL80211_ATTR_REASON_CODE, 2, &reason_code);
l_genl_msg_append_attr(msg, NL80211_ATTR_MAC, ETH_ALEN, addr);
return msg;
}
struct l_genl_msg *nl80211_build_disconnect(uint32_t ifindex, struct l_genl_msg *nl80211_build_disconnect(uint32_t ifindex,
uint16_t reason_code) uint16_t reason_code)
{ {

View File

@ -28,6 +28,9 @@ struct band_freq_attrs;
int nl80211_parse_attrs(struct l_genl_msg *msg, int tag, ...); int nl80211_parse_attrs(struct l_genl_msg *msg, int tag, ...);
struct l_genl_msg *nl80211_build_deauthenticate(uint32_t ifindex,
const uint8_t addr[static 6],
uint16_t reason_code);
struct l_genl_msg *nl80211_build_disconnect(uint32_t ifindex, struct l_genl_msg *nl80211_build_disconnect(uint32_t ifindex,
uint16_t reason_code); uint16_t reason_code);