Compiling & Installing openthread-br package for openWrt on Pi 4 model B

Hello everyone.

I have been working with and understanding Matter for while now and have become interested in the idea of a router acting as a border router. I will try to describe what I have done so far and what I hope to achieve. Thank you in advance.

To begin implementing this I have set up a Pi 4B as a basic openWrt (23.05.0) router. My next steps will be to obtain an openthread border router package and have that correctly installed and running.
OpenWrt is new territory so I may use the wrong terminology here and there.

I have found two options for obtaining an otbr package.

From openwrt/packages

https://github.com/openwrt/packages/tree/master/net/openthread-br

This is the guide / implementation I first tried to follow.
It looked promising; I was hoping that opkg would be able to discover it, install it, and everything would work happily ever after. Unfortunately I tripped on the first hurdle. opkg couldn't find the package using...

opkg update
opkg install openthread-br

After looking at the archive opkg updates from (below), I concluded that this otbr package must not be available for this openWrt version.

https://archive.openwrt.org/releases/23.05.0/packages/aarch64_cortex-a72/

Perhaps I need to point opkg to a valid source?
Perhaps I am simply using the wrong package name?

From openthread/ot-br-posix

https://github.com/openthread/ot-br-posix/tree/main/etc/openwrt/openthread-br

This solution looks a little more involved.

  • I cloned both the openwrt and ot-br-posix git repositories locally.
  • Following Step 1, I ran into some warnings on the 'feeds' commands.

Here are the warnings... (I later found this comment and continued onto the next steps.)

haydningram@matter-t14:~/chip_test/otbr/openwrt$ ./scripts/feeds update openthread
Updating feed 'openthread' from '/home/haydningram/chip_test/otbr/ot-br-posix/etc/openwrt' ...
Create index file './feeds/openthread.index' 
haydningram@matter-t14:~/chip_test/otbr/openwrt$ ./scripts/feeds install openthread-br
WARNING: Makefile 'package/utils/busybox/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/busybox/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/busybox/Makefile' has a build dependency on 'libpam', which does not exist
WARNING: Makefile 'package/boot/kexec-tools/Makefile' has a dependency on 'liblzma', which does not exist
WARNING: Makefile 'package/network/services/lldpd/Makefile' has a dependency on 'libnetsnmp', which does not exist
WARNING: Makefile 'package/feeds/openthread/openthread-br/Makefile' has a dependency on 'libavahi-client', which does not exist
WARNING: Makefile 'package/feeds/openthread/openthread-br/Makefile' has a dependency on 'avahi-daemon', which does not exist
WARNING: Makefile 'package/utils/policycoreutils/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/policycoreutils/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/policycoreutils/Makefile' has a build dependency on 'libpam', which does not exist
  • Step 2 looked fine...
  • On Step 3 I encountered errors during compilation which I cannot get around. I simply do not know enough about what is happening to try debug it.
  • I went back to Step 2 and changed the Target System & Subtarget to match my Pi 4B, but the errors did not change.

This error seems to consistently occur on line 232.

