]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - wpa_supplicant/hs20_supplicant.c
OCE: Mandate PMF for WPA2 association with OCE AP
[thirdparty/hostap.git] / wpa_supplicant / hs20_supplicant.c
index f4187900ed42d418c257be6618233d064067e72c..cb236df18d86b5556031e1fa2e674cf1a8fbacb1 100644 (file)
@@ -95,8 +95,7 @@ void hs20_configure_frame_filters(struct wpa_supplicant *wpa_s)
                return;
        }
 
-       /* Check if Proxy ARP is enabled (2nd byte in the IE) */
-       if (ext_capa[3] & BIT(4))
+       if (wpa_bss_ext_capab(bss, WLAN_EXT_CAPAB_PROXY_ARP))
                filter |= WPA_DATA_FRAME_FILTER_FLAG_ARP |
                        WPA_DATA_FRAME_FILTER_FLAG_NA;
 
@@ -104,15 +103,22 @@ void hs20_configure_frame_filters(struct wpa_supplicant *wpa_s)
 }
 
 
-void wpas_hs20_add_indication(struct wpabuf *buf, int pps_mo_id)
+void wpas_hs20_add_indication(struct wpabuf *buf, int pps_mo_id, int ap_release)
 {
+       int release;
        u8 conf;
 
+       release = (HS20_VERSION >> 4) + 1;
+       if (ap_release > 0 && release > ap_release)
+               release = ap_release;
+       if (release < 2)
+               pps_mo_id = -1;
+
        wpabuf_put_u8(buf, WLAN_EID_VENDOR_SPECIFIC);
        wpabuf_put_u8(buf, pps_mo_id >= 0 ? 7 : 5);
        wpabuf_put_be24(buf, OUI_WFA);
        wpabuf_put_u8(buf, HS20_INDICATION_OUI_TYPE);
-       conf = HS20_VERSION;
+       conf = (release - 1) << 4;
        if (pps_mo_id >= 0)
                conf |= HS20_PPS_MO_ID_PRESENT;
        wpabuf_put_u8(buf, conf);
@@ -137,6 +143,21 @@ void wpas_hs20_add_roam_cons_sel(struct wpabuf *buf,
 }
 
 
+int get_hs20_version(struct wpa_bss *bss)
+{
+       const u8 *ie;
+
+       if (!bss)
+               return 0;
+
+       ie = wpa_bss_get_vendor_ie(bss, HS20_IE_VENDOR_TYPE);
+       if (!ie || ie[1] < 5)
+               return 0;
+
+       return ((ie[6] >> 4) & 0x0f) + 1;
+}
+
+
 int is_hs20_network(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
                    struct wpa_bss *bss)
 {
@@ -410,7 +431,7 @@ static void hs20_set_osu_access_permission(const char *osu_dir,
                return;
        }
 
-       if (chown(fname, statbuf.st_uid, statbuf.st_gid) < 0) {
+       if (lchown(fname, statbuf.st_uid, statbuf.st_gid) < 0) {
                wpa_printf(MSG_WARNING, "Cannot change the ownership for %s",
                           fname);
        }