wpa_supplicant: Do not use struct ieee80211_mgmt::u.probe_req

This struct in the union is empty, but the design of using a zero-length
u8 array here is not fully compatible with C++ and can result in
undesired compiler warnings. Since there are no non-IE fields in the
Probe Request frames, get the location of the variable length IEs simply
by using the pointer to the frame header and the known header length.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2016-04-02 16:52:02 +03:00
parent e1b99620c9
commit c01120a05f

View file

@ -3706,12 +3706,14 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
#endif /* CONFIG_AP */ #endif /* CONFIG_AP */
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
if (stype == WLAN_FC_STYPE_PROBE_REQ && if (stype == WLAN_FC_STYPE_PROBE_REQ &&
data->rx_mgmt.frame_len > 24) { data->rx_mgmt.frame_len > IEEE80211_HDRLEN) {
const u8 *src = mgmt->sa; const u8 *src = mgmt->sa;
const u8 *ie = mgmt->u.probe_req.variable; const u8 *ie;
size_t ie_len = data->rx_mgmt.frame_len - size_t ie_len;
(mgmt->u.probe_req.variable -
data->rx_mgmt.frame); ie = data->rx_mgmt.frame + IEEE80211_HDRLEN;
ie_len = data->rx_mgmt.frame_len -
IEEE80211_HDRLEN;
wpas_p2p_probe_req_rx( wpas_p2p_probe_req_rx(
wpa_s, src, mgmt->da, wpa_s, src, mgmt->da,
mgmt->bssid, ie, ie_len, mgmt->bssid, ie, ie_len,
@ -3751,11 +3753,12 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
} }
if (stype == WLAN_FC_STYPE_PROBE_REQ && if (stype == WLAN_FC_STYPE_PROBE_REQ &&
data->rx_mgmt.frame_len > 24) { data->rx_mgmt.frame_len > IEEE80211_HDRLEN) {
const u8 *ie = mgmt->u.probe_req.variable; const u8 *ie;
size_t ie_len = data->rx_mgmt.frame_len - size_t ie_len;
(mgmt->u.probe_req.variable -
data->rx_mgmt.frame); ie = data->rx_mgmt.frame + IEEE80211_HDRLEN;
ie_len = data->rx_mgmt.frame_len - IEEE80211_HDRLEN;
wpas_notify_preq(wpa_s, mgmt->sa, mgmt->da, wpas_notify_preq(wpa_s, mgmt->sa, mgmt->da,
mgmt->bssid, ie, ie_len, mgmt->bssid, ie, ie_len,