haydningram@matter-t14:~/chip_test/otbr/openwrt$ make -j1 V=sc package/openthread-br/compile
WARNING: Makefile 'package/utils/busybox/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/busybox/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/busybox/Makefile' has a build dependency on 'libpam', which does not exist
WARNING: Makefile 'package/boot/kexec-tools/Makefile' has a dependency on 'liblzma', which does not exist
WARNING: Makefile 'package/network/services/lldpd/Makefile' has a dependency on 'libnetsnmp', which does not exist
WARNING: Makefile 'package/feeds/openthread/openthread-br/Makefile' has a dependency on 'libavahi-client', which does not exist
WARNING: Makefile 'package/feeds/openthread/openthread-br/Makefile' has a dependency on 'avahi-daemon', which does not exist
WARNING: Makefile 'package/utils/policycoreutils/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/policycoreutils/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/policycoreutils/Makefile' has a build dependency on 'libpam', which does not exist
make[2]: Entering directory '/home/haydningram/chip_test/otbr/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/home/haydningram/chip_test/otbr/openwrt/scripts/config'
make[1]: Entering directory '/home/haydningram/chip_test/otbr/openwrt'
make[2]: Entering directory '/home/haydningram/chip_test/otbr/openwrt/package/libs/toolchain'
rm -rf /home/haydningram/chip_test/otbr/openwrt/build_dir/target-aarch64_cortex-a72_musl/toolchain/.pkgdir/libc.installed /home/haydningram/chip_test/otbr/openwrt/build_dir/target-aarch64_cortex-a72_musl/toolchain/.pkgdir/libc
mkdir -p /home/haydningram/chip_test/otbr/openwrt/build_dir/target-aarch64_cortex-a72_musl/toolchain/.pkgdir/libc
install -d -m0755 /home/haydningram/chip_test/otbr/openwrt/build_dir/target-aarch64_cortex-a72_musl/toolchain/.pkgdir/libc/lib /home/haydningram/chip_test/otbr/openwrt/build_dir/target-aarch64_cortex-a72_musl/toolchain/.pkgdir/libc/usr/bin
cp -fpR /home/haydningram/chip_test/otbr/openwrt/staging_dir/toolchain-aarch64_cortex-a72_gcc-12.3.0_musl/lib/ld-musl-*.so* /home/haydningram/chip_test/otbr/openwrt/build_dir/target-aarch64_cortex-a72_musl/toolchain/.pkgdir/libc/lib/
cp: cannot stat '/home/haydningram/chip_test/otbr/openwrt/staging_dir/toolchain-aarch64_cortex-a72_gcc-12.3.0_musl/lib/ld-musl-*.so*': No such file or directory
make[2]: *** [Makefile:740: /home/haydningram/chip_test/otbr/openwrt/build_dir/target-aarch64_cortex-a72_musl/toolchain/.pkgdir/libc.installed] Error 1
make[2]: Leaving directory '/home/haydningram/chip_test/otbr/openwrt/package/libs/toolchain'
time: package/libs/toolchain/compile#0.09#0.02#0.11
    ERROR: package/libs/toolchain failed to build.
make[1]: *** [package/Makefile:128: package/libs/toolchain/compile] Error 1
make[1]: Leaving directory '/home/haydningram/chip_test/otbr/openwrt'
make: *** [/home/haydningram/chip_test/otbr/openwrt/include/toplevel.mk:232: package/openthread-br/compile] Error 2

This has left me stuck with both options unable to progress.
If anyone can help me get one of these working then that will be fab.

Thanks again for any help.
: )

Make sure your distro’s Build Tool prerequisites are installed - https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem

I have run this section here for Ubuntu.

https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem#debianubuntu

And yet there is no change in the errors / warnings I receive.

I am surprised this cannot be located. It's pretty well automatic in my experience.

From the above,

Run this on your buildroot machine: find ~/ -name ld-musl-*.so* | grep staging_dir/toolchain

By way of reference, this is the return from the buildroots I have for different platforms:

/home/ruralroots/Lite/openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/lib/ld-musl-mips-sf.so.1
/home/ruralroots/Release/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-12.3.0_musl/lib/ld-musl-aarch64.so.1
/home/ruralroots/Snapshot/openwrt/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-12.3.0_musl_eabi/lib/ld-musl-armhf.so.1
/home/ruralroots/Development/openwrt/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-12.3.0_musl_eabi/lib/ld-musl-armhf.so.1
/home/ruralroots/Unifi/openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/lib/ld-musl-mips-sf.so.1

Maybe make a good clean, and start with a default .config and see if it will build.

Nothing was found, not even without the grep.

I removed the repositories and tried building again from a clean setup. Firstly just running make starts a lengthy build with seemingly no hiccups.
After a second cleanup I started following the instructions again but failed again at compiling. I made no changes in menuconfig except for adding openthread-br like the instructions say.
The exact error looks the same, but here it is in-case I missed something.

