]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Add support for 60 GHz band
authorHamad Kadmany <qca_hkadmany@qca.qualcomm.com>
Mon, 27 Apr 2015 17:42:08 +0000 (20:42 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 27 Apr 2015 21:22:16 +0000 (00:22 +0300)
Handling of WPS RF band for 60 GHz was missing. Add it in all relevant
places and also map "AES" as the cipher to GCMP instead of CCMP when
operating on the 60 GHz band.

Signed-off-by: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
hostapd/config_file.c
hostapd/hostapd.conf
src/ap/ap_config.c
src/ap/wps_hostapd.c
src/wps/wps.h
src/wps/wps_common.c
src/wps/wps_defs.h
src/wps/wps_registrar.c
src/wps/wps_validate.c
wpa_supplicant/wps_supplicant.c

index 4976966e2d8285b4fcc78b6f0c0846e8c0cc95b7..0c1f401b202ab4e42776c0b525faa2804cfc8cba 100644 (file)
@@ -2545,7 +2545,9 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                        return 1;
                }
        } else if (os_strcmp(buf, "wps_rf_bands") == 0) {
-               if (os_strcmp(pos, "a") == 0)
+               if (os_strcmp(pos, "ad") == 0)
+                       bss->wps_rf_bands = WPS_RF_60GHZ;
+               else if (os_strcmp(pos, "a") == 0)
                        bss->wps_rf_bands = WPS_RF_50GHZ;
                else if (os_strcmp(pos, "g") == 0 ||
                         os_strcmp(pos, "b") == 0)
index b4754b360f2c703f9518cd769fd63d4404184a1b..5c6b28d01808a791a045f4ec46e822c499981a5e 100644 (file)
@@ -1433,7 +1433,7 @@ own_ip_addr=127.0.0.1
 # 12-digit, all-numeric code that identifies the consumer package.
 #upc=123456789012
 
-# WPS RF Bands (a = 5G, b = 2.4G, g = 2.4G, ag = dual band)
+# WPS RF Bands (a = 5G, b = 2.4G, g = 2.4G, ag = dual band, ad = 60 GHz)
 # This value should be set according to RF band(s) supported by the AP if
 # hw_mode is not set. For dual band dual concurrent devices, this needs to be
 # set to ag to allow both RF bands to be advertized.
index cccbfabb70d3846d140dba014ec39b7384329a22..c44f70d6c7e79dbc78a58a3635c8fcac51f21a82 100644 (file)
@@ -819,9 +819,9 @@ static int hostapd_config_check_bss(struct hostapd_bss_config *bss,
 
        if (full_config && bss->wps_state && bss->wpa &&
            (!(bss->wpa & 2) ||
-            !(bss->rsn_pairwise & WPA_CIPHER_CCMP))) {
+            !(bss->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP)))) {
                wpa_printf(MSG_INFO, "WPS: WPA/TKIP configuration without "
-                          "WPA2/CCMP forced WPS to be disabled");
+                          "WPA2/CCMP/GCMP forced WPS to be disabled");
                bss->wps_state = 0;
        }
 #endif /* CONFIG_WPS */
