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

nl80211util: include frame type with build_cmd_frame

The CMD_FRAME builder assumed action frames but can just as easily
be used with any frame type.
This commit is contained in:
James Prestwood 2022-09-21 15:31:45 -07:00 committed by Denis Kenzior
parent abcacce4be
commit 3d8865f2c0
4 changed files with 12 additions and 10 deletions

View File

@ -4338,6 +4338,7 @@ static uint32_t netdev_send_action_framev(struct netdev *netdev,
{ {
uint32_t id; uint32_t id;
struct l_genl_msg *msg = nl80211_build_cmd_frame(netdev->index, struct l_genl_msg *msg = nl80211_build_cmd_frame(netdev->index,
0x00d0,
netdev->addr, netdev->addr,
to, freq, to, freq,
iov, iov_len); iov, iov_len);

View File

@ -431,6 +431,7 @@ const void *nl80211_parse_get_key_seq(struct l_genl_msg *msg)
} }
struct l_genl_msg *nl80211_build_cmd_frame(uint32_t ifindex, struct l_genl_msg *nl80211_build_cmd_frame(uint32_t ifindex,
uint16_t frame_type,
const uint8_t *addr, const uint8_t *addr,
const uint8_t *to, const uint8_t *to,
uint32_t freq, uint32_t freq,
@ -439,18 +440,17 @@ struct l_genl_msg *nl80211_build_cmd_frame(uint32_t ifindex,
{ {
struct l_genl_msg *msg; struct l_genl_msg *msg;
struct iovec iovs[iov_len + 1]; struct iovec iovs[iov_len + 1];
const uint16_t frame_type = 0x00d0; uint8_t hdr[24];
uint8_t action_frame[24];
memset(action_frame, 0, 24); memset(hdr, 0, 24);
l_put_le16(frame_type, action_frame + 0); l_put_le16(frame_type, hdr + 0);
memcpy(action_frame + 4, to, 6); memcpy(hdr + 4, to, 6);
memcpy(action_frame + 10, addr, 6); memcpy(hdr + 10, addr, 6);
memcpy(action_frame + 16, to, 6); memcpy(hdr + 16, to, 6);
iovs[0].iov_base = action_frame; iovs[0].iov_base = hdr;
iovs[0].iov_len = sizeof(action_frame); iovs[0].iov_len = sizeof(hdr);
memcpy(iovs + 1, iov, sizeof(*iov) * iov_len); memcpy(iovs + 1, iov, sizeof(*iov) * iov_len);
msg = l_genl_msg_new_sized(NL80211_CMD_FRAME, 128 + 512); msg = l_genl_msg_new_sized(NL80211_CMD_FRAME, 128 + 512);

View File

@ -49,6 +49,7 @@ struct l_genl_msg *nl80211_build_get_key(uint32_t ifindex, uint8_t key_index);
const void *nl80211_parse_get_key_seq(struct l_genl_msg *msg); const void *nl80211_parse_get_key_seq(struct l_genl_msg *msg);
struct l_genl_msg *nl80211_build_cmd_frame(uint32_t ifindex, struct l_genl_msg *nl80211_build_cmd_frame(uint32_t ifindex,
uint16_t frame_type,
const uint8_t *addr, const uint8_t *addr,
const uint8_t *to, const uint8_t *to,
uint32_t freq, uint32_t freq,

View File

@ -194,7 +194,7 @@ static bool rrm_send_response(struct rrm_state *rrm,
iov.iov_base = (void *)frame; iov.iov_base = (void *)frame;
iov.iov_len = len; iov.iov_len = len;
msg = nl80211_build_cmd_frame(rrm->ifindex, own_addr, bss->addr, msg = nl80211_build_cmd_frame(rrm->ifindex, 0x00d0, own_addr, bss->addr,
bss->frequency, &iov, 1); bss->frequency, &iov, 1);
if (!l_genl_family_send(nl80211, msg, rrm_send_response_cb, if (!l_genl_family_send(nl80211, msg, rrm_send_response_cb,