about summary refs log tree commit diff stats
path: root/src/libwifi/gen/management/assoc_response.c
diff options
context:
space:
mode:
authorMarc <foxtrot@malloc.me>2022-01-29 00:17:41 +0000
committerGitHub <noreply@github.com>2022-01-29 00:17:41 +0000
commit62ea5defe6e5e71c5c90c0f3d3d5e8d5dd9c57f6 (patch)
tree626939c4b36126e285e1841912f2c2feb41f055b /src/libwifi/gen/management/assoc_response.c
parenta9a46f40228429e128390d4d4979788e2778e8d0 (diff)
parentd26739cec88e2d798f07eafce0396fcd87c4ba1c (diff)
downloadlibwifi-62ea5defe6e5e71c5c90c0f3d3d5e8d5dd9c57f6.tar.gz
libwifi-62ea5defe6e5e71c5c90c0f3d3d5e8d5dd9c57f6.tar.bz2
libwifi-62ea5defe6e5e71c5c90c0f3d3d5e8d5dd9c57f6.zip
Merge pull request #5 from libwifi/fixup
Improve header comments, add ability to always specify Management frame Address 3 field
Diffstat (limited to 'src/libwifi/gen/management/assoc_response.c')
-rw-r--r--src/libwifi/gen/management/assoc_response.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libwifi/gen/management/assoc_response.c b/src/libwifi/gen/management/assoc_response.c index 70f53d6..0fd145c 100644 --- a/src/libwifi/gen/management/assoc_response.c +++ b/src/libwifi/gen/management/assoc_response.c
@@ -33,7 +33,8 @@
33 */ 33 */
34size_t libwifi_get_assoc_resp_length(struct libwifi_assoc_resp *assoc_resp) { 34size_t libwifi_get_assoc_resp_length(struct libwifi_assoc_resp *assoc_resp) {
35 return sizeof(struct libwifi_mgmt_unordered_frame_header) + 35 return sizeof(struct libwifi_mgmt_unordered_frame_header) +
36 sizeof(struct libwifi_assoc_resp_fixed_parameters) + assoc_resp->tags.length; 36 sizeof(struct libwifi_assoc_resp_fixed_parameters) +
37 assoc_resp->tags.length;
37} 38}
38 39
39/** 40/**
@@ -61,14 +62,18 @@ int libwifi_set_assoc_resp_channel(struct libwifi_assoc_resp *assoc_resp, uint8_
61 * The generated association response frame is made with sane defaults defined in common.h and core/types.h. 62 * The generated association response frame is made with sane defaults defined in common.h and core/types.h.
62 * Two tagged parameters are also added to the association response: Channel and Supported Rates. 63 * Two tagged parameters are also added to the association response: Channel and Supported Rates.
63 */ 64 */
64int libwifi_create_assoc_resp(struct libwifi_assoc_resp *assoc_resp, const unsigned char receiver[6], 65int libwifi_create_assoc_resp(struct libwifi_assoc_resp *assoc_resp,
65 const unsigned char transmitter[6], uint8_t channel) { 66 const unsigned char receiver[6],
67 const unsigned char transmitter[6],
68 const unsigned char address3[6],
69 uint8_t channel) {
66 memset(assoc_resp, 0, sizeof(struct libwifi_assoc_resp)); 70 memset(assoc_resp, 0, sizeof(struct libwifi_assoc_resp));
67 71
68 assoc_resp->frame_header.frame_control.type = TYPE_MANAGEMENT; 72 assoc_resp->frame_header.frame_control.type = TYPE_MANAGEMENT;
69 assoc_resp->frame_header.frame_control.subtype = SUBTYPE_ASSOC_RESP; 73 assoc_resp->frame_header.frame_control.subtype = SUBTYPE_ASSOC_RESP;
70 memcpy(&assoc_resp->frame_header.addr1, receiver, 6); 74 memcpy(&assoc_resp->frame_header.addr1, receiver, 6);
71 memcpy(&assoc_resp->frame_header.addr2, transmitter, 6); 75 memcpy(&assoc_resp->frame_header.addr2, transmitter, 6);
76 memcpy(&assoc_resp->frame_header.addr3, address3, 6);
72 77
73 assoc_resp->fixed_parameters.capabilities_information = BYTESWAP16(LIBWIFI_DEFAULT_AP_CAPABS); 78 assoc_resp->fixed_parameters.capabilities_information = BYTESWAP16(LIBWIFI_DEFAULT_AP_CAPABS);
74 assoc_resp->fixed_parameters.status_code = STATUS_SUCCESS; 79 assoc_resp->fixed_parameters.status_code = STATUS_SUCCESS;