haydningram@matter-t14:~/chip_test/otbr/openwrt$ make -j1 V=sc package/openthread-br/compile
WARNING: Makefile 'package/utils/busybox/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/busybox/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/busybox/Makefile' has a build dependency on 'libpam', which does not exist
WARNING: Makefile 'package/boot/kexec-tools/Makefile' has a dependency on 'liblzma', which does not exist
WARNING: Makefile 'package/network/services/lldpd/Makefile' has a dependency on 'libnetsnmp', which does not exist
WARNING: Makefile 'package/feeds/openthread/openthread-br/Makefile' has a dependency on 'libavahi-client', which does not exist
WARNING: Makefile 'package/feeds/openthread/openthread-br/Makefile' has a dependency on 'avahi-daemon', which does not exist
WARNING: Makefile 'package/utils/policycoreutils/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/policycoreutils/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/policycoreutils/Makefile' has a build dependency on 'libpam', which does not exist
make[2]: Entering directory '/home/haydningram/chip_test/otbr/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/home/haydningram/chip_test/otbr/openwrt/scripts/config'
make[1]: Entering directory '/home/haydningram/chip_test/otbr/openwrt'
make[2]: Entering directory '/home/haydningram/chip_test/otbr/openwrt/package/libs/toolchain'
rm -rf /home/haydningram/chip_test/otbr/openwrt/build_dir/target-mips_24kc_musl/toolchain/.pkgdir/libc.installed /home/haydningram/chip_test/otbr/openwrt/build_dir/target-mips_24kc_musl/toolchain/.pkgdir/libc
mkdir -p /home/haydningram/chip_test/otbr/openwrt/build_dir/target-mips_24kc_musl/toolchain/.pkgdir/libc
install -d -m0755 /home/haydningram/chip_test/otbr/openwrt/build_dir/target-mips_24kc_musl/toolchain/.pkgdir/libc/lib /home/haydningram/chip_test/otbr/openwrt/build_dir/target-mips_24kc_musl/toolchain/.pkgdir/libc/usr/bin
cp -fpR /home/haydningram/chip_test/otbr/openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/lib/ld-musl-*.so* /home/haydningram/chip_test/otbr/openwrt/build_dir/target-mips_24kc_musl/toolchain/.pkgdir/libc/lib/
cp: cannot stat '/home/haydningram/chip_test/otbr/openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/lib/ld-musl-*.so*': No such file or directory
make[2]: *** [Makefile:740: /home/haydningram/chip_test/otbr/openwrt/build_dir/target-mips_24kc_musl/toolchain/.pkgdir/libc.installed] Error 1
make[2]: Leaving directory '/home/haydningram/chip_test/otbr/openwrt/package/libs/toolchain'
time: package/libs/toolchain/compile#0.09#0.02#0.11
    ERROR: package/libs/toolchain failed to build.
make[1]: *** [package/Makefile:128: package/libs/toolchain/compile] Error 1
make[1]: Leaving directory '/home/haydningram/chip_test/otbr/openwrt'
make: *** [/home/haydningram/chip_test/otbr/openwrt/include/toplevel.mk:232: package/openthread-br/compile] Error 2

Thank you for your help @RuralRoots, and apologies that my problems seem to be so persistent.

Update time!

I have made some progress with the second approach, compiling from openthread/ot-br-posix. I am now running into a new issue, which hopefully is specific enough for some people to recognise and correct me on.

Changes

To progress from my errors returned from make package/openthread-br/compile, I realised there must be some prerequisite steps that weren't mentioned in the guides I had been following.

After some searching, I found this guide which has been helpful in both progression and understanding.
Following the instructions, I ran...

make tools/install
make toolchain/install

This added the missing "musl" piece, and lots more I was missing I would imagine.

These next two changes may be in the wrong order.
At some stage within compiling, third_party/openthread/repo could not be found. Since this is a link to openthread's main repository, the solution was...

git submodule update --init --recursive

The next error to emerge from make package/openthread-br/compile was something to do with missing systemd. I have not got log captures since I have progressed (and rebuilding takes time). After hunting in forums, a fix was found in the form of..

make target/compile

which, to my understanding, compiled some linux things like systemd.

In the end my aggregated changes became...

cd ot-br-posix
git submodule update --init --recursive
cd ../openwrt
make menuconfig   #(select hardware target + openthread-br package)
make tools/compile; make toolchain/compile; make target/compile

I cannot remember why install became compile with tools & toolchain, but it works (unless I am making a mistake with an unclean build environment)

Other Commands

There were some other commands I had found which, to my knowledge, were not necessary / did not affect the outcomes. They were found in forums as solutions to similar issues. Perhaps someone can comment on their purpose / effect on my environment.

make defconfig          #???
make download world     #Comes in all kinds of forms and options, think its a full build, doesn't fix errors

Current Issue

After all that, I still cannot compile.
The issue I am getting is rather specific and I think I know whats wrong - just not how to solve it.

