Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ESP-WIFI-MESH] esp_mesh_delete_group_id() not working correctly, with pandora condition (IDFGH-13893) #14735

Closed
3 tasks done
mmrein opened this issue Oct 16, 2024 · 4 comments
Assignees
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally

Comments

@mmrein
Copy link

mmrein commented Oct 16, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

ESP-IDF: tested on v4.4.6 and v5.3.1

Expected behavior:

Delete number of addresses matching those provided by pointer, leaving other addresses intact.

Actual behavior:

Selected address is deleted, but resulting list of addresses after deletion is incorrect. Repeated address adding and deleting results in pandora situation.

Steps to reproduce:

  1. Get some example where esp-wifi-mesh is used and initialized, for example: https://github.com/espressif/esp-idf/tree/v5.3.1/examples/mesh/internal_communication
  2. Add following code to the end of main (after all init is done)
  3. Flash to device and see log output
// XXX Debug test group addr
    int addrCount = 0;
    mesh_addr_t *group_list = NULL;
    esp_err_t ret = ESP_FAIL;

// Initialize and set the list of 3 group addresses
    uint8_t group_ids[3][6] = {{0x01, 0x00, 0x5e, 0x00, 0x00, 0x01}, {0x01, 0x00, 0x5e, 0x00, 0x00, 0x02}, {0x01, 0x00, 0x5e, 0x00, 0x00, 0x03}};
    esp_mesh_set_group_id((mesh_addr_t *)group_ids, 3);
// Check current list
    addrCount = esp_mesh_get_group_num();
    ESP_LOGI(MESH_TAG, "Group addresses count: %i", addrCount);
    // Print addresses
    group_list = heap_caps_malloc(sizeof(mesh_addr_t) * addrCount, MALLOC_CAP_8BIT);
    esp_mesh_get_group_list((mesh_addr_t*)group_list, addrCount);
    for(int i=0; i<addrCount; i++) {
    	ESP_LOGI(MESH_TAG, "Group address %i: " MACSTR, i, MAC2STR((uint8_t*)&group_list[i]));
    }
    free(group_list);

// Delete last address
    ret = esp_mesh_delete_group_id((const mesh_addr_t*)group_ids[2], 1);
    ESP_LOGI(MESH_TAG, "Delete last address: %s", esp_err_to_name(ret));
// Check current list
    addrCount = esp_mesh_get_group_num();
    ESP_LOGI(MESH_TAG, "Group addresses count: %i", addrCount);
    // Print addresses
    group_list = heap_caps_malloc(sizeof(mesh_addr_t) * addrCount, MALLOC_CAP_8BIT);
    esp_mesh_get_group_list((mesh_addr_t*)group_list, addrCount);
    for(int i=0; i<addrCount; i++) {
    	ESP_LOGI(MESH_TAG, "Group address %i: " MACSTR, i, MAC2STR((uint8_t*)&group_list[i]));
    }
    free(group_list);

// Add third address again
    ret = esp_mesh_set_group_id((mesh_addr_t *)group_ids[2], 1);
    ESP_LOGI(MESH_TAG, "Add third address again: %s", esp_err_to_name(ret));
// Check current list
    addrCount = esp_mesh_get_group_num();
    ESP_LOGI(MESH_TAG, "Group addresses count: %i", addrCount);
    // Print addresses
    group_list = heap_caps_malloc(sizeof(mesh_addr_t) * addrCount, MALLOC_CAP_8BIT);
    esp_mesh_get_group_list((mesh_addr_t*)group_list, addrCount);
    for(int i=0; i<addrCount; i++) {
    	ESP_LOGI(MESH_TAG, "Group address %i: " MACSTR, i, MAC2STR((uint8_t*)&group_list[i]));
    }
    free(group_list);

// Delete last address again to find pandora
    ret = esp_mesh_delete_group_id((const mesh_addr_t*)group_ids[2], 1);
    ESP_LOGI(MESH_TAG, "Delete last address again: %s", esp_err_to_name(ret));
// Check current list
    addrCount = esp_mesh_get_group_num();
    ESP_LOGI(MESH_TAG, "Group addresses count: %i", addrCount);
    // Print addresses
    group_list = heap_caps_malloc(sizeof(mesh_addr_t) * addrCount, MALLOC_CAP_8BIT);
    esp_mesh_get_group_list((mesh_addr_t*)group_list, addrCount);
    for(int i=0; i<addrCount; i++) {
    	ESP_LOGI(MESH_TAG, "Group address %i: " MACSTR, i, MAC2STR((uint8_t*)&group_list[i]));
    }
    free(group_list);

Expected Log output:

I (2564) mesh_main: Group addresses count: 3 
I (2564) mesh_main: Group address 0: 01:00:5e:00:00:01 
I (2564) mesh_main: Group address 1: 01:00:5e:00:00:02 
I (2574) mesh_main: Group address 2: 01:00:5e:00:00:03 
I (2574) mesh_main: Delete last address: ESP_OK 
I (2584) mesh_main: Group addresses count: 2 
I (2584) mesh_main: Group address 0: 01:00:5e:00:00:01
I (2594) mesh_main: Group address 1: 01:00:5e:00:00:02 
I (2604) mesh_main: Add third address again: ESP_OK 
I (2604) mesh_main: Group addresses count: 3 
I (2614) mesh_main: Group address 0: 01:00:5e:00:00:01
I (2614) mesh_main: Group address 1: 01:00:5e:00:00:02 
I (2624) mesh_main: Group address 2: 01:00:5e:00:00:03 
I (2634) mesh_main: Delete last address again: ESP_OK 
I (2634) mesh_main: Group addresses count: 2 
I (2614) mesh_main: Group address 0: 01:00:5e:00:00:01
I (2614) mesh_main: Group address 1: 01:00:5e:00:00:02 

Actual Log output:

I (2564) mesh_main: Group addresses count: 3 
I (2564) mesh_main: Group address 0: 01:00:5e:00:00:01 
I (2564) mesh_main: Group address 1: 01:00:5e:00:00:02 
I (2574) mesh_main: Group address 2: 01:00:5e:00:00:03 
I (2574) mesh_main: Delete last address: ESP_OK 
I (2584) mesh_main: Group addresses count: 2 
I (2584) mesh_main: Group address 0: 01:00:5e:00:00:02 
I (2594) mesh_main: Group address 1: 00:00:00:00:00:00 
I (2604) mesh_main: Add third address again: ESP_OK 
I (2604) mesh_main: Group addresses count: 3 
I (2614) mesh_main: Group address 0: 01:00:5e:00:00:02 
I (2614) mesh_main: Group address 1: 00:00:00:00:00:00 
I (2624) mesh_main: Group address 2: 01:00:5e:00:00:03 
E (2624) mesh: [mesh.c,2685] pandora 

I (2634) mesh_main: Delete last address again: ESP_OK 
I (2634) mesh_main: Group addresses count: 2 
I (2644) mesh_main: Group address 0: 01:00:5e:00:00:02 
I (2644) mesh_main: Group address 1: 00:00:00:00:00:00 

Edit: also added an example of adding the address back after deletion and how to find pandora.

@espressif-bot espressif-bot added the Status: Opened Issue is new label Oct 16, 2024
@github-actions github-actions bot changed the title [ESP-WIFI-MESH] esp_mesh_delete_group_id() not working as expected [ESP-WIFI-MESH] esp_mesh_delete_group_id() not working as expected (IDFGH-13893) Oct 16, 2024
@mmrein mmrein changed the title [ESP-WIFI-MESH] esp_mesh_delete_group_id() not working as expected (IDFGH-13893) [ESP-WIFI-MESH] esp_mesh_delete_group_id() not working correctly, with pandora condition (IDFGH-13893) Oct 16, 2024
@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed and removed Status: Opened Issue is new labels Oct 22, 2024
@zhangyanjiaoesp
Copy link
Collaborator

@mmrein Thanks for reporting this issue, we have found the root cause, and will merge the fix ASAP.

@mmrein
Copy link
Author

mmrein commented Oct 22, 2024

Great to hear that, thank you.

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable and removed Status: Reviewing Issue is being reviewed labels Oct 28, 2024
@mmrein
Copy link
Author

mmrein commented Nov 15, 2024

I've just seen v5.4-beta1 release and the fix does not seem included. Will it make to final v5.4 stable?

@zhangyanjiaoesp
Copy link
Collaborator

yes, the final version will include this change.

espressif-bot pushed a commit that referenced this issue Nov 19, 2024
1. fix(wifi/pm): Fixed the tbtt interval update error when AP's beacon interval changed
   Closes #14720
2. fix(wifi/mesh): Enlarge the mesh TX task stack
3. fix(wifi/espnow): Added check for espnow type and length on v1.0
4. fix(wifi/mesh): Fixed delete group id error in wifi mesh
   Closes #14735
espressif-bot pushed a commit that referenced this issue Nov 19, 2024
1. fix(wifi/pm): Fixed the tbtt interval update error when AP's beacon interval changed
   Closes #14720
2. fix(wifi/mesh): Enlarge the mesh TX task stack
3. fix(wifi/espnow): Added check for espnow type and length on v1.0
4. fix(wifi/mesh): Fixed delete group id error in wifi mesh
   Closes #14735
espressif-bot pushed a commit that referenced this issue Nov 19, 2024
1. fix(wifi/pm): Fixed the tbtt interval update error when AP's beacon interval changed
   Closes #14720
2. fix(wifi/mesh): Enlarge the mesh TX task stack
3. fix(wifi/espnow): Added check for espnow type and length on v1.0
4. fix(wifi/mesh): Fixed delete group id error in wifi mesh
   Closes #14735
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

3 participants