IDF release/v5.1 (#10038)

* IDF release/v5.1 dc859c1e67

* fix(lwip): Filter out V6 packets if V6 is not enabled

the ESP might accept and act on some IPv6 packets, even though IPv6 is not enabled for the interface in Arduino. This change makes the ESP ignore all IPv6 packets if IPv6 address is not available.

* fix(lwip): DNS header is not required

* fix(ot): Add LWIP_HOOK_IP6_INPUT_CUSTOM support
This commit is contained in:
Me No Dev 2024-07-16 19:35:06 +03:00 committed by GitHub
parent 3c1e5a9189
commit 77ca7ea7e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 77 additions and 36 deletions

View file

@ -34,6 +34,18 @@ NetworkInterface *getNetifByID(Network_Interface_ID id) {
return NULL; return NULL;
} }
#if CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM
extern "C" int lwip_hook_ip6_input(struct pbuf *p, struct netif *inp) __attribute__((weak));
extern "C" int lwip_hook_ip6_input(struct pbuf *p, struct netif *inp) {
if (ip6_addr_isany_val(inp->ip6_addr[0].u_addr.ip6)) {
// We don't have an LL address -> eat this packet here, so it won't get accepted on input netif
pbuf_free(p);
return 1;
}
return 0;
}
#endif
static void _ip_event_cb(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data) { static void _ip_event_cb(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data) {
if (event_base == IP_EVENT) { if (event_base == IP_EVENT) {
NetworkInterface *netif = NULL; NetworkInterface *netif = NULL;

View file

@ -16,8 +16,8 @@
#include "freertos/semphr.h" #include "freertos/semphr.h"
#include "freertos/queue.h" #include "freertos/queue.h"
#include "esp_netif.h" #include "esp_netif_net_stack.h"
#include "esp_netif_types.h" #include "lwip/netif.h"
static TaskHandle_t s_cli_task = NULL; static TaskHandle_t s_cli_task = NULL;
static TaskHandle_t s_console_cli_task = NULL; static TaskHandle_t s_console_cli_task = NULL;
@ -27,6 +27,9 @@ static xQueueHandle tx_queue = NULL;
static esp_openthread_platform_config_t ot_native_config; static esp_openthread_platform_config_t ot_native_config;
static TaskHandle_t s_ot_task = NULL; static TaskHandle_t s_ot_task = NULL;
static esp_netif_t *openthread_netif = NULL; static esp_netif_t *openthread_netif = NULL;
#if CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM
static struct netif *ot_lwip_netif = NULL;
#endif
#define OT_CLI_MAX_LINE_LENGTH 512 #define OT_CLI_MAX_LINE_LENGTH 512
@ -38,6 +41,20 @@ typedef struct {
} ot_cli_console_t; } ot_cli_console_t;
static ot_cli_console_t otConsole = {NULL, false, (const char *)NULL, NULL}; static ot_cli_console_t otConsole = {NULL, false, (const char *)NULL, NULL};
#if CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM
extern "C" int lwip_hook_ip6_input(struct pbuf *p, struct netif *inp) {
if (ot_lwip_netif && ot_lwip_netif == inp) {
return 0;
}
if (ip6_addr_isany_val(inp->ip6_addr[0].u_addr.ip6)) {
// We don't have an LL address -> eat this packet here, so it won't get accepted on input netif
pbuf_free(p);
return 1;
}
return 0;
}
#endif
// process the CLI commands sent to the OpenThread stack // process the CLI commands sent to the OpenThread stack
static void ot_cli_loop(void *context) { static void ot_cli_loop(void *context) {
String sTxString(""); String sTxString("");
@ -258,6 +275,15 @@ static void ot_task_worker(void *aContext) {
// Initialize the esp_netif bindings // Initialize the esp_netif bindings
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_OPENTHREAD(); esp_netif_config_t cfg = ESP_NETIF_DEFAULT_OPENTHREAD();
openthread_netif = esp_netif_new(&cfg); openthread_netif = esp_netif_new(&cfg);
#if CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM
// Get LwIP Netif
if (openthread_netif != NULL) {
ot_lwip_netif = (struct netif *)esp_netif_get_netif_impl(openthread_netif);
if (ot_lwip_netif == NULL) {
log_e("Failed to get OpenThread LwIP netif");
}
}
#endif
} }
if (!err && openthread_netif == NULL) { if (!err && openthread_netif == NULL) {
log_e("Failed to create OpenThread esp_netif"); log_e("Failed to create OpenThread esp_netif");
@ -335,6 +361,9 @@ void OpenThreadCLI::end() {
// Clean up // Clean up
esp_openthread_deinit(); esp_openthread_deinit();
esp_openthread_netif_glue_deinit(); esp_openthread_netif_glue_deinit();
#if CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM
ot_lwip_netif = NULL;
#endif
esp_netif_destroy(openthread_netif); esp_netif_destroy(openthread_netif);
esp_vfs_eventfd_unregister(); esp_vfs_eventfd_unregister();
} }

View file

@ -42,7 +42,7 @@
{ {
"packager": "esp32", "packager": "esp32",
"name": "esp32-arduino-libs", "name": "esp32-arduino-libs",
"version": "idf-release_v5.1-bd2b9390ef" "version": "idf-release_v5.1-dc859c1e67"
}, },
{ {
"packager": "esp32", "packager": "esp32",
@ -105,63 +105,63 @@
"tools": [ "tools": [
{ {
"name": "esp32-arduino-libs", "name": "esp32-arduino-libs",
"version": "idf-release_v5.1-bd2b9390ef", "version": "idf-release_v5.1-dc859c1e67",
"systems": [ "systems": [
{ {
"host": "i686-mingw32", "host": "i686-mingw32",
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/c4ae7a78eafc339c71efcc7a75d5caa525c92f58", "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/da253aa56255b29a76ac5038db350cd9e4ebde1b",
"archiveFileName": "esp32-arduino-libs-c4ae7a78eafc339c71efcc7a75d5caa525c92f58.zip", "archiveFileName": "esp32-arduino-libs-da253aa56255b29a76ac5038db350cd9e4ebde1b.zip",
"checksum": "SHA-256:bd9d095d468b517e9836355246cff536223b456aa67ffdb176e167c368ddfd1f", "checksum": "SHA-256:a3ce1e1aebe518d6be26006798b44b6c1a0bc8977a8da4d066ed9d9af1378c9e",
"size": "307841384" "size": "307528289"
}, },
{ {
"host": "x86_64-mingw32", "host": "x86_64-mingw32",
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/c4ae7a78eafc339c71efcc7a75d5caa525c92f58", "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/da253aa56255b29a76ac5038db350cd9e4ebde1b",
"archiveFileName": "esp32-arduino-libs-c4ae7a78eafc339c71efcc7a75d5caa525c92f58.zip", "archiveFileName": "esp32-arduino-libs-da253aa56255b29a76ac5038db350cd9e4ebde1b.zip",
"checksum": "SHA-256:bd9d095d468b517e9836355246cff536223b456aa67ffdb176e167c368ddfd1f", "checksum": "SHA-256:a3ce1e1aebe518d6be26006798b44b6c1a0bc8977a8da4d066ed9d9af1378c9e",
"size": "307841384" "size": "307528289"
}, },
{ {
"host": "arm64-apple-darwin", "host": "arm64-apple-darwin",
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/c4ae7a78eafc339c71efcc7a75d5caa525c92f58", "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/da253aa56255b29a76ac5038db350cd9e4ebde1b",
"archiveFileName": "esp32-arduino-libs-c4ae7a78eafc339c71efcc7a75d5caa525c92f58.zip", "archiveFileName": "esp32-arduino-libs-da253aa56255b29a76ac5038db350cd9e4ebde1b.zip",
"checksum": "SHA-256:bd9d095d468b517e9836355246cff536223b456aa67ffdb176e167c368ddfd1f", "checksum": "SHA-256:a3ce1e1aebe518d6be26006798b44b6c1a0bc8977a8da4d066ed9d9af1378c9e",
"size": "307841384" "size": "307528289"
}, },
{ {
"host": "x86_64-apple-darwin", "host": "x86_64-apple-darwin",
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/c4ae7a78eafc339c71efcc7a75d5caa525c92f58", "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/da253aa56255b29a76ac5038db350cd9e4ebde1b",
"archiveFileName": "esp32-arduino-libs-c4ae7a78eafc339c71efcc7a75d5caa525c92f58.zip", "archiveFileName": "esp32-arduino-libs-da253aa56255b29a76ac5038db350cd9e4ebde1b.zip",
"checksum": "SHA-256:bd9d095d468b517e9836355246cff536223b456aa67ffdb176e167c368ddfd1f", "checksum": "SHA-256:a3ce1e1aebe518d6be26006798b44b6c1a0bc8977a8da4d066ed9d9af1378c9e",
"size": "307841384" "size": "307528289"
}, },
{ {
"host": "x86_64-pc-linux-gnu", "host": "x86_64-pc-linux-gnu",
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/c4ae7a78eafc339c71efcc7a75d5caa525c92f58", "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/da253aa56255b29a76ac5038db350cd9e4ebde1b",
"archiveFileName": "esp32-arduino-libs-c4ae7a78eafc339c71efcc7a75d5caa525c92f58.zip", "archiveFileName": "esp32-arduino-libs-da253aa56255b29a76ac5038db350cd9e4ebde1b.zip",
"checksum": "SHA-256:bd9d095d468b517e9836355246cff536223b456aa67ffdb176e167c368ddfd1f", "checksum": "SHA-256:a3ce1e1aebe518d6be26006798b44b6c1a0bc8977a8da4d066ed9d9af1378c9e",
"size": "307841384" "size": "307528289"
}, },
{ {
"host": "i686-pc-linux-gnu", "host": "i686-pc-linux-gnu",
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/c4ae7a78eafc339c71efcc7a75d5caa525c92f58", "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/da253aa56255b29a76ac5038db350cd9e4ebde1b",
"archiveFileName": "esp32-arduino-libs-c4ae7a78eafc339c71efcc7a75d5caa525c92f58.zip", "archiveFileName": "esp32-arduino-libs-da253aa56255b29a76ac5038db350cd9e4ebde1b.zip",
"checksum": "SHA-256:bd9d095d468b517e9836355246cff536223b456aa67ffdb176e167c368ddfd1f", "checksum": "SHA-256:a3ce1e1aebe518d6be26006798b44b6c1a0bc8977a8da4d066ed9d9af1378c9e",
"size": "307841384" "size": "307528289"
}, },
{ {
"host": "aarch64-linux-gnu", "host": "aarch64-linux-gnu",
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/c4ae7a78eafc339c71efcc7a75d5caa525c92f58", "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/da253aa56255b29a76ac5038db350cd9e4ebde1b",
"archiveFileName": "esp32-arduino-libs-c4ae7a78eafc339c71efcc7a75d5caa525c92f58.zip", "archiveFileName": "esp32-arduino-libs-da253aa56255b29a76ac5038db350cd9e4ebde1b.zip",
"checksum": "SHA-256:bd9d095d468b517e9836355246cff536223b456aa67ffdb176e167c368ddfd1f", "checksum": "SHA-256:a3ce1e1aebe518d6be26006798b44b6c1a0bc8977a8da4d066ed9d9af1378c9e",
"size": "307841384" "size": "307528289"
}, },
{ {
"host": "arm-linux-gnueabihf", "host": "arm-linux-gnueabihf",
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/c4ae7a78eafc339c71efcc7a75d5caa525c92f58", "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/da253aa56255b29a76ac5038db350cd9e4ebde1b",
"archiveFileName": "esp32-arduino-libs-c4ae7a78eafc339c71efcc7a75d5caa525c92f58.zip", "archiveFileName": "esp32-arduino-libs-da253aa56255b29a76ac5038db350cd9e4ebde1b.zip",
"checksum": "SHA-256:bd9d095d468b517e9836355246cff536223b456aa67ffdb176e167c368ddfd1f", "checksum": "SHA-256:a3ce1e1aebe518d6be26006798b44b6c1a0bc8977a8da4d066ed9d9af1378c9e",
"size": "307841384" "size": "307528289"
} }
] ]
}, },