Remove the unused set_ieee80211d driver op
[wpasupplicant] / hostapd / hostapd.c
index 379e59c..e3a9ea9 100644 (file)
@@ -392,8 +392,6 @@ static void hostapd_cleanup(struct hostapd_data *hapd)
 {
        hostapd_ctrl_iface_deinit(hapd);
 
-       os_free(hapd->default_wep_key);
-       hapd->default_wep_key = NULL;
        iapp_deinit(hapd->iapp);
        hapd->iapp = NULL;
        accounting_deinit(hapd);
@@ -1314,9 +1312,6 @@ static int setup_interface(struct hostapd_iface *iface)
        size_t i;
        char country[4];
        u8 *b = conf->bssid;
-       int freq;
-       size_t j;
-       u8 *prev_addr;
 
        /*
         * Initialize the driver interface and make sure that all BSSes get
@@ -1337,6 +1332,11 @@ static int setup_interface(struct hostapd_iface *iface)
                iface->bss[i]->drv_priv = hapd->drv_priv;
        }
 
+       if (hostapd_driver_set_mode(hapd, IEEE80211_MODE_AP)) {
+               wpa_printf(MSG_ERROR, "Failed to set driver in AP mode");
+               return -1;
+       }
+
        if (hostapd_validate_bssid_configuration(iface))
                return -1;
 
@@ -1355,13 +1355,6 @@ static int setup_interface(struct hostapd_iface *iface)
                }
        }
 
-       if (hapd->iconf->ieee80211d &&
-           hostapd_set_ieee80211d(hapd, 1) < 0) {
-               wpa_printf(MSG_ERROR, "Failed to set ieee80211d (%d)",
-                          hapd->iconf->ieee80211d);
-               return -1;
-       }
-
        if (hapd->iconf->bridge_packets != INTERNAL_BRIDGE_DO_NOT_CONTROL &&
            hostapd_set_internal_bridge(hapd, hapd->iconf->bridge_packets)) {
                wpa_printf(MSG_ERROR, "Failed to set bridge_packets for "
@@ -1379,8 +1372,33 @@ static int setup_interface(struct hostapd_iface *iface)
                                   "channel. (%d)", ret);
                        return -1;
                }
+               ret = hostapd_check_ht_capab(iface);
+               if (ret < 0)
+                       return -1;
+               if (ret == 1) {
+                       wpa_printf(MSG_DEBUG, "Interface initialization will "
+                                  "be completed in a callback");
+                       return 0;
+               }
        }
+       return hostapd_setup_interface_complete(iface, 0);
+}
+
 
+int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
+{
+       struct hostapd_data *hapd = iface->bss[0];
+       int freq;
+       size_t j;
+       u8 *prev_addr;
+
+       if (err) {
+               wpa_printf(MSG_ERROR, "Interface initialization failed");
+               eloop_terminate();
+               return -1;
+       }
+
+       wpa_printf(MSG_DEBUG, "Completing interface initialization");
        if (hapd->iconf->channel) {
                freq = hostapd_hw_get_freq(hapd, hapd->iconf->channel);
                wpa_printf(MSG_DEBUG, "Mode: %s  Channel: %d  "
@@ -1436,6 +1454,9 @@ static int setup_interface(struct hostapd_iface *iface)
                return -1;
        }
 
+       wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
+                  iface->bss[0]->conf->iface);
+
        return 0;
 }
 
@@ -1460,9 +1481,6 @@ int hostapd_setup_interface(struct hostapd_iface *iface)
                           iface->bss[0]->conf->iface);
                eloop_terminate();
                return -1;
-       } else if (!hostapd_drv_none(iface->bss[0])) {
-               wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
-                          iface->bss[0]->conf->iface);
        }
 
        return 0;
@@ -1495,11 +1513,6 @@ hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
        hapd->conf = bss;
        hapd->iface = hapd_iface;
 
-       if (hapd->conf->individual_wep_key_len > 0) {
-               /* use key0 in individual key and key1 in broadcast key */
-               hapd->default_wep_key_idx = 1;
-       }
-
 #ifdef EAP_TLS_FUNCS
        if (hapd->conf->eap_server &&
            (hapd->conf->ca_cert || hapd->conf->server_cert ||