WPA2 "Method private structure allocated failure" with v2.0.0

SpacedOut
Posts: 1
Joined: Thu Dec 22, 2016 2:01 pm

WPA2 "Method private structure allocated failure" with v2.0.0

Postby SpacedOut » Thu Dec 22, 2016 2:06 pm

I added some of the enterprise functions to the basic_example and linked with wpa2, but I'm getting what sounds like an out of memory error even with this minimal program. This is with ESP8266_NONOS_SDK_V2.0.0_16_08_10, any ideas? I have the same error if I try a PEM client certificate and private key.

Code: Select all

wifi_set_opmode(STATION_MODE);
wifi_station_set_wpa2_enterprise_auth(true);
wifi_station_set_reconnect_policy(false);
wifi_station_set_enterprise_username((u8*)EAP_USER, os_strlen(EAP_USER));
wifi_station_set_enterprise_password((u8*)EAP_PASSWORD, os_strlen(EAP_PASSWORD));
wifi_station_connect();


heap 46040 wifi status 1
state: 2 -> 0 (0)
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt
Method private structure allocated failure

Full program here.
https://github.com/dfries/source-code-e ... ser_main.c

user_config.h

Code: Select all

#define SSID "Your SSID"
#define SSID_PASSWORD "Your Password Here"
#define EAP_USER "eap_username"
#define EAP_PASSWORD "eap_password"


user_main.c

Code: Select all

#include "ets_sys.h"
#include "osapi.h"
#include "gpio.h"
#include "os_type.h"
#include "user_config.h"
#include "user_interface.h"

#include <wpa2_enterprise.h>

#define user_procTaskPrio        0
#define user_procTaskQueueLen    1
os_event_t    user_procTaskQueue[user_procTaskQueueLen];
static void loop(os_event_t *events);

static void ICACHE_FLASH_ATTR
print_heap(os_event_t *events)
{
    int status = wifi_station_get_connect_status();
    os_printf("heap %u wifi status %u\n", system_get_free_heap_size(), status);
    if(status == STATION_IDLE)
    {
        os_printf("idle, try connecting\n");
        wifi_station_connect();
    }
    static int connect_count;
    if(status == STATION_CONNECTING)
    {
        ++connect_count;
        if(connect_count == 4)
        {
            os_printf("still in connecting, disconnect and try again\n");
            wifi_station_disconnect();
            wifi_station_connect();
            connect_count = 0;
        }
    }
}

//Init function
void ICACHE_FLASH_ATTR
user_init()
{
    char ssid[32] = SSID;
    char password[64] = SSID_PASSWORD;
    struct station_config stationConf;

    // default appears to be a non-standard 74880 baud
    uart_div_modify(0, UART_CLK_FREQ / 115200);

    //Set station mode
    wifi_set_opmode(STATION_MODE);

    //Set ap settings
    // skip station config, expect the station is already setup in flash
    #if 0
    os_memcpy(&stationConf.ssid, ssid, 32);
    os_memcpy(&stationConf.password, password, 64);
    wifi_station_set_config(&stationConf);
    #endif

    os_printf("heap %u line %u\n", system_get_free_heap_size(), __LINE__);
    wifi_station_set_wpa2_enterprise_auth(true);
    wifi_station_set_reconnect_policy(false);
    wifi_station_set_enterprise_username((u8*)EAP_USER, os_strlen(EAP_USER));
    wifi_station_set_enterprise_password((u8*)EAP_PASSWORD, os_strlen(EAP_PASSWORD));
    os_printf("heap %u line %u\n", system_get_free_heap_size(), __LINE__);

    static os_timer_t heap_timer;
    os_timer_disarm(&heap_timer);
    os_timer_setfn(&heap_timer, &print_heap, NULL);
    os_timer_arm(&heap_timer, 3000, 1);
}

ESP_Xutao
Posts: 134
Joined: Tue Sep 27, 2016 5:42 pm

Re: WPA2 "Method private structure allocated failure" with v2.0.0

Postby ESP_Xutao » Tue Jan 24, 2017 4:42 pm

hi
this is what we do a program,you can consult.
Attachments
wpa.rar
(4.84 MiB) Downloaded 659 times

Who is online

Users browsing this forum: No registered users and 3 guests