EAP-FAST: Allow A-ID and A-ID-Info to be configured separately
[libeap.git] / hostapd / hostapd.c
index 6316054..fdc61b2 100644 (file)
@@ -173,7 +173,7 @@ static void hostapd_deauth_all_stas(struct hostapd_data *hapd)
         * nothing works correctly, so let's skip sending this for the hostap
         * driver. */
 
-       if (os_strcmp(hapd->driver->name, "hostap") != 0) {
+       if (hapd->driver && os_strcmp(hapd->driver->name, "hostap") != 0) {
                os_memset(addr, 0xff, ETH_ALEN);
                hostapd_sta_deauth(hapd, addr,
                                   WLAN_REASON_PREV_AUTH_NOT_VALID);
@@ -298,6 +298,7 @@ static void hostapd_wpa_auth_conf(struct hostapd_bss_config *conf,
        wconf->eapol_version = conf->eapol_version;
        wconf->peerkey = conf->peerkey;
        wconf->wme_enabled = conf->wme_enabled;
+       wconf->okc = conf->okc;
 #ifdef CONFIG_IEEE80211W
        wconf->ieee80211w = conf->ieee80211w;
 #endif /* CONFIG_IEEE80211W */
@@ -676,6 +677,9 @@ static int hostapd_flush_old_stations(struct hostapd_data *hapd)
 {
        int ret = 0;
 
+       if (hostapd_drv_none(hapd))
+               return 0;
+
        wpa_printf(MSG_DEBUG, "Flushing old station entries");
        if (hostapd_flush(hapd)) {
                printf("Could not connect to kernel driver.\n");
@@ -891,6 +895,26 @@ static int hostapd_wpa_auth_for_each_sta(
 }
 
 
+static int hostapd_wpa_auth_for_each_auth(
+       void *ctx, int (*cb)(struct wpa_authenticator *sm, void *ctx),
+       void *cb_ctx)
+{
+       struct hostapd_data *ohapd;
+       size_t i, j;
+       struct hapd_interfaces *interfaces = eloop_get_user_data();
+
+       for (i = 0; i < interfaces->count; i++) {
+               for (j = 0; j < interfaces->iface[i]->num_bss; j++) {
+                       ohapd = interfaces->iface[i]->bss[j];
+                       if (cb(ohapd->wpa_auth, cb_ctx))
+                               return 1;
+               }
+       }
+
+       return 0;
+}
+
+
 static int hostapd_wpa_auth_send_ether(void *ctx, const u8 *dst, u16 proto,
                                       const u8 *data, size_t data_len)
 {
@@ -985,6 +1009,9 @@ static int hostapd_validate_bssid_configuration(struct hostapd_iface *iface)
        unsigned int i = iface->conf->num_bss, bits = 0, j;
        int res;
 
+       if (hostapd_drv_none(hapd))
+               return 0;
+
        /* Generate BSSID mask that is large enough to cover the BSSIDs. */
 
        /* Determine the bits necessary to cover the number of BSSIDs. */
@@ -1095,6 +1122,7 @@ static int hostapd_setup_wpa(struct hostapd_data *hapd)
        cb.get_seqnum_igtk = hostapd_wpa_auth_get_seqnum_igtk;
        cb.send_eapol = hostapd_wpa_auth_send_eapol;
        cb.for_each_sta = hostapd_wpa_auth_for_each_sta;
+       cb.for_each_auth = hostapd_wpa_auth_for_each_auth;
        cb.send_ether = hostapd_wpa_auth_send_ether;
 #ifdef CONFIG_IEEE80211R
        cb.send_ft_action = hostapd_wpa_auth_send_ft_action;
@@ -1142,6 +1170,11 @@ static int hostapd_setup_radius_srv(struct hostapd_data *hapd,
        srv.ssl_ctx = hapd->ssl_ctx;
        srv.pac_opaque_encr_key = conf->pac_opaque_encr_key;
        srv.eap_fast_a_id = conf->eap_fast_a_id;
+       srv.eap_fast_a_id_len = conf->eap_fast_a_id_len;
+       srv.eap_fast_a_id_info = conf->eap_fast_a_id_info;
+       srv.eap_fast_prov = conf->eap_fast_prov;
+       srv.pac_key_lifetime = conf->pac_key_lifetime;
+       srv.pac_key_refresh_time = conf->pac_key_refresh_time;
        srv.eap_sim_aka_result_ind = conf->eap_sim_aka_result_ind;
        srv.tnc = conf->tnc;
        srv.ipv6 = conf->radius_server_ipv6;
@@ -1231,9 +1264,12 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
                conf->ssid.ssid[conf->ssid.ssid_len] = '\0';
        }
 
-       printf("Using interface %s with hwaddr " MACSTR " and ssid '%s'\n",
-              hapd->conf->iface, MAC2STR(hapd->own_addr),
-              hapd->conf->ssid.ssid);
+       if (!hostapd_drv_none(hapd)) {
+               printf("Using interface %s with hwaddr " MACSTR
+                      " and ssid '%s'\n",
+                      hapd->conf->iface, MAC2STR(hapd->own_addr),
+                      hapd->conf->ssid.ssid);
+       }
 
        if (hostapd_setup_wpa_psk(conf)) {
                printf("WPA-PSK setup failed.\n");
@@ -1298,18 +1334,21 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
                return -1;
        }
 
-       if (vlan_init(hapd)) {
+       if (!hostapd_drv_none(hapd) && vlan_init(hapd)) {
                printf("VLAN initialization failed.\n");
                return -1;
        }
 
 #ifdef CONFIG_IEEE80211R
-       hapd->l2 = l2_packet_init(hapd->conf->iface, NULL, ETH_P_RRB,
-                                 hostapd_rrb_receive, hapd, 0);
-       if (hapd->l2 == NULL &&
-           (hapd->driver == NULL || hapd->driver->send_ether == NULL)) {
-               printf("Failed to open l2_packet interface\n");
-               return -1;
+       if (!hostapd_drv_none(hapd)) {
+               hapd->l2 = l2_packet_init(hapd->conf->iface, NULL, ETH_P_RRB,
+                                         hostapd_rrb_receive, hapd, 0);
+               if (hapd->l2 == NULL &&
+                   (hapd->driver == NULL ||
+                    hapd->driver->send_ether == NULL)) {
+                       printf("Failed to open l2_packet interface\n");
+                       return -1;
+               }
        }
 #endif /* CONFIG_IEEE80211R */
 
@@ -1541,6 +1580,12 @@ static int setup_interface1(struct hostapd_iface *iface)
        if (hostapd_validate_bssid_configuration(iface))
                return -1;
 
+#ifdef CONFIG_IEEE80211N
+       SET_2BIT_LE16(&iface->ht_op_mode,
+                     HT_INFO_OPERATION_MODE_OP_MODE_OFFSET,
+                     OP_MODE_PURE);
+#endif /* CONFIG_IEEE80211N */
+
        os_memcpy(country, hapd->iconf->country, 3);
        country[3] = '\0';
        if (hostapd_set_country(hapd, country) < 0) {
@@ -1848,7 +1893,7 @@ static void setup_interface_done(struct hostapd_iface *iface, int status)
                wpa_printf(MSG_DEBUG, "%s: Unable to setup interface.",
                           iface->bss[0]->conf->iface);
                eloop_terminate();
-       } else
+       } else if (!hostapd_drv_none(iface->bss[0]))
                wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
                           iface->bss[0]->conf->iface);
 }