openthread: enable 1.2 multicast routing

This MR enables Thread 1.2 Backbone Border Router(BBR) feature and
multicast routing.
This commit is contained in:
Jiacheng Guo 2022-01-04 19:14:12 +08:00
parent 0ac6a105ef
commit a271753a6a
5 changed files with 40 additions and 9 deletions

@ -1 +1 @@
Subproject commit ed7eace382134d0ac6fb2b33650895d8d0e547af Subproject commit 901353a8c17d5c3040b3850d571550b0472b921b

@ -1 +1 @@
Subproject commit 37268889370467c5e48e306d322472d6910ebb13 Subproject commit e736d2488d9d4f787650d81f2b84f59a194f2b41

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -204,6 +204,16 @@
#define OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE CONFIG_OPENTHREAD_TREL #define OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE CONFIG_OPENTHREAD_TREL
#endif #endif
/**
* @def OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
*
* Define to 1 to enable Backbone Router support.
*
*/
#ifndef OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
#define OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE 1
#endif
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER #endif // CONFIG_OPENTHREAD_BORDER_ROUTER
/** /**
@ -356,6 +366,26 @@
*/ */
#define OPENTHREAD_CONFIG_PING_SENDER_ENABLE 1 #define OPENTHREAD_CONFIG_PING_SENDER_ENABLE 1
/**
* @def OPENTHREAD_CONFIG_DUA_ENABLE
*
* Define as 1 to support Thread 1.2 Domain Unicast Address feature.
*
*/
#ifndef OPENTHREAD_CONFIG_DUA_ENABLE
#define OPENTHREAD_CONFIG_DUA_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_MLR_ENABLE
*
* Define as 1 to support Thread 1.2 Multicast Listener Registration feature.
*
*/
#ifndef OPENTHREAD_CONFIG_MLR_ENABLE
#define OPENTHREAD_CONFIG_MLR_ENABLE 1
#endif
/** /**
* @def OPENTHREAD_CONFIG_DTLS_MAX_CONTENT_LEN * @def OPENTHREAD_CONFIG_DTLS_MAX_CONTENT_LEN
* *

View File

@ -37,9 +37,9 @@
#include "sdkconfig.h" #include "sdkconfig.h"
#include "driver/uart.h" #include "driver/uart.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/portmacro.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "hal/uart_types.h" #include "hal/uart_types.h"
#include "openthread/backbone_router_ftd.h"
#include "openthread/border_router.h" #include "openthread/border_router.h"
#include "openthread/cli.h" #include "openthread/cli.h"
#include "openthread/dataset.h" #include "openthread/dataset.h"
@ -50,7 +50,6 @@
#include "openthread/ip6.h" #include "openthread/ip6.h"
#include "openthread/logging.h" #include "openthread/logging.h"
#include "openthread/tasklet.h" #include "openthread/tasklet.h"
#include "openthread/thread.h"
#include "openthread/thread_ftd.h" #include "openthread/thread_ftd.h"
#include "esp_ot_wifi_cmd.h" #include "esp_ot_wifi_cmd.h"
#include "esp_ot_cli_extension.h" #include "esp_ot_cli_extension.h"
@ -137,10 +136,6 @@ static void create_config_network(otInstance *instance)
ESP_LOGE(TAG, "Failed to set OpenThread active dataset."); ESP_LOGE(TAG, "Failed to set OpenThread active dataset.");
abort(); abort();
} }
if (otBorderRouterRegister(instance) != OT_ERROR_NONE) {
ESP_LOGE(TAG, "Failed to register border router.");
abort();
}
return; return;
} }
@ -154,6 +149,11 @@ static void launch_openthread_network(otInstance *instance)
ESP_LOGE(TAG, "Failed to enable OpenThread"); ESP_LOGE(TAG, "Failed to enable OpenThread");
abort(); abort();
} }
if (otBorderRouterRegister(instance) != OT_ERROR_NONE) {
ESP_LOGE(TAG, "Failed to register border router.");
abort();
}
otBackboneRouterSetEnabled(instance, true);
} }
#endif // CONFIG_OPENTHREAD_BR_AUTO_START #endif // CONFIG_OPENTHREAD_BR_AUTO_START

View File

@ -43,6 +43,7 @@ CONFIG_LWIP_MULTICAST_PING=y
CONFIG_LWIP_NETIF_STATUS_CALLBACK=y CONFIG_LWIP_NETIF_STATUS_CALLBACK=y
CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y
CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y
CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM=y
# end of lwIP # end of lwIP
# #