FAILED: src/mdns/CMakeFiles/otbr-mdns.dir/mdns_avahi.cpp.o 
/home/haydningram/chip_test/otbr/openwrt/staging_dir/toolchain-aarch64_cortex-a72_gcc-12.3.0_musl/bin/aarch64-openwrt-linux-musl-g++ -DMBEDTLS_CONFIG_FILE=\"/home/haydningram/chip_test/otbr/ot-br-posix/third_party/openthread/mbedtls-config.h\" -DOTBR_ENABLE_BORDER_AGENT=1 -DOTBR_ENABLE_BORDER_ROUTING=1 -DOTBR_ENABLE_BORDER_ROUTING_COUNTERS=1 -DOTBR_ENABLE_DHCP6_PD=0 -DOTBR_ENABLE_LINK_METRICS_TELEMETRY=0 -DOTBR_ENABLE_MDNS_AVAHI=1 -DOTBR_ENABLE_NAT64=1 -DOTBR_ENABLE_NOTIFY_UPSTART=1 -DOTBR_ENABLE_OPENWRT=1 -DOTBR_ENABLE_PUBLISH_MESHCOP_BA_ID=1 -DOTBR_ENABLE_SRP_ADVERTISING_PROXY=1 -DOTBR_ENABLE_SRP_SERVER_AUTO_ENABLE_MODE=1 -DOTBR_ENABLE_VENDOR_INFRA_LINK_SELECT=0 -DOTBR_MESHCOP_SERVICE_INSTANCE_NAME="\"OpenThread BorderRouter\"" -DOTBR_PACKAGE_NAME=\"OpenThread_BorderRouter\" -DOTBR_PACKAGE_VERSION=\"0.3.0-thread-reference-20230710-114-g741a5860d7\" -DOTBR_PRODUCT_NAME=\"BorderRouter\" -DOTBR_SYSLOG_FACILITY_ID=LOG_USER -DOTBR_VENDOR_NAME=\"OpenThread\" -I/home/haydningram/chip_test/otbr/ot-br-posix/include -I/home/haydningram/chip_test/otbr/ot-br-posix/src -I/home/haydningram/chip_test/otbr/openwrt/build_dir/target-aarch64_cortex-a72_musl/openthread-br-1.0/third_party/openthread/repo/etc/cmake -I/home/haydningram/chip_test/otbr/ot-br-posix/third_party/openthread/repo/etc/cmake -I/home/haydningram/chip_test/otbr/ot-br-posix/third_party/openthread/repo/include -I/home/haydningram/chip_test/otbr/ot-br-posix/third_party/openthread/repo/src/posix/platform/include -I/home/haydningram/chip_test/otbr/ot-br-posix/third_party/openthread/repo/src -I/home/haydningram/chip_test/otbr/ot-br-posix/third_party/openthread/repo/third_party/mbedtls/repo/include -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/home/haydningram/chip_test/otbr/openwrt/build_dir/target-aarch64_cortex-a72_musl/openthread-br-1.0=openthread-br-1.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DOPENTHREAD_POSIX_CONFIG_DAEMON_SOCKET_BASENAME=\"/var/run/openthread-%s\" -DNDEBUG -std=c++11 -Wall -Wextra -Werror -Wfatal-errors -Wuninitialized -Wno-missing-braces -MD -MT src/mdns/CMakeFiles/otbr-mdns.dir/mdns_avahi.cpp.o -MF src/mdns/CMakeFiles/otbr-mdns.dir/mdns_avahi.cpp.o.d -o src/mdns/CMakeFiles/otbr-mdns.dir/mdns_avahi.cpp.o -c /home/haydningram/chip_test/otbr/ot-br-posix/src/mdns/mdns_avahi.cpp
In file included from /home/haydningram/chip_test/otbr/ot-br-posix/src/mdns/mdns_avahi.cpp:36:
/home/haydningram/chip_test/otbr/ot-br-posix/src/mdns/mdns_avahi.hpp:43:10: fatal error: avahi-client/client.h: No such file or directory
   43 | #include <avahi-client/client.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Avahi, specifically libavahi-client and avahi-daemon, is required as a dependency for MDNS features within openthread-br.
The problem is that from all the feeds the build has to work with, avahi is not found from any of them. This is reflected in make menuconfig where the two package mentioned can be found with a search, but only because openthread-br mentions them as a dependency. This is also reflected by the initial warnings I was receiving at the start...

WARNING: Makefile 'package/feeds/openthread/openthread-br/Makefile' has a dependency on 'libavahi-client', which does not exist
WARNING: Makefile 'package/feeds/openthread/openthread-br/Makefile' has a dependency on 'avahi-daemon', which does not exist

