openthread-br: use OpenThread's internal mDNS

Switch OTBR_MDNS from mDNSResponder to openthread, drop the mdnsd and
mDNSResponder dependencies, and remove the proto handler's mdnsd service
check, which would otherwise refuse to start otbr-agent now that mdnsd is
no longer installed.

This follows upstream, which made the internal implementation the default
in openthread/ot-br-posix#2996 and uses it in its own OpenWrt example
package, and it lets otbr-agent share a router with umdns, which is what
advertises the router's procd-registered services (ssh, samba and the
like) and resolves <hostname>.local.

The two can coexist because they never contend for a name: OpenThread's
mDNS names its host after the Thread extended address, while umdns keeps
<hostname>.local. Both bind UDP 5353 with SO_REUSEADDR and each answers
only for its own records. mDNSResponder instead takes its name from
gethostname(), so it and umdns race for the same name, and the loser
either stops announcing without logging anywhere procd captures or, if
neither notices, both keep claiming it. That is the conflict with a
running mdnsd noted in openwrt/packages#29784.

Border router discovery is unaffected: in this mode OpenThread's own
border agent registers the _meshcop._udp service (its
OPENTHREAD_CONFIG_BORDER_AGENT_MESHCOP_SERVICE_ENABLE follows
OPENTHREAD_CONFIG_MULTICAST_DNS_ENABLE), and OTBR's publisher is disabled
by design, so clients such as Home Assistant still find the border router.

Note that OpenThread's mDNS serves a single interface, the one given by
the backbone_network option, so Thread service records are announced on
that network only.

(cherry picked from commit 233cfaa72c)

Assisted-By: AI
Signed-off-by: Christian Glombek <c.glombek@cosa.systems>
This commit is contained in:
Christian Glombek authored and Hannu Nyman committed 2026-10-24 11:54:30 +03:00
1 parent 64372682b9
commit fb077dbc19
3 files changed
+23 -25

No files matched your search

+2 -4
View File
@@ -33,9 +33,7 @@ define Package/openthread-br
+libreadline \
+libstdcpp \
+libubox \
+libubus \
+mdnsd \
+mdnsresponder
+libubus
endef
define Package/openthread-br/description
@@ -55,7 +53,7 @@ CMAKE_OPTIONS += \
-DOT_TARGET_OPENWRT=ON \
-DOTBR_BACKBONE_ROUTER=ON \
-DOTBR_BORDER_ROUTING=ON \
-DOTBR_MDNS=mDNSResponder \
-DOTBR_MDNS=openthread \
-DOTBR_NAT64=OFF \
-DOTBR_OPENWRT=ON \
-DOTBR_PRODUCT_NAME=BorderRouter \
+21 -6
View File
@@ -59,13 +59,28 @@ Therefore, firewall support is disabled completely.
This can be revised once the following feature request is implemented:
https://github.com/openthread/ot-br-posix/issues/1675
### mDNSResponder
### mDNS
The package depends on mDNSResponder. The alternative, Avahi, depends on D-Bus,
which is not something I feel comfortable with running on any router. While
there are Avahi packages without D-Bus support, using OpenThread Border Router
with Avahi requires libavahi-client, and this requires Avahi to be built with
D-Bus support.
The package uses OpenThread's internal mDNS implementation
(`-DOTBR_MDNS=openthread`), which is upstream's default. This drops the
mDNSResponder dependency entirely: no separate daemon, and no Avahi, whose
libavahi-client requirement would have pulled in D-Bus.
The internal implementation advertises on a single infrastructure interface,
the one selected by the `backbone_network` option. Anything that needs to be
announced on more than one interface still needs a general-purpose responder.
It coexists with umdns, which remains the provider for other packages'
services. Both bind the wildcard address on port 5353 with SO_REUSEADDR, which
is what admits the second bind and gets multicast delivered to both, and they
never contend for a name: OpenThread's mDNS names its host after the Thread
extended address, while umdns keeps `<hostname>.local`.
Only multicast reaches both. A unicast datagram to port 5353 is delivered to
one socket, so a unicast reply meant for one daemon can be received by the
other. umdns does set SO_REUSEPORT, but only on a retry after its own bind
fails, and that does not happen here because SO_REUSEADDR already admits the
bind, so no SO_REUSEPORT group forms in either start order.
### REST Server
@@ -21,18 +21,6 @@ proto_openthread_add_prefix() {
[ -n "$prefix" ] && $OTCTL prefix add $prefix
}
proto_openthread_check_service() {
service="$1"
ret=1
json_init
json_add_string name "$service"
ubus call service list "$(json_dump)" | jsonfilter -e '@[*].instances[*]["running"]' > /dev/null
ret=$?
json_cleanup
return "$ret"
}
proto_openthread_init_config() {
proto_config_add_array 'prefix:list(string)'
proto_config_add_boolean verbose
@@ -72,9 +60,6 @@ proto_openthread_setup() {
[ -n "$device" ] || proto_openthread_setup_error "$interface" MISSING_DEVICE
[ -n "$radio_url" ] || proto_openthread_setup_error "$interface" MISSING_RADIO_URL
# run in subshell to prevent wiping json data needed for prefixes
( proto_openthread_check_service mdnsd ) || proto_openthread_setup_error "$interface" MISSING_SVC_MDNSD
opts="--auto-attach=0"
[ "$verbose" -eq 0 ] || append opts -v
append opts "-I$device"