Add wpa_supplicant AP mode events for Public Action frames
This commit is contained in:
parent
195420b8d1
commit
c706d5aa17
6 changed files with 52 additions and 4 deletions
|
@ -689,7 +689,6 @@ static int setup_interface(struct hostapd_iface *iface)
|
||||||
int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
|
int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
|
||||||
{
|
{
|
||||||
struct hostapd_data *hapd = iface->bss[0];
|
struct hostapd_data *hapd = iface->bss[0];
|
||||||
int freq;
|
|
||||||
size_t j;
|
size_t j;
|
||||||
u8 *prev_addr;
|
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");
|
wpa_printf(MSG_DEBUG, "Completing interface initialization");
|
||||||
if (hapd->iconf->channel) {
|
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 "
|
wpa_printf(MSG_DEBUG, "Mode: %s Channel: %d "
|
||||||
"Frequency: %d MHz",
|
"Frequency: %d MHz",
|
||||||
hostapd_hw_mode_txt(hapd->iconf->hw_mode),
|
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->channel,
|
||||||
hapd->iconf->ieee80211n,
|
hapd->iconf->ieee80211n,
|
||||||
hapd->iconf->secondary_channel)) {
|
hapd->iconf->secondary_channel)) {
|
||||||
|
|
|
@ -172,6 +172,10 @@ struct hostapd_data {
|
||||||
struct hostapd_probereq_cb *probereq_cb;
|
struct hostapd_probereq_cb *probereq_cb;
|
||||||
size_t num_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,
|
void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
|
||||||
const u8 *uuid_e);
|
const u8 *uuid_e);
|
||||||
void *wps_reg_success_cb_ctx;
|
void *wps_reg_success_cb_ctx;
|
||||||
|
@ -204,6 +208,7 @@ struct hostapd_iface {
|
||||||
* current_mode->channels */
|
* current_mode->channels */
|
||||||
int num_rates;
|
int num_rates;
|
||||||
struct hostapd_rate_data *current_rates;
|
struct hostapd_rate_data *current_rates;
|
||||||
|
int freq;
|
||||||
|
|
||||||
u16 hw_flags;
|
u16 hw_flags;
|
||||||
|
|
||||||
|
|
|
@ -1355,6 +1355,14 @@ static void handle_action(struct hostapd_data *hapd,
|
||||||
hostapd_sa_query_action(hapd, mgmt, len);
|
hostapd_sa_query_action(hapd, mgmt, len);
|
||||||
return;
|
return;
|
||||||
#endif /* CONFIG_IEEE80211W */
|
#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,
|
hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
|
||||||
|
|
|
@ -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,
|
int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_ssid *ssid)
|
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]->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);
|
os_memcpy(hapd_iface->bss[0]->own_addr, wpa_s->own_addr, ETH_ALEN);
|
||||||
|
|
|
@ -1976,6 +1976,14 @@ static void ieee80211_rx_mgmt_action(struct wpa_supplicant *wpa_s,
|
||||||
case WLAN_ACTION_WMM:
|
case WLAN_ACTION_WMM:
|
||||||
ieee80211_rx_mgmt_wmm_action(wpa_s, mgmt, len, rx_status);
|
ieee80211_rx_mgmt_wmm_action(wpa_s, mgmt, len, rx_status);
|
||||||
break;
|
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:
|
default:
|
||||||
wpa_printf(MSG_DEBUG, "MLME: unknown Action Category %d",
|
wpa_printf(MSG_DEBUG, "MLME: unknown Action Category %d",
|
||||||
mgmt->u.action.category);
|
mgmt->u.action.category);
|
||||||
|
|
|
@ -284,6 +284,10 @@ struct wpa_client_mlme {
|
||||||
size_t ft_ies_len;
|
size_t ft_ies_len;
|
||||||
#endif /* CONFIG_IEEE80211R */
|
#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 */
|
#else /* CONFIG_CLIENT_MLME */
|
||||||
int dummy; /* to keep MSVC happy */
|
int dummy; /* to keep MSVC happy */
|
||||||
#endif /* CONFIG_CLIENT_MLME */
|
#endif /* CONFIG_CLIENT_MLME */
|
||||||
|
|
Loading…
Reference in a new issue