]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Skip some configuration steps for mesh cases
authorJavier Lopez <jlopex@gmail.com>
Mon, 1 Sep 2014 04:23:37 +0000 (00:23 -0400)
committerJouni Malinen <j@w1.fi>
Sat, 25 Oct 2014 14:45:36 +0000 (17:45 +0300)
Modify hostapd.c logic to add checks for valid mconf data structure:

- For hostapd_setup_bss we don't need to flush old stations in case
  we're rejoining a mesh network.

- In hostapd_setup_interface_complete, we don't need to setup the
  interface until we join the mesh (same reasoning for
  hostapd_tx_queue_params).

Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: Jason Mobarak <x@jason.mobarak.name>
src/ap/hostapd.c

index be7dfd8cc881086e6fbb03003c0c366f1cc54e9f..9fda339b76568c8b0c14093d040c942846a8b4e9 100644 (file)
@@ -694,6 +694,7 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
        int ssid_len, set_ssid;
        char force_ifname[IFNAMSIZ];
        u8 if_addr[ETH_ALEN];
+       int flush_old_stations = 1;
 
        wpa_printf(MSG_DEBUG, "%s(hapd=%p (%s), first=%d)",
                   __func__, hapd, conf->iface, first);
@@ -748,7 +749,14 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
        if (conf->wmm_enabled < 0)
                conf->wmm_enabled = hapd->iconf->ieee80211n;
 
-       hostapd_flush_old_stations(hapd, WLAN_REASON_PREV_AUTH_NOT_VALID);
+#ifdef CONFIG_MESH
+       if (hapd->iface->mconf == NULL)
+               flush_old_stations = 0;
+#endif /* CONFIG_MESH */
+
+       if (flush_old_stations)
+               hostapd_flush_old_stations(hapd,
+                                          WLAN_REASON_PREV_AUTH_NOT_VALID);
        hostapd_set_privacy(hapd, 0);
 
        hostapd_broadcast_wep_clear(hapd);
@@ -907,6 +915,11 @@ static void hostapd_tx_queue_params(struct hostapd_iface *iface)
        int i;
        struct hostapd_tx_queue_params *p;
 
+#ifdef CONFIG_MESH
+       if (iface->mconf == NULL)
+               return;
+#endif /* CONFIG_MESH */
+
        for (i = 0; i < NUM_TX_QUEUES; i++) {
                p = &iface->conf->tx_queue[i];
 
@@ -1172,6 +1185,7 @@ int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
        struct hostapd_data *hapd = iface->bss[0];
        size_t j;
        u8 *prev_addr;
+       int delay_apply_cfg = 0;
 
        if (err)
                goto fail;
@@ -1201,7 +1215,17 @@ int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
                }
 #endif /* NEED_AP_MLME */
 
-               if (hostapd_set_freq(hapd, hapd->iconf->hw_mode, iface->freq,
+#ifdef CONFIG_MESH
+               if (iface->mconf != NULL) {
+                       wpa_printf(MSG_DEBUG,
+                                  "%s: Mesh configuration will be applied while joining the mesh network",
+                                  iface->bss[0]->conf->iface);
+                       delay_apply_cfg = 1;
+               }
+#endif /* CONFIG_MESH */
+
+               if (!delay_apply_cfg &&
+                   hostapd_set_freq(hapd, hapd->iconf->hw_mode, iface->freq,
                                     hapd->iconf->channel,
                                     hapd->iconf->ieee80211n,
                                     hapd->iconf->ieee80211ac,