Merge wpa_supplicant and hostapd driver wrapper implementations
[wpasupplicant] / hostapd / config.c
index d01514b..fae4444 100644 (file)
@@ -19,7 +19,7 @@
 #endif /* CONFIG_NATIVE_WINDOWS */
 
 #include "hostapd.h"
-#include "driver.h"
+#include "drivers/driver.h"
 #include "sha1.h"
 #include "eap_server/eap.h"
 #include "radius/radius_client.h"
@@ -33,7 +33,7 @@
 
 #define MAX_STA_COUNT 2007
 
-extern struct wpa_driver_ops *hostapd_drivers[];
+extern struct wpa_driver_ops *wpa_drivers[];
 
 
 #ifndef CONFIG_NO_VLAN
@@ -200,7 +200,7 @@ static void hostapd_config_defaults_bss(struct hostapd_bss_config *bss)
 }
 
 
-static struct hostapd_config * hostapd_config_defaults(void)
+struct hostapd_config * hostapd_config_defaults(void)
 {
        struct hostapd_config *conf;
        struct hostapd_bss_config *bss;
@@ -226,7 +226,7 @@ static struct hostapd_config * hostapd_config_defaults(void)
        }
 
        /* set default driver based on configuration */
-       conf->driver = hostapd_drivers[0];
+       conf->driver = wpa_drivers[0];
        if (conf->driver == NULL) {
                wpa_printf(MSG_ERROR, "No driver wrappers registered!");
                os_free(conf);
@@ -1461,10 +1461,10 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                        int j;
                        /* clear to get error below if setting is invalid */
                        conf->driver = NULL;
-                       for (j = 0; hostapd_drivers[j]; i++) {
-                               if (os_strcmp(pos, hostapd_drivers[j]->name) ==
-                                   0) {
-                                       conf->driver = hostapd_drivers[j];
+                       for (j = 0; wpa_drivers[j]; j++) {
+                               if (os_strcmp(pos, wpa_drivers[j]->name) == 0)
+                               {
+                                       conf->driver = wpa_drivers[j];
                                        break;
                                }
                        }
@@ -2269,29 +2269,30 @@ struct hostapd_config * hostapd_config_read(const char *fname)
 
        fclose(f);
 
-       if (bss->individual_wep_key_len == 0) {
-               /* individual keys are not use; can use key idx0 for broadcast
-                * keys */
-               bss->broadcast_key_idx_min = 0;
-       }
-
-       /* Select group cipher based on the enabled pairwise cipher suites */
-       pairwise = 0;
-       if (bss->wpa & 1)
-               pairwise |= bss->wpa_pairwise;
-       if (bss->wpa & 2) {
-               if (bss->rsn_pairwise == 0)
-                       bss->rsn_pairwise = bss->wpa_pairwise;
-               pairwise |= bss->rsn_pairwise;
-       }
-       if (pairwise & WPA_CIPHER_TKIP)
-               bss->wpa_group = WPA_CIPHER_TKIP;
-       else
-               bss->wpa_group = WPA_CIPHER_CCMP;
-
        for (i = 0; i < conf->num_bss; i++) {
                bss = &conf->bss[i];
 
+               if (bss->individual_wep_key_len == 0) {
+                       /* individual keys are not use; can use key idx0 for
+                        * broadcast keys */
+                       bss->broadcast_key_idx_min = 0;
+               }
+
+               /* Select group cipher based on the enabled pairwise cipher
+                * suites */
+               pairwise = 0;
+               if (bss->wpa & 1)
+                       pairwise |= bss->wpa_pairwise;
+               if (bss->wpa & 2) {
+                       if (bss->rsn_pairwise == 0)
+                               bss->rsn_pairwise = bss->wpa_pairwise;
+                       pairwise |= bss->rsn_pairwise;
+               }
+               if (pairwise & WPA_CIPHER_TKIP)
+                       bss->wpa_group = WPA_CIPHER_TKIP;
+               else
+                       bss->wpa_group = WPA_CIPHER_CCMP;
+
                bss->radius->auth_server = bss->radius->auth_servers;
                bss->radius->acct_server = bss->radius->acct_servers;