]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Check EDMG configuration against capability
authorAlexei Avshalom Lazar <ailizaro@codeaurora.org>
Wed, 11 Sep 2019 09:03:07 +0000 (12:03 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 7 Oct 2019 14:20:41 +0000 (17:20 +0300)
Signed-off-by: Alexei Avshalom Lazar <ailizaro@codeaurora.org>
src/ap/hostapd.c
src/ap/hw_features.c
src/ap/hw_features.h

index 83e64743d661e7004279779e87ce0a6be7e91045..368643867f38c0b5eb03a3082ee56bd9a75a8a13 100644 (file)
@@ -1590,6 +1590,9 @@ static int setup_interface2(struct hostapd_iface *iface)
                        wpa_printf(MSG_DEBUG, "Interface initialization will be completed in a callback (ACS)");
                        return 0;
                }
+               ret = hostapd_check_edmg_capab(iface);
+               if (ret < 0)
+                       goto fail;
                ret = hostapd_check_ht_capab(iface);
                if (ret < 0)
                        goto fail;
index a0720bad21d000ae607500aa2b2bdce0dc4085ef..2a1fa0ae8971a037f21fb9c9c6d5520f846f9659 100644 (file)
@@ -704,6 +704,32 @@ int hostapd_check_ht_capab(struct hostapd_iface *iface)
 }
 
 
+int hostapd_check_edmg_capab(struct hostapd_iface *iface)
+{
+       struct hostapd_hw_modes *mode = iface->hw_features;
+       struct ieee80211_edmg_config edmg;
+
+       if (!iface->conf->enable_edmg)
+               return 0;
+
+       hostapd_encode_edmg_chan(iface->conf->enable_edmg,
+                                iface->conf->edmg_channel,
+                                iface->conf->channel,
+                                &edmg);
+
+       if (mode->edmg.channels && ieee802_edmg_is_allowed(mode->edmg, edmg))
+               return 0;
+
+       wpa_printf(MSG_WARNING, "Requested EDMG configuration is not valid");
+       wpa_printf(MSG_INFO, "EDMG capab: channels 0x%x, bw_config %d",
+                  mode->edmg.channels, mode->edmg.bw_config);
+       wpa_printf(MSG_INFO,
+                  "Requested EDMG configuration: channels 0x%x, bw_config %d",
+                  edmg.channels, edmg.bw_config);
+       return -1;
+}
+
+
 static int hostapd_is_usable_chan(struct hostapd_iface *iface,
                                  int channel, int primary)
 {
index ca7f22ba205bf208c494aa31bdf0e52cc4a59aba..902a19f9f3100cc3415c04cd9bb532aacb60d229 100644 (file)
@@ -21,6 +21,7 @@ const char * hostapd_hw_mode_txt(int mode);
 int hostapd_hw_get_freq(struct hostapd_data *hapd, int chan);
 int hostapd_hw_get_channel(struct hostapd_data *hapd, int freq);
 int hostapd_check_ht_capab(struct hostapd_iface *iface);
+int hostapd_check_edmg_capab(struct hostapd_iface *iface);
 int hostapd_prepare_rates(struct hostapd_iface *iface,
                          struct hostapd_hw_modes *mode);
 void hostapd_stop_setup_timers(struct hostapd_iface *iface);
@@ -61,6 +62,11 @@ static inline int hostapd_check_ht_capab(struct hostapd_iface *iface)
        return 0;
 }
 
+static inline int hostapd_check_edmg_capab(struct hostapd_iface *iface)
+{
+       return 0;
+}
+
 static inline int hostapd_prepare_rates(struct hostapd_iface *iface,
                                        struct hostapd_hw_modes *mode)
 {