mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-08 05:48:36 +00:00
wpa_supplicant: Add WPS registrar support for softAP mode
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "hostapd.h"
|
||||
#include "rsn_supp/wpa.h"
|
||||
#include "ap/ap_config.h"
|
||||
#include "ap/sta_info.h"
|
||||
#include "common/wpa_common.h"
|
||||
|
||||
#include "crypto/aes_wrap.h"
|
||||
@@ -29,6 +30,7 @@
|
||||
#include "esp_wifi_driver.h"
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_private/wifi.h"
|
||||
#include "esp_wpas_glue.h"
|
||||
|
||||
#define STATE_MACHINE_DATA struct wpa_state_machine
|
||||
#define STATE_MACHINE_DEBUG_PREFIX "WPA"
|
||||
@@ -183,22 +185,7 @@ static inline int
|
||||
wpa_auth_send_eapol(struct wpa_authenticator *wpa_auth, const u8 *addr,
|
||||
const u8 *data, size_t data_len, int encrypt)
|
||||
{
|
||||
void *buffer = os_malloc(data_len + sizeof(struct l2_ethhdr));
|
||||
struct l2_ethhdr *eth = buffer;
|
||||
|
||||
if (!buffer){
|
||||
wpa_printf( MSG_DEBUG, "send_eapol, buffer=%p\n", buffer);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(eth->h_dest, addr, ETH_ALEN);
|
||||
memcpy(eth->h_source, wpa_auth->addr, ETH_ALEN);
|
||||
eth->h_proto = host_to_be16(ETH_P_EAPOL);
|
||||
|
||||
memcpy((char *)buffer + sizeof(struct l2_ethhdr), data, data_len);
|
||||
esp_wifi_internal_tx(1, buffer, sizeof(struct l2_ethhdr) + data_len);
|
||||
os_free(buffer);
|
||||
return 0;
|
||||
return hostapd_send_eapol(wpa_auth->addr, addr, data, data_len);
|
||||
}
|
||||
|
||||
int wpa_auth_for_each_sta(struct wpa_authenticator *wpa_auth,
|
||||
@@ -2406,11 +2393,12 @@ bool wpa_ap_join(void** sm, uint8_t *bssid, uint8_t *wpa_ie, uint8_t wpa_ie_len,
|
||||
|
||||
bool wpa_ap_remove(void* sm)
|
||||
{
|
||||
struct wpa_state_machine *wpa_sm;
|
||||
if (!sm) return false;
|
||||
struct hostapd_data *hapd = hostapd_get_hapd_data();
|
||||
if (!sm || !hapd) {
|
||||
return false;
|
||||
}
|
||||
|
||||
wpa_sm = (struct wpa_state_machine*)sm;
|
||||
wpa_auth_sta_deinit(wpa_sm);
|
||||
ap_free_sta(hapd, sm);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user