So...
How can I edit the feeds such that they can find avahi?
One of the default feeds is packages.git
Inside this, avahi should be defined here in all relevant branches.
I do not understand why avahi is then not found by the feeds by default.

Thanks

Hopefully this update makes my issue a lot more specific - and hopefully it is the last issue to resolve too!

I also hope the commands I have listed here help another beginner resolve the same issues. I understand that those commands are blatantly obvious to most, even in more general build environments, but it still held me back for a good while.

Thanks all : )

I found this post as I'm also interested in using Matter/Thread with OpenWRT.

Stupid question - have you tried installing libavahi-client and avahi-daemon via opkg? They are definitely available there as they are important for many network protocols.

Thanks for attempting this!

Hello.

I have made a fair bit of progress since my last post so I will update this with what I have done, or at least what I remember.

Compiling

Avahi

I fixed the issues I was having with compiling avahi after reading a document on a different package. On this matter-openwrt readme, its instructed to copy over the packages feed from feeds.conf.default to feeds.conf.
My previous, and incorrect, understanding was that feeds.conf was an extension, not a replacement.

make

I cannot remember specific issues after this with compiling, however the make commands I use to get this working every time is...

make clean
make tools/install
make toolchain/install
make target/compile
make package/openthread-br/compile -j1 V=s

Installation

After taking the produced ipk and transferring it to the router, it should be able to be installed with opkg. It didn't work immediately, but these errors were solved by installing the prerequisite packages with opkg - I did this just on the Luci interface.

At this point I need to mention that the hardware I am now building on this the DL-WRX36, not the Pi 4. It is an actual router and better suited my needs. With that in mind the specific opkg installs you might require will differ.
One key package I required was a package to allow for AMCX serial ports to be used on the device. This will be required to start using the RCP, but yet again, your hardware may have these ports working by default. The exact package name I forgot, but it was a kernel module with amc in the name.

Issues

I may be skipping a few steps, but I have gotten to the point where I can issue ot-ctl commands and the responses from command line are correct. I haven't managed to commission any thread devices into the network the RCP says it is leading. This is just because I am unsure of what configuration of chip-tool & thread device would work.

A step back

The ot-br-posix readme is very limited. This lead me to using the readme from my first option, openwrt/packages.
This got me thinking why I couldn't get this port working in the first place. I said in my original post that this option would be preferable since its on the official community packages feed - plus has much better documentation.
With what I have learned so far, I was able to get this package linked with the feed and compiled into an ipk.

The reason it could not be discovered by default on the packages feed is because the openthread resources only exist on the master branch of the packages git repository. I was skeptical about how the package would then compile for a chosen openwrt version, but it seems fine so far.
You can point to the master branch of packages by adding ;master on the end of the packages line within feeds.conf (Copied over from feeds.conf.default).

Where I am now

Using the same fixes as before, I managed to get to the same point as where I was previously with more confidence in this version of the openthread package. I am now on this stage which, despite my praise previously, is terrible documentation. I am unfamiliar with how to setup these ipv6 routes and what is exactly required here but I will hopefully progress.


As I have said many times before in this thread, a lot of the issues I am facing is gaps in the documentation that others can easily bridge across using what is likely basic knowledge. For myself who has no experience here, these gaps are quite disruptive.

Thank you @spush1 for your engagement, I hope that you can make swift progress.
: )

Success

Thanks to a timely notification referencing this thread, I was reminded to post here again.

After more work on this, I have managed to get it working. I will try to remember what I have done since and describe it here so that it may act as a guide. I plan on documenting this all privately for personal use. If I realise I missed something important in this post, then I'll come back to update it. Otherwise, I should be able to answer any future questions; just remember that the whole reason I looked for help here is because I am new to OpenWrt and such.

Routing

As I said in my last reply, I didn't understand the steps required to set up the route described in the document. I previously skipped this step and carried on with the ot-ctl commands, which worked correctly. It wasn't until trying to commission devices using chip-tool was this routing required.

Firstly, the abstracted routing problem here is that there are two interfaces of equal but separate scopes that I require IP traffic to be routed between, specifically IPv6. On one side is the lan interface with the br-lan device. This scope has a ULA with a prefix beginning fd1f and is the typical LAN setup most routers will have. Next is the thread interface with the wpan0 device, which is setup for Thread communications. This scope has a ULA prefix beginning fd6f.
Of course, these prefixes will be different (and not just 4 digits) for different setups; I'll use them here to shorten things.

