From 69e8e7817e5d3ce24664e7e9bbfd73bfa982452a Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 30 Aug 2019 15:41:58 +0300 Subject: [PATCH] HS 2.0: Do not add two copies of OSEN element into Beacon/Probe Resp OSEN element was getting added both through the Authenticator IEs (before some non-vendor elements) and separately at the end of the frames with other vendor elements. Fix this by removing the separate addition of the OSEN element and by moving the Authenticator IE addition for OSEN to match the design used with WPA so that the vendor element gets added in the proper place in the sequence of IEs. Signed-off-by: Jouni Malinen --- src/ap/beacon.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ap/beacon.c b/src/ap/beacon.c index a51b94960..f3bdf30aa 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -456,7 +456,8 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, pos = hostapd_eid_ext_supp_rates(hapd, pos); /* RSN, MDIE */ - if (hapd->conf->wpa != WPA_PROTO_WPA) + if (!(hapd->conf->wpa == WPA_PROTO_WPA || + (hapd->conf->osen && !hapd->conf->wpa))) pos = hostapd_eid_wpa(hapd, pos, epos - pos); pos = hostapd_eid_bss_load(hapd, pos, epos - pos); @@ -523,7 +524,8 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, #endif /* CONFIG_IEEE80211AC */ /* WPA */ - if (hapd->conf->wpa == WPA_PROTO_WPA) + if (hapd->conf->wpa == WPA_PROTO_WPA || + (hapd->conf->osen && !hapd->conf->wpa)) pos = hostapd_eid_wpa(hapd, pos, epos - pos); /* Wi-Fi Alliance WMM */ @@ -553,7 +555,6 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, #ifdef CONFIG_HS20 pos = hostapd_eid_hs20_indication(hapd, pos); - pos = hostapd_eid_osen(hapd, pos); #endif /* CONFIG_HS20 */ pos = hostapd_eid_mbo(hapd, pos, (u8 *) resp + buflen - pos); @@ -1164,7 +1165,8 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd, tailpos = hostapd_eid_ext_supp_rates(hapd, tailpos); /* RSN, MDIE */ - if (hapd->conf->wpa != WPA_PROTO_WPA) + if (!(hapd->conf->wpa == WPA_PROTO_WPA || + (hapd->conf->osen && !hapd->conf->wpa))) tailpos = hostapd_eid_wpa(hapd, tailpos, tail + BEACON_TAIL_BUF_SIZE - tailpos); @@ -1240,7 +1242,8 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd, #endif /* CONFIG_IEEE80211AC */ /* WPA */ - if (hapd->conf->wpa == WPA_PROTO_WPA) + if (hapd->conf->wpa == WPA_PROTO_WPA || + (hapd->conf->osen && !hapd->conf->wpa)) tailpos = hostapd_eid_wpa(hapd, tailpos, tail + BEACON_TAIL_BUF_SIZE - tailpos); @@ -1271,7 +1274,6 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd, #ifdef CONFIG_HS20 tailpos = hostapd_eid_hs20_indication(hapd, tailpos); - tailpos = hostapd_eid_osen(hapd, tailpos); #endif /* CONFIG_HS20 */ tailpos = hostapd_eid_mbo(hapd, tailpos, tail + tail_len - tailpos);