From 73a34f966f776c7118ecb710d4ff92bed06e80c9 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Wed, 8 Jul 2026 17:10:57 +0200 Subject: [PATCH] openthread_border_router: Honor otbr_log_level for the web UI & bump beta to v2026.07.0 (#4698) * Bump OTBR beta to v2026.07.0 tag * Use log level for otbr-web as well * Fix typo * Bump app version to 3.0.2 * Drop SO_REUSEADDR patch The patch has been merged upstream. * Address review feedback for otbr_log_level helper Rename otbr_log_level_int() to otbr_log_level_to_int() so the helper no longer collides with the otbr_log_level_int variable it is assigned to at both call sites. Drop the helper's own error log so callers own the single user-facing "Unknown otbr_log_level" message, and fix the comment to say the sourced function returns (not exits) non-zero. Co-Authored-By: Claude Opus 4.8 (1M context) --------- Co-authored-by: Claude Opus 4.8 (1M context) --- openthread_border_router/CHANGELOG.md | 5 +++ openthread_border_router/DOCS.md | 2 +- openthread_border_router/Dockerfile | 4 +-- openthread_border_router/build.yaml | 2 +- openthread_border_router/config.yaml | 2 +- .../etc/s6-overlay/s6-rc.d/otbr-agent/run | 33 ++----------------- .../etc/s6-overlay/s6-rc.d/otbr-web/run | 8 ++++- .../etc/s6-overlay/scripts/otbr-agent-common | 19 +++++++++++ 8 files changed, 37 insertions(+), 38 deletions(-) diff --git a/openthread_border_router/CHANGELOG.md b/openthread_border_router/CHANGELOG.md index e4f9e9715..ff2a972f8 100644 --- a/openthread_border_router/CHANGELOG.md +++ b/openthread_border_router/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 3.0.2 + +- Honor the configured `otbr_log_level` for the OTBR web interface (previously always logged at info level) +- Bump beta to OTBR POSIX version ec16e396 (tag v2026.07.0) + ## 3.0.1 - Backport fix for [CVE-2026-8369](https://github.com/advisories/GHSA-f6vh-g7gh-wh6h) to stable. This only affects users who have enabled NAT64 and use an untrusted network. diff --git a/openthread_border_router/DOCS.md b/openthread_border_router/DOCS.md index a83fae325..4db90d991 100644 --- a/openthread_border_router/DOCS.md +++ b/openthread_border_router/DOCS.md @@ -2,7 +2,7 @@ ## Installation -Follow these steps to get the app (formerly knowon as add-on) installed on your system: +Follow these steps to get the app (formerly known as add-on) installed on your system: 1. In Home Assistant, go to **Settings** > **Apps** > **Install app**. 2. Select the top right menu and **Repository**. diff --git a/openthread_border_router/Dockerfile b/openthread_border_router/Dockerfile index 08ecebe68..0aad4cad2 100644 --- a/openthread_border_router/Dockerfile +++ b/openthread_border_router/Dockerfile @@ -16,7 +16,6 @@ ENV DOCKER=1 COPY openthread-core-ha-config-posix.h /usr/src/ -COPY 0001-rest-SO_REUSEADDR.patch /usr/src/ WORKDIR /usr/src RUN \ @@ -44,8 +43,7 @@ RUN \ && cd /usr/src/ot-br-posix \ && git fetch origin ${OTBR_BETA_VERSION} \ && git checkout ${OTBR_BETA_VERSION} \ - && git submodule update --init --recursive --depth 1 \ - && patch -p1 < /usr/src/0001-rest-SO_REUSEADDR.patch + && git submodule update --init --recursive --depth 1 WORKDIR /usr/src/ot-br-posix RUN \ diff --git a/openthread_border_router/build.yaml b/openthread_border_router/build.yaml index 8b90ccdd7..ca8f739ea 100644 --- a/openthread_border_router/build.yaml +++ b/openthread_border_router/build.yaml @@ -3,7 +3,7 @@ build_from: aarch64: ghcr.io/home-assistant/aarch64-base-debian:trixie amd64: ghcr.io/home-assistant/amd64-base-debian:trixie args: - OTBR_BETA_VERSION: 78d9c289473602d3faab535c4e7fbd12ca8d32f5 + OTBR_BETA_VERSION: ec16e396382b4559e70a2c6fdeecb7d596a5e915 OTBR_VERSION: 624a7d98e0dac5984c2982068f71fc81d2dbceb5 UNIVERSAL_SILABS_FLASHER_VERSION: 0.1.2 SERIALX_VERSION: 1.8.0 diff --git a/openthread_border_router/config.yaml b/openthread_border_router/config.yaml index a32c6ef0a..3b10dd632 100644 --- a/openthread_border_router/config.yaml +++ b/openthread_border_router/config.yaml @@ -1,5 +1,5 @@ --- -version: 3.0.1 +version: 3.0.2 breaking_versions: [3.0.0] slug: openthread_border_router name: OpenThread Border Router diff --git a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run index 36a4c73ad..78e7b5786 100755 --- a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run +++ b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run @@ -13,7 +13,6 @@ declare device declare baudrate declare flow_control declare migrate_flow_control -declare otbr_log_level declare otbr_log_level_int declare otbr_rest_listen declare otbr_rest_listen_port @@ -59,36 +58,8 @@ else migrate_flow_control="none" fi -otbr_log_level=$(bashio::string.lower "$(bashio::config otbr_log_level)") -case "${otbr_log_level}" in - debug) - otbr_log_level_int="7" - ;; - info) - otbr_log_level_int="6" - ;; - notice) - otbr_log_level_int="5" - ;; - warning) - otbr_log_level_int="4" - ;; - error) - otbr_log_level_int="3" - ;; - critical) - otbr_log_level_int="2" - ;; - alert) - otbr_log_level_int="1" - ;; - emergency) - otbr_log_level_int="0" - ;; - *) - bashio::exit.nok "Unknown otbr_log_level: ${otbr_log_level}" - ;; -esac +otbr_log_level_int="$(otbr_log_level_to_int)" \ + || bashio::exit.nok "Unknown otbr_log_level: $(bashio::config otbr_log_level)" # shellcheck disable=SC2015 mkdir -p /data/thread && ln -sft /var/lib /data/thread || bashio::exit.nok "Could not create directory /var/lib/thread to store Thread data." diff --git a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/run b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/run index 427f02540..3431a81d3 100755 --- a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/run +++ b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/run @@ -4,9 +4,15 @@ # ============================================================================== # Start OpenThread BorderRouter web interface # ============================================================================== +# shellcheck source=./openthread_border_router/rootfs/etc/s6-overlay/scripts/otbr-agent-common +. /etc/s6-overlay/scripts/otbr-agent-common + bashio::log.info "Starting otbr-web..." declare otbr_web_port +declare otbr_log_level_int otbr_web_port="$(bashio::addon.port 8080)" +otbr_log_level_int="$(otbr_log_level_to_int)" \ + || bashio::exit.nok "Unknown otbr_log_level: $(bashio::config otbr_log_level)" -exec stdbuf -oL /usr/sbin/otbr-web -I wpan0 -d6 -s -a "::" -p "${otbr_web_port}" +exec stdbuf -oL /usr/sbin/otbr-web -I wpan0 -d"${otbr_log_level_int}" -s -a "::" -p "${otbr_web_port}" diff --git a/openthread_border_router/rootfs/etc/s6-overlay/scripts/otbr-agent-common b/openthread_border_router/rootfs/etc/s6-overlay/scripts/otbr-agent-common index 54b17c140..babc15df1 100644 --- a/openthread_border_router/rootfs/etc/s6-overlay/scripts/otbr-agent-common +++ b/openthread_border_router/rootfs/etc/s6-overlay/scripts/otbr-agent-common @@ -12,3 +12,22 @@ otbr_forward_egress_chain="OTBR_FORWARD_EGRESS" otbr_forward_nat64_chain="OTBR_FORWARD_NAT64" otbr_fw_mark="0x1001" +# Map the configured otbr_log_level to the numeric level expected by the +# otbr-agent/otbr-web -d flag. Echoes the numeric level on success, returns +# non-zero on an unknown level (callers own the user-facing error message). +otbr_log_level_to_int() { + local level + level=$(bashio::string.lower "$(bashio::config otbr_log_level)") + case "${level}" in + debug) echo "7" ;; + info) echo "6" ;; + notice) echo "5" ;; + warning) echo "4" ;; + error) echo "3" ;; + critical) echo "2" ;; + alert) echo "1" ;; + emergency) echo "0" ;; + *) return 1 ;; + esac +} +