From what I can remember, there are three actions I had to take to allow routing between these two interfaces.

First

I need to tell my laptop, the Matter commissioner, to route fd6f traffic upstream. This can be done using:
ip -6 route add <rule>

where <rule> is constructed like so:
<thread-ula-prefix> via <router-ip> dev <corresponding-net-device>

In my case, fd6f::/64 might be my ULA prefix, fe80::1 might be the router's IP, and eth0 the net device. The last two can be found in ip -6 addr show and often come in specific pairs, i.e., the address of the router over Ethernet is different than the one over Wi-Fi (when using link-local, that is).

Second

Now you should be able to ping fd6f addresses and have packets sent to the router; you can capture them using tcpdump -i br-lan or similar. You might notice that fd6f range devices, perhaps the OpenThread dongle, actually respond to ping. This might not be the case. The router may receive traffic bound for fd6f addresses, see the exact address in its record, and respond on the device's behalf, never trying to actually send the ping packets over.

You can get around this by pining a fd6f address that doesn't exist. In this case, the router cannot see that device, doesn't respond on its behalf, and actually bothers to send over the traffic. But not so fast! There are still a couple more steps I had to complete for this to work.

The second step is to enable IP forwarding. It should be enabled by default, but it is worth checking just in case. You will want v6 forwarding specifically. To check this, you can use:

sysctl net.ipv6.conf.all.forwarding    # To check
sysctl net.ipv6.conf.all.forwarding=1  # To enable

Third

This had me stuck for a bit. Despite enabling IP forwarding, it turns out my router's firewall settings blocked it. You can have the firewall accept forwarding by going to the luci web GUI and following:

Network > Firewall > General Settings > Forward > change to accept.

After these changes, fd6f addresses should be reachable from the fd1f scope. You can test this by pinging an address of fd6f scope that doesn't exist from the fd1f scope device while looking for the packets on tcpdump -i wpan0.

Commissioning

Hopefully, after all that, you reach the same point I did where commissioning thread devices using chip-tool on a LAN device works! Things worth pointing out with the chip-tool command are:

  • If you are using development boards, point to a local paa store using --paa-trust-store. If you have the connectedhomeip repo locally, you can point to connectedhomeip/credentials/development/paa-root-certs.
  • You will likely want to use the ble-thread or code-thread commands.

Some knowledge I have gained while trying to debug chip-tool failures:

  • Failures during the ThreadNetworkEnable step are from the thread device itself. Unlikely, you will have made the same mistake as I did, but networkingStatus=2 means the device is already commissioned elsewhere and has reached its network limit.
  • If your setup was like mine, where Thread communications worked fine and the problem was with IP routing, the logs found in luci's Status > System Log are useful. The otbr-agent logs are usually intuitive enough to understand or learn from.
  • Failure because of the forwarding issue happens during FindOperational. You should see the pattern in chip-tool logs of contacting the thread device over BLE, then attempting over IP a few times, going back to BLE, then trying over IP, etc. in a loop.

So Close

After being able to commission devices, everything else was a lot easier. I commissioned a light and motion sensor and bound the two (so that the light activates in response to motion) really quickly. The devices are still commissioned and working fine (ish), but I have just found myself with another error.

After leaving it over night, my chip-tool commands seem to have stopped working, so I cannot contact anything in the network using it. I know chip-tool is completely separate from OpenWrt, and this is not the place to ask about it, but the root of the problem lies with the mdns discovery, which I imagine is more familiar. mdns-scan from cli correctly finds the advertising thread network, yet chip-tool will always timeout during discovery. If anyone thinks they could help with this, I would really appreciate it. Hopefully it resolves quickly and I can go back to a working setup. I don't quite know how post discovery works on here, but I will hold off marking this as the solution for a short while in-case the right people would happen to not read this.

Thanks for the help and engagement. Hopefully this post allows others to set this up quicker than I did.

: )

Fixed!

So turns out mdns was fine. The problem was chip-tool forgot and was trying to look for a different fabric ID. The reason this was is because I didn't realise /tmp is vulnerable to being flushed after reboot.

To get round this copy over chip-tool config files into a permanent location.
cp /tmp/chip* ./config/

Then make sure to point to it with every chip-tool command.
chip-tool ... --storage-directory ./config/.

: P

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.