openthread / ot-commissioner

OpenThread Commissioner, a Thread commissioner for joining new Thread devices and managing Thread networks.
https://openthread.io/
BSD 3-Clause "New" or "Revised" License
49 stars 36 forks source link

mDNS 'borderagent discover' issue on host with multiple network interfaces #206

Open EskoDijk opened 3 years ago

EskoDijk commented 3 years ago

Network configuration is shown below, the WiFi interface (wlp0s20f3) is in a 'DOWN' state. The intention is for mDNS to use the ethernet (enp0s31f6) interface. (Or ideally, mDNS could try all valid interfaces and skip the invalid ones.)

esko@IoTconsultancy:~/ot-commissioner/build$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 38:22:e2:e3:71:da brd ff:ff:ff:ff:ff:ff
    inet 192.168.137.42/24 brd 192.168.137.255 scope global noprefixroute enp0s31f6
       valid_lft forever preferred_lft forever
    inet6 fd00:910b::3a22:e2ff:fee3:71da/64 scope global dynamic mngtmpaddr
       valid_lft 86333sec preferred_lft 14333sec
    inet6 fe80::3a22:e2ff:fee3:71da/64 scope link
       valid_lft forever preferred_lft forever
3: wlp0s20f3: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 0c:7a:15:77:d4:ae brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.66/24 brd 192.168.178.255 scope global dynamic noprefixroute wlp0s20f3
       valid_lft 83854sec preferred_lft 83854sec

Now the problem is as follows:

esko@IoTconsultancy:~/ot-commissioner/build$ ./src/app/cli/commissioner-cli
   ____  ______                                   _           _                          ________    ____
  / __ \/_  __/   _________  ____ ___  ____ ___  (_)_________(_)___  ____  ___  _____   / ____/ /   /  _/
 / / / / / /_____/ ___/ __ \/ __ `__ \/ __ `__ \/ / ___/ ___/ / __ \/ __ \/ _ \/ ___/  / /   / /    / /
/ /_/ / / /_____/ /__/ /_/ / / / / / / / / / / / (__  |__  ) / /_/ / / / /  __/ /     / /___/ /____/ /
\____/ /_/      \___/\____/_/ /_/ /_/_/ /_/ /_/_/____/____/_/\____/_/ /_/\___/_/      \____/_____/___/

> borderagent discover
IO_ERROR: failed to open mDNS IPv4 socket
[failed]

So it appears the Commissioner tries to open (perhaps) the WiFi interface instead of the Ethernet one.