Abhayakara / mdnsresponder

mDNSResponder work-in-progress
Other
20 stars 8 forks source link

fix registering preferred address #4

Closed wgtdkp closed 3 years ago

wgtdkp commented 4 years ago

The problem

We get an IPv4 address when browsing the mDNS service which is registered by a Thread device (controlled via ot-daemon).

srp-api-test._ipps._tcp.local.
192.168.43.239

This IPv4 address belongs to wlan0 but not wpan0.

Expected behavior

The mDNS service should contain the off-mesh reachable IPv6 address of the Thread device.

Fix

This PR fixes this issue by advertising only the off-mesh-reachable IPv6 address if it is present. The comment indicates the expected behavior: https://github.com/Abhayakara/mdnsresponder/blob/eb98f19aff6cfd431414fd55fa6a97136abeb381/ServiceRegistration/srp-client.c#L1167-L1169

Abhayakara commented 3 years ago

This isn't actually a correct fix. The intention is to register all the addresses that the client offers. In this case, it looks like you're using the test client and running it on the BR. This is intended to demonstrate and exercise the functionality, but isn't equivalent to what you'd get if you did a registration from a thread accessory. A thread accessory would not have an IPv4 address, and so this issue wouldn't come up.

But SRP is a general mechanism, not specific to Thread. So we can't have the SRP server behave in ways that only make sense for Thread. Instead, we need the overall system to do the correct thing. In principle, to do what you are asking, the way to do it would be to have the client only register addresses on a specified interface. This could be added to the client, but it's not a priority because this all works just fine when the accessory is on the Thread network.