Remove the unused set_ieee80211d driver op
[wpasupplicant] / hostapd / hostapd.c
index b362ca2..e3a9ea9 100644 (file)
@@ -120,6 +120,7 @@ int hostapd_reload_config(struct hostapd_iface *iface)
        struct hostapd_data *hapd = iface->bss[0];
        struct hostapd_config *newconf, *oldconf;
        struct wpa_auth_config wpa_auth_conf;
+       size_t j;
 
        newconf = hostapd_config_read(iface->config_fname);
        if (newconf == NULL)
@@ -129,7 +130,8 @@ int hostapd_reload_config(struct hostapd_iface *iface)
         * Deauthenticate all stations since the new configuration may not
         * allow them to use the BSS anymore.
         */
-       hostapd_flush_old_stations(hapd);
+       for (j = 0; j < iface->num_bss; j++)
+               hostapd_flush_old_stations(iface->bss[j]);
 
        /* TODO: update dynamic data based on changed configuration
         * items (e.g., open/close sockets, etc.) */
@@ -390,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);
@@ -814,7 +814,7 @@ static int hostapd_wpa_auth_send_ft_action(void *ctx, const u8 *dst,
        os_memcpy(m->bssid, hapd->own_addr, ETH_ALEN);
        os_memcpy(&m->u, data, data_len);
 
-       res = hostapd_send_mgmt_frame(hapd, (u8 *) m, mlen, 0);
+       res = hostapd_send_mgmt_frame(hapd, (u8 *) m, mlen);
        os_free(m);
        return res;
 }
@@ -1111,6 +1111,13 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
                }
        }
 
+       hostapd_flush_old_stations(hapd);
+       hostapd_set_privacy(hapd, 0);
+
+       hostapd_broadcast_wep_clear(hapd);
+       if (hostapd_setup_encryption(hapd->conf->iface, hapd))
+               return -1;
+
        /*
         * Fetch the SSID from the system and use it or,
         * if one was specified in the config file, verify they
@@ -1305,19 +1312,14 @@ 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
         * configured with a pointer to this driver interface.
         */
-       if (b[0] | b[1] | b[2] | b[3] | b[4] | b[5]) {
-               hapd->drv_priv = hostapd_driver_init_bssid(hapd, b);
-       } else {
-               hapd->drv_priv = hostapd_driver_init(hapd);
-       }
+       if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
+               b = NULL;
+       hapd->drv_priv = hostapd_driver_init(hapd, b);
 
        if (hapd->drv_priv == NULL) {
                wpa_printf(MSG_ERROR, "%s driver initialization failed.",
@@ -1330,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;
 
@@ -1348,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 "
@@ -1372,11 +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);
+}
 
-       hostapd_flush_old_stations(hapd);
-       hostapd_set_privacy(hapd, 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  "
@@ -1394,12 +1416,7 @@ static int setup_interface(struct hostapd_iface *iface)
                }
        }
 
-       hostapd_broadcast_wep_clear(hapd);
-       if (hostapd_setup_encryption(hapd->conf->iface, hapd))
-               return -1;
-
        hostapd_set_beacon_int(hapd, hapd->iconf->beacon_int);
-       ieee802_11_set_beacon(hapd);
 
        if (hapd->iconf->rts_threshold > -1 &&
            hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) {
@@ -1437,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;
 }
 
@@ -1461,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;
@@ -1496,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 ||