diff --git a/src/common/binding/ieee80211/ieee80211.c b/src/common/binding/ieee80211/ieee80211.c index 9f0289e..b27d534 100644 --- a/src/common/binding/ieee80211/ieee80211.c +++ b/src/common/binding/ieee80211/ieee80211.c @@ -705,7 +705,8 @@ int ieee80211_create_associationresponse_response(uint8_t* buffer, int length, s header = (struct ieee80211_header_mgmt*)buffer; /* Management header frame */ - header->framecontrol = IEEE80211_FRAME_CONTROL(IEEE80211_FRAMECONTROL_TYPE_MGMT, IEEE80211_FRAMECONTROL_MGMT_SUBTYPE_ASSOCIATION_RESPONSE); + header->framecontrol = IEEE80211_FRAME_CONTROL(IEEE80211_FRAMECONTROL_TYPE_MGMT, + IEEE80211_FRAMECONTROL_MGMT_SUBTYPE_ASSOCIATION_RESPONSE); header->durationid = __cpu_to_le16(0); memcpy(header->da, params->station, ETH_ALEN); memcpy(header->sa, params->bssid, ETH_ALEN); @@ -734,9 +735,19 @@ int ieee80211_create_associationresponse_response(uint8_t* buffer, int length, s return -1; } - /*pos += result;*/ /* Comment for disable Dead inscrement Clang Analyzer warning */ + pos += result; responselength += result; + log_printf(LOG_DEBUG, "IEEE80211: Association Response IE length: %d", params->response_ies_len); + if (params->response_ies_len) { + log_hexdump(LOG_DEBUG, "IEEE80211: Response IEs", + params->response_ies, params->response_ies_len); + + memcpy(pos, params->response_ies, params->response_ies_len); + /* pos += params->response_ies_len; */ /* Comment for disable Dead inscrement Clang Analyzer warning */ + responselength += params->response_ies_len; + } + return responselength; } diff --git a/src/common/binding/ieee80211/ieee80211.h b/src/common/binding/ieee80211/ieee80211.h index 5a4b93c..f249529 100644 --- a/src/common/binding/ieee80211/ieee80211.h +++ b/src/common/binding/ieee80211/ieee80211.h @@ -577,6 +577,9 @@ struct ieee80211_associationresponse_params { int supportedratescount; uint8_t supportedrates[IEEE80211_SUPPORTEDRATE_MAX_COUNT]; + + int response_ies_len; + uint8_t *response_ies; }; int ieee80211_create_associationresponse_response(uint8_t* buffer, int length, struct ieee80211_associationresponse_params* params); diff --git a/src/wtp/binding/ieee80211/wifi_drivers.c b/src/wtp/binding/ieee80211/wifi_drivers.c index 1c113ce..1829de6 100644 --- a/src/wtp/binding/ieee80211/wifi_drivers.c +++ b/src/wtp/binding/ieee80211/wifi_drivers.c @@ -654,7 +654,7 @@ static void wifi_wlan_receive_station_mgmt_association_request(struct wifi_wlan* int ielength; int responselength; struct ieee80211_ie_items ieitems; - struct ieee80211_associationresponse_params ieee80211_params; + struct ieee80211_associationresponse_params params; struct wifi_station* station; uint16_t resultstatuscode; @@ -716,16 +716,18 @@ static void wifi_wlan_receive_station_mgmt_association_request(struct wifi_wlan* } /* Create association response packet */ - memset(&ieee80211_params, 0, sizeof(struct ieee80211_authentication_params)); - memcpy(ieee80211_params.bssid, wlan->address, ETH_ALEN); - memcpy(ieee80211_params.station, frame->sa, ETH_ALEN); - ieee80211_params.capability = wifi_wlan_check_capability(wlan, wlan->capability); - ieee80211_params.statuscode = resultstatuscode; - ieee80211_params.aid = IEEE80211_AID_FIELD | station->aid; - memcpy(ieee80211_params.supportedrates, wlan->device->supportedrates, wlan->device->supportedratescount); - ieee80211_params.supportedratescount = wlan->device->supportedratescount; + memset(¶ms, 0, sizeof(struct ieee80211_authentication_params)); + memcpy(params.bssid, wlan->address, ETH_ALEN); + memcpy(params.station, frame->sa, ETH_ALEN); + params.capability = wifi_wlan_check_capability(wlan, wlan->capability); + params.statuscode = resultstatuscode; + params.aid = IEEE80211_AID_FIELD | station->aid; + memcpy(params.supportedrates, wlan->device->supportedrates, wlan->device->supportedratescount); + params.supportedratescount = wlan->device->supportedratescount; + params.response_ies = wlan->response_ies; + params.response_ies_len = wlan->response_ies_len; - responselength = ieee80211_create_associationresponse_response(g_bufferIEEE80211, sizeof(g_bufferIEEE80211), &ieee80211_params); + responselength = ieee80211_create_associationresponse_response(g_bufferIEEE80211, sizeof(g_bufferIEEE80211), ¶ms); if (responselength > 0) { if (!wlan->device->instance->ops->wlan_sendframe(wlan, g_bufferIEEE80211, responselength, wlan->device->currentfrequency.frequency, 0, 0, 0, 0)) { capwap_logging_info("Sent IEEE802.11 Association Response to %s station with %d status code", station->addrtext, (int)resultstatuscode);