Remove src/crypto from default include path
[libeap.git] / hostapd / config.c
index 043fd59..d4ce227 100644 (file)
 #include <grp.h>
 #endif /* CONFIG_NATIVE_WINDOWS */
 
-#include "hostapd.h"
-#include "driver.h"
-#include "sha1.h"
-#include "eap_server/eap.h"
+#include "common.h"
+#include "crypto/sha1.h"
+#include "drivers/driver.h"
 #include "radius/radius_client.h"
-#include "wpa_common.h"
+#include "common/ieee802_11_defs.h"
+#include "common/wpa_common.h"
+#include "eap_common/eap_wsc_common.h"
+#include "eap_server/eap.h"
+#include "hostapd.h"
 #include "wpa.h"
 #include "uuid.h"
-#include "eap_common/eap_wsc_common.h"
 #include "sta_info.h"
 #include "config.h"
 
 
 #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 +202,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 +228,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);
@@ -1458,13 +1460,13 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                } else if (os_strcmp(buf, "bridge") == 0) {
                        os_strlcpy(bss->bridge, pos, sizeof(bss->bridge));
                } else if (os_strcmp(buf, "driver") == 0) {
-                       int i;
+                       int j;
                        /* clear to get error below if setting is invalid */
                        conf->driver = NULL;
-                       for (i = 0; hostapd_drivers[i]; i++) {
-                               if (os_strcmp(pos, hostapd_drivers[i]->name) ==
-                                   0) {
-                                       conf->driver = hostapd_drivers[i];
+                       for (j = 0; wpa_drivers[j]; j++) {
+                               if (os_strcmp(pos, wpa_drivers[j]->name) == 0)
+                               {
+                                       conf->driver = wpa_drivers[j];
                                        break;
                                }
                        }
@@ -1757,7 +1759,7 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                        bss->radius->retry_primary_interval = atoi(pos);
                } else if (os_strcmp(buf, "radius_acct_interim_interval") == 0)
                {
-                       bss->radius->acct_interim_interval = atoi(pos);
+                       bss->acct_interim_interval = atoi(pos);
 #endif /* CONFIG_NO_RADIUS */
                } else if (os_strcmp(buf, "auth_algs") == 0) {
                        bss->auth_algs = atoi(pos);
@@ -2066,12 +2068,6 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                        bss->ssid.vlan_tagged_interface = os_strdup(pos);
 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
 #endif /* CONFIG_NO_VLAN */
-               } else if (os_strcmp(buf, "passive_scan_interval") == 0) {
-                       conf->passive_scan_interval = atoi(pos);
-               } else if (os_strcmp(buf, "passive_scan_listen") == 0) {
-                       conf->passive_scan_listen = atoi(pos);
-               } else if (os_strcmp(buf, "passive_scan_mode") == 0) {
-                       conf->passive_scan_mode = atoi(pos);
                } else if (os_strcmp(buf, "ap_table_max_size") == 0) {
                        conf->ap_table_max_size = atoi(pos);
                } else if (os_strcmp(buf, "ap_table_expiration_time") == 0) {
@@ -2099,13 +2095,7 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                                errors++;
                        }
                } else if (os_strcmp(buf, "bssid") == 0) {
-                       if (bss == conf->bss &&
-                           (!conf->driver || !conf->driver->init_bssid)) {
-                               wpa_printf(MSG_ERROR, "Line %d: bssid item "
-                                          "not allowed for the default "
-                                          "interface and this driver", line);
-                               errors++;
-                       } else if (hwaddr_aton(pos, bss->bssid)) {
+                       if (hwaddr_aton(pos, bss->bssid)) {
                                wpa_printf(MSG_ERROR, "Line %d: invalid bssid "
                                           "item", line);
                                errors++;
@@ -2269,29 +2259,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;