eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 904373eee73902917c6f17445ab582974a540eb0
parent 7498eaae6241b43d9917efd4b242ad94b1d11e4f
Author: Denis Kenzior <denkenz@gmail.com>
Date:   Tue, 14 Nov 2023 09:26:49 -0600

netdev: Move CMD_DEAUTHENTICATE builder to nl80211util

Diffstat:
Msrc/netdev.c | 20++++----------------
Msrc/nl80211util.c | 14++++++++++++++
Msrc/nl80211util.h | 3+++
3 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/src/netdev.c b/src/netdev.c @@ -1298,20 +1298,6 @@ static void netdev_deauthenticate_event(struct l_genl_msg *msg, 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, const uint8_t *sta, 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->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); netdev->disconnect_cmd_id = l_genl_family_send(nl80211, cmd_deauth, @@ -3163,7 +3150,8 @@ static void netdev_authenticate_event(struct l_genl_msg *msg, netdev->result = NETDEV_RESULT_ASSOCIATION_FAILED; 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); netdev->disconnect_cmd_id = l_genl_family_send(nl80211, cmd_deauth, diff --git a/src/nl80211util.c b/src/nl80211util.c @@ -284,6 +284,20 @@ done: 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, uint16_t reason_code) { diff --git a/src/nl80211util.h b/src/nl80211util.h @@ -28,6 +28,9 @@ struct band_freq_attrs; 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, uint16_t reason_code);