]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpa_supplicant: Do not use struct ieee80211_mgmt::u.probe_req
authorJouni Malinen <j@w1.fi>
Sat, 2 Apr 2016 13:52:02 +0000 (16:52 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 2 Apr 2016 13:55:02 +0000 (16:55 +0300)
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>
wpa_supplicant/events.c

index 3c3f6268d43edc3dba9131de32eda73cec86010a..e7ff150508d2aa3918756b8f9f0b931aaf28b37f 100644 (file)
@@ -3706,12 +3706,14 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 #endif /* CONFIG_AP */
 #ifdef CONFIG_P2P
                        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 *ie = mgmt->u.probe_req.variable;
-                               size_t ie_len = data->rx_mgmt.frame_len -
-                                       (mgmt->u.probe_req.variable -
-                                        data->rx_mgmt.frame);
+                               const u8 *ie;
+                               size_t ie_len;
+
+                               ie = data->rx_mgmt.frame + IEEE80211_HDRLEN;
+                               ie_len = data->rx_mgmt.frame_len -
+                                       IEEE80211_HDRLEN;
                                wpas_p2p_probe_req_rx(
                                        wpa_s, src, mgmt->da,
                                        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 &&
-                   data->rx_mgmt.frame_len > 24) {
-                       const u8 *ie = mgmt->u.probe_req.variable;
-                       size_t ie_len = data->rx_mgmt.frame_len -
-                               (mgmt->u.probe_req.variable -
-                                data->rx_mgmt.frame);
+                   data->rx_mgmt.frame_len > IEEE80211_HDRLEN) {
+                       const u8 *ie;
+                       size_t ie_len;
+
+                       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,
                                         mgmt->bssid, ie, ie_len,