Skip to content

fix(openthread): restore ot_network_auto_start() call in ot_br example (IDFGH-17984)#18845

Open
cnicc wants to merge 1 commit into
espressif:masterfrom
cnicc:fix/ot-br-network-auto-start
Open

fix(openthread): restore ot_network_auto_start() call in ot_br example (IDFGH-17984)#18845
cnicc wants to merge 1 commit into
espressif:masterfrom
cnicc:fix/ot-br-network-auto-start

Conversation

@cnicc

@cnicc cnicc commented Jul 14, 2026

Copy link
Copy Markdown

Description

On cold boot, ot state stays disabled in the ot_br example even when CONFIG_OPENTHREAD_NETWORK_AUTO_START=y and a valid Active Dataset is already persisted in NVS. Wi-Fi connects and the border-routing services start correctly, but the Thread interface itself is never enabled: the device only attaches after manually re-entering ot dataset ... commit active + ot ifconfig up + ot thread start over serial on every reboot.

esp_openthread_border_router_start() only brings up Wi-Fi and the border-routing services, but it never calls otIp6SetEnabled/otThreadSetEnabled.
The call that does this, ot_network_auto_start(), was dropped from ot_br's app_main() in 0697295 ("optimized the autostart macro"), while CONFIG_OPENTHREAD_BORDER_ROUTER_AUTO_START and CONFIG_OPENTHREAD_NETWORK_AUTO_START were being consolidated into a single Kconfig option. ot_cli's app_main() was not touched by that commit and still calls ot_network_auto_start().

This PR restores the ot_network_auto_start() call in ot_br's app_main(),
matching ot_cli. No Kconfig/sdkconfig changes are needed.

Related

No existing issue or PR found for this.
Regression introduced in 0697295.

Testing

Tested on an ESP32-C6, standalone single-chip Thread Border Router, ot_br example, ESP-IDF v6.0.2.
Before, ot dataset active -x confirms the Active Dataset persists correctly, but ot state output was disabled after a cold boot.
After the fix, the device auto-attaches on boot with no serial commands.

No automated test added: verifying ot state after a cold boot requires hardware-in-the-loop testing, which the existing sdkconfig.ci.br_autostart CI config doesn't cover.


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

Note

Low Risk
Single guarded call in an example app that restores prior autostart behavior; no Kconfig or core stack API changes.

Overview
Restores ot_network_auto_start() in the ot_br example’s app_main() when CONFIG_OPENTHREAD_NETWORK_AUTO_START is enabled, aligning startup with ot_cli.

Border-router startup (esp_openthread_border_router_start()) only brings up Wi‑Fi and border-routing services; it does not enable the Thread stack from a persisted Active Dataset. Without this call, cold boot leaves ot state disabled until manual CLI steps, even when auto-start is configured in Kconfig.

Reviewed by Cursor Bugbot for commit 381b477. Bugbot is set up for automated code reviews on this repo. Configure here.

esp_openthread_border_router_start() only brings up Wi-Fi and the border-routing services; it never enables the Thread interface. The call to ot_network_auto_start(), which reapplies the persisted Active Dataset and enables Thread, was dropped from ot_br's app_main() in 0697295 ("optimized the autostart macro") while CONFIG_OPENTHREAD_BORDER_ROUTER_AUTO_START and CONFIG_OPENTHREAD_NETWORK_AUTO_START were consolidated into a single Kconfig option. As a result, "ot state" stays "disabled" after a cold boot even though a valid dataset is persisted in NVS.

ot_cli's app_main still calls ot_network_auto_start() and is unaffected by this regression; this restores the same call in ot_br.
@CLAassistant

CLAassistant commented Jul 14, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@espressif-bot espressif-bot added the Status: Opened Issue is new label Jul 14, 2026
@github-actions github-actions Bot changed the title fix(openthread): restore ot_network_auto_start() call in ot_br example fix(openthread): restore ot_network_auto_start() call in ot_br example (IDFGH-17984) Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Opened Issue is new

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants