hostapd: fix auth encryption

hostapd currently tries to encrypt all auth frames,
except for "OPEN" and "SHARED with transaction 3".
This means that it will send an encrypted "unknown
auth algorithm" reply for all other algorithsm. Fix
this by changing the logic to only encrypt shared
key auth frames with transaction 3.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
This commit is contained in:
Johannes Berg 2009-07-26 21:15:47 +03:00 committed by Jouni Malinen
parent 2e8eac2d67
commit 7a47d567cf

View file

@ -2197,7 +2197,7 @@ static int wpa_driver_nl80211_send_mlme(void *priv, const u8 *data,
{
struct wpa_driver_nl80211_data *drv = priv;
struct ieee80211_mgmt *mgmt;
int do_not_encrypt = 0;
int encrypt = 1;
u16 fc;
mgmt = (struct ieee80211_mgmt *) data;
@ -2213,13 +2213,11 @@ static int wpa_driver_nl80211_send_mlme(void *priv, const u8 *data,
*/
u16 auth_alg = le_to_host16(mgmt->u.auth.auth_alg);
u16 auth_trans = le_to_host16(mgmt->u.auth.auth_transaction);
if (auth_alg == WLAN_AUTH_OPEN ||
(auth_alg == WLAN_AUTH_SHARED_KEY && auth_trans != 3))
do_not_encrypt = 1;
if (auth_alg != WLAN_AUTH_SHARED_KEY || auth_trans != 3)
encrypt = 0;
}
return wpa_driver_nl80211_send_frame(drv, data, data_len,
!do_not_encrypt);
return wpa_driver_nl80211_send_frame(drv, data, data_len, encrypt);
}