Add wpa_supplicant AP mode events for Public Action frames
authorJouni Malinen <jouni.malinen@atheros.com>
Sun, 11 Apr 2010 17:33:33 +0000 (20:33 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 11 Apr 2010 17:33:33 +0000 (20:33 +0300)
src/ap/hostapd.c
src/ap/hostapd.h
src/ap/ieee802_11.c
wpa_supplicant/ap.c
wpa_supplicant/mlme.c
wpa_supplicant/wpa_supplicant_i.h

index 35ac468..69e7ad7 100644 (file)
@@ -689,7 +689,6 @@ static int setup_interface(struct hostapd_iface *iface)
 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;
 
@@ -701,13 +700,13 @@ int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
 
        wpa_printf(MSG_DEBUG, "Completing interface initialization");
        if (hapd->iconf->channel) {
-               freq = hostapd_hw_get_freq(hapd, hapd->iconf->channel);
+               iface->freq = hostapd_hw_get_freq(hapd, hapd->iconf->channel);
                wpa_printf(MSG_DEBUG, "Mode: %s  Channel: %d  "
                           "Frequency: %d MHz",
                           hostapd_hw_mode_txt(hapd->iconf->hw_mode),
-                          hapd->iconf->channel, freq);
+                          hapd->iconf->channel, iface->freq);
 
-               if (hostapd_set_freq(hapd, hapd->iconf->hw_mode, freq,
+               if (hostapd_set_freq(hapd, hapd->iconf->hw_mode, iface->freq,
                                     hapd->iconf->channel,
                                     hapd->iconf->ieee80211n,
                                     hapd->iconf->secondary_channel)) {
index 281eade..e8c5648 100644 (file)
@@ -172,6 +172,10 @@ struct hostapd_data {
        struct hostapd_probereq_cb *probereq_cb;
        size_t num_probereq_cb;
 
+       void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
+                                int freq);
+       void *public_action_cb_ctx;
+
        void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
                                   const u8 *uuid_e);
        void *wps_reg_success_cb_ctx;
@@ -204,6 +208,7 @@ struct hostapd_iface {
         * current_mode->channels */
        int num_rates;
        struct hostapd_rate_data *current_rates;
+       int freq;
 
        u16 hw_flags;
 
index d917b80..e119474 100644 (file)
@@ -1355,6 +1355,14 @@ static void handle_action(struct hostapd_data *hapd,
                hostapd_sa_query_action(hapd, mgmt, len);
                return;
 #endif /* CONFIG_IEEE80211W */
+       case WLAN_ACTION_PUBLIC:
+               if (hapd->public_action_cb) {
+                       hapd->public_action_cb(hapd->public_action_cb_ctx,
+                                              (u8 *) mgmt, len,
+                                              hapd->iface->freq);
+                       return;
+               }
+               break;
        }
 
        hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
index 5d79503..2b93984 100644 (file)
@@ -135,6 +135,24 @@ static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s,
 }
 
 
+static void ap_public_action_rx(void *ctx, const u8 *buf, size_t len, int freq)
+{
+}
+
+
+static int ap_probe_req_rx(void *ctx, const u8 *addr, const u8 *ie,
+                          size_t ie_len)
+{
+       return 0;
+}
+
+
+static void ap_wps_reg_success_cb(void *ctx, const u8 *mac_addr,
+                                 const u8 *uuid_e)
+{
+}
+
+
 int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
                             struct wpa_ssid *ssid)
 {
@@ -229,6 +247,12 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
                }
 
                hapd_iface->bss[i]->msg_ctx = wpa_s;
+               hapd_iface->bss[i]->public_action_cb = ap_public_action_rx;
+               hapd_iface->bss[i]->public_action_cb_ctx = wpa_s;
+               hostapd_register_probereq_cb(hapd_iface->bss[i],
+                                            ap_probe_req_rx, wpa_s);
+               hapd_iface->bss[i]->wps_reg_success_cb = ap_wps_reg_success_cb;
+               hapd_iface->bss[i]->wps_reg_success_cb_ctx = wpa_s;
        }
 
        os_memcpy(hapd_iface->bss[0]->own_addr, wpa_s->own_addr, ETH_ALEN);
index c9a1c28..eb60ac5 100644 (file)
@@ -1976,6 +1976,14 @@ static void ieee80211_rx_mgmt_action(struct wpa_supplicant *wpa_s,
        case WLAN_ACTION_WMM:
                ieee80211_rx_mgmt_wmm_action(wpa_s, mgmt, len, rx_status);
                break;
+       case WLAN_ACTION_PUBLIC:
+               if (wpa_s->mlme.public_action_cb) {
+                       wpa_s->mlme.public_action_cb(
+                               wpa_s->mlme.public_action_cb_ctx,
+                               (u8 *) mgmt, len, rx_status->freq);
+                       return;
+               }
+               break;
        default:
                wpa_printf(MSG_DEBUG, "MLME: unknown Action Category %d",
                           mgmt->u.action.category);
index f5582c9..062eedd 100644 (file)
@@ -284,6 +284,10 @@ struct wpa_client_mlme {
        size_t ft_ies_len;
 #endif /* CONFIG_IEEE80211R */
 
+       void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
+                                int freq);
+       void *public_action_cb_ctx;
+
 #else /* CONFIG_CLIENT_MLME */
        int dummy; /* to keep MSVC happy */
 #endif /* CONFIG_CLIENT_MLME */