index 68eaeca1cce71b2e50b7d8fcdfd1e53dd1d177de..caed01e822689d5527f4837d8ce641731b3d57ae 100644 (file)
@@ -347,8 +347,12 @@ static int hapd_wps_reconfig_in_memory(struct hostapd_data *hapd,
                        bss->wpa_key_mgmt = WPA_KEY_MGMT_PSK;
 
                bss->wpa_pairwise = 0;
-               if (cred->encr_type & WPS_ENCR_AES)
-                       bss->wpa_pairwise |= WPA_CIPHER_CCMP;
+               if (cred->encr_type & WPS_ENCR_AES) {
+                       if (hapd->iconf->hw_mode == HOSTAPD_MODE_IEEE80211AD)
+                               bss->wpa_pairwise |= WPA_CIPHER_GCMP;
+                       else
+                               bss->wpa_pairwise |= WPA_CIPHER_CCMP;
+               }
                if (cred->encr_type & WPS_ENCR_TKIP)
                        bss->wpa_pairwise |= WPA_CIPHER_TKIP;
                bss->rsn_pairwise = bss->wpa_pairwise;
@@ -530,7 +534,11 @@ static int hapd_wps_cred_cb(struct hostapd_data *hapd, void *ctx)
                fprintf(nconf, "wpa_pairwise=");
                prefix = "";
                if (cred->encr_type & WPS_ENCR_AES) {
-                       fprintf(nconf, "CCMP");
+                       if (hapd->iconf->hw_mode == HOSTAPD_MODE_IEEE80211AD)
+                               fprintf(nconf, "GCMP");
+                       else
+                               fprintf(nconf, "CCMP");
+
                        prefix = " ";
                }
                if (cred->encr_type & WPS_ENCR_TKIP) {
@@ -844,7 +852,9 @@ static int hostapd_wps_rf_band_cb(void *ctx)
        struct hostapd_data *hapd = ctx;
 
        return hapd->iconf->hw_mode == HOSTAPD_MODE_IEEE80211A ?
-               WPS_RF_50GHZ : WPS_RF_24GHZ; /* FIX: dualband AP */
+               WPS_RF_50GHZ :
+               hapd->iconf->hw_mode == HOSTAPD_MODE_IEEE80211AD ?
+               WPS_RF_60GHZ : WPS_RF_24GHZ; /* FIX: dualband AP */
 }
 
 
@@ -1041,7 +1051,9 @@ int hostapd_init_wps(struct hostapd_data *hapd,
        } else {
                wps->dev.rf_bands =
                        hapd->iconf->hw_mode == HOSTAPD_MODE_IEEE80211A ?
-                       WPS_RF_50GHZ : WPS_RF_24GHZ; /* FIX: dualband AP */
+                       WPS_RF_50GHZ :
+                       hapd->iconf->hw_mode == HOSTAPD_MODE_IEEE80211AD ?
+                       WPS_RF_60GHZ : WPS_RF_24GHZ; /* FIX: dualband AP */
        }
 
        if (conf->wpa & WPA_PROTO_RSN) {
index c88aaa45eda154a25c643188750cd00d46b91f46..2c91d1678c157e07498631097ccb6e8ea09f91f8 100644 (file)
@@ -79,7 +79,7 @@ struct wps_credential {
  * @sec_dev_type: Array of secondary device types
  * @num_sec_dev_type: Number of secondary device types
  * @os_version: OS Version
- * @rf_bands: RF bands (WPS_RF_24GHZ, WPS_RF_50GHZ flags)
+ * @rf_bands: RF bands (WPS_RF_24GHZ, WPS_RF_50GHZ, WPS_RF_60GHZ flags)
  * @p2p: Whether the device is a P2P device
  */
 struct wps_device_data {
index c1ede6a9ea834a37a2a77b36aa41f4d6ba8560ff..16d466e0a2279990f15a30087b3fd1822af57ad7 100644 (file)
@@ -764,6 +764,8 @@ static int wps_build_ap_freq(struct wpabuf *msg, int freq)
                rf_band = WPS_RF_24GHZ;
        else if (mode == HOSTAPD_MODE_IEEE80211A)
                rf_band = WPS_RF_50GHZ;
+       else if (mode == HOSTAPD_MODE_IEEE80211AD)
+               rf_band = WPS_RF_60GHZ;
        else
                return 0; /* Unknown band */
        ap_channel = channel;
index 433415596ee3df2fe3ce3a1e56de1db94429dff7..a23b979d2e3c7d6835f5d61c6e42edf60c3bc323 100644 (file)
@@ -237,6 +237,7 @@ enum wps_error_indication {
 /* RF Bands */
 #define WPS_RF_24GHZ 0x01
 #define WPS_RF_50GHZ 0x02
+#define WPS_RF_60GHZ 0x04
 
 /* Config Methods */
 #define WPS_CONFIG_USBA 0x0001
index 48b7e1288af08d185087badf79e2b95a62a0f9d8..8bcf2b34f540bd71d7a775a4e01ac92e1b8dd7ef 100644 (file)
@@ -3226,8 +3226,13 @@ static enum wps_process_res wps_process_wsc_done(struct wps_data *wps,
                os_memset(&cred, 0, sizeof(cred));
                os_memcpy(cred.ssid, wps->wps->ssid, wps->wps->ssid_len);
                cred.ssid_len = wps->wps->ssid_len;
-               cred.auth_type = WPS_AUTH_WPAPSK | WPS_AUTH_WPA2PSK;
-               cred.encr_type = WPS_ENCR_TKIP | WPS_ENCR_AES;
+               if (wps->wps->rf_band_cb(wps->wps->cb_ctx) == WPS_RF_60GHZ) {
+                       cred.auth_type = WPS_AUTH_WPA2PSK;
+                       cred.encr_type = WPS_ENCR_AES;
+               } else {
+                       cred.auth_type = WPS_AUTH_WPAPSK | WPS_AUTH_WPA2PSK;
+                       cred.encr_type = WPS_ENCR_TKIP | WPS_ENCR_AES;
+               }
                os_memcpy(cred.key, wps->new_psk, wps->new_psk_len);
                cred.key_len = wps->new_psk_len;
 
index 1c6a14bce4bcd31edbc8e67bee3338d6a1cbdece..267b565e47847d82b6af7eec5996f2cc60ade670 100644 (file)
@@ -224,6 +224,8 @@ static int wps_validate_rf_bands(const u8 *rf_bands, int mandatory)
                return 0;
        }
        if (*rf_bands != WPS_RF_24GHZ && *rf_bands != WPS_RF_50GHZ &&
+           *rf_bands != WPS_RF_60GHZ &&
+           *rf_bands != (WPS_RF_24GHZ | WPS_RF_50GHZ | WPS_RF_60GHZ) &&
            *rf_bands != (WPS_RF_24GHZ | WPS_RF_50GHZ)) {
                wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Rf Bands "
                           "attribute value 0x%x", *rf_bands);
index e34573b661b6aacc9f7554ba585fec9f1eece5bf..8a5cb8e8fbd4946bc0b8b410f0052967169ce855 100644 (file)
@@ -888,7 +888,8 @@ static int wpa_supplicant_wps_rf_band(void *ctx)
        if (!wpa_s->current_ssid || !wpa_s->assoc_freq)
                return 0;
 
-       return (wpa_s->assoc_freq > 2484) ? WPS_RF_50GHZ : WPS_RF_24GHZ;
+       return (wpa_s->assoc_freq > 50000) ? WPS_RF_60GHZ :
+               (wpa_s->assoc_freq > 2484) ? WPS_RF_50GHZ : WPS_RF_24GHZ;
 }
 
 
@@ -1496,6 +1497,8 @@ int wpas_wps_init(struct wpa_supplicant *wpa_s)
                                wps->dev.rf_bands |= WPS_RF_24GHZ;
                        else if (modes[m].mode == HOSTAPD_MODE_IEEE80211A)
                                wps->dev.rf_bands |= WPS_RF_50GHZ;
+                       else if (modes[m].mode == HOSTAPD_MODE_IEEE80211AD)
+                               wps->dev.rf_bands |= WPS_RF_60GHZ;
                }
        }
        if (wps->dev.rf_bands == 0) {
@@ -2597,6 +2600,10 @@ static int wpas_wps_nfc_rx_handover_sel(struct wpa_supplicant *wpa_s,
                         (attr.rf_bands == NULL ||
                          *attr.rf_bands & WPS_RF_50GHZ))
                        freq = 5000 + 5 * chan;
+               else if (chan >= 1 && chan <= 4 &&
+                        (attr.rf_bands == NULL ||
+                         *attr.rf_bands & WPS_RF_60GHZ))
+                       freq = 56160 + 2160 * chan;
 
                if (freq) {
                        wpa_printf(MSG_DEBUG,