agnat/node_mdns

Error while discovering services getaddrinfo -3008

ErwinSteffens opened this issue · 2 comments

We are running this library in a docker image based on Alpine. It cannot resolve the discovered hostname which end on .local within the docker container.

The error we get is: Error while discovering services getaddrinfo -3008

Related issues are: #130 and https://github.com/home-assistant/docker/issues/23.

We have installed the avahi-tools in the docker image and have create a custom resolver which calls avahi-resolve to resolve the ip address for us. We noticed that avahi-resolve communicates back to the avahi-daemon to get the ip-address.

Here are the messages:

method call time=1605546129.250924 sender=:1.96 -> destination=org.freedesktop.Avahi serial=8 path=/; interface=org.freedesktop.Avahi.Server; member=HostNameResolverNew
   int32 -1
   int32 -1
   string "Philips-Hue.local"
   int32 0
   uint32 0
method return time=1605546129.251374 sender=:1.2 -> destination=:1.96 serial=670 reply_serial=8
   object path "/Client83/HostNameResolver1"
signal time=1605546129.251618 sender=:1.2 -> destination=:1.96 serial=671 path=/Client83/HostNameResolver1; interface=org.freedesktop.Avahi.HostNameResolver; member=Found
   int32 2
   int32 1
   string "Philips-hue.local"
   int32 0
   string "10.0.1.119"
   uint32 5

Would it make sense to integrate a resolver for this into the library?

agnat commented

Would it make sense to integrate a resolver for this into the library?

Hehe... no, I don't think so. Uninstalling avahi disables resolving mdns-assigned hostnames ... system-wide. This is expected behaviour. Working around this is not in the scope of this library. Also, I wouldn't create dbus-messages without a proper dbus-stack. That's to error-prone.

No, I think the right way to do this is to configure the name service switch of the guest OS to use the same remote avahi-instance like the application... via dbus/TCP. I'm not sure how to do that. Could be as easy as installing nss-mdns or what have you... or set some env vars early and system-wide ...

Actually, I think using "remote information" in network discovery is a bad idea. Remember #244? Just run the avahi-daemon on the guest and be done with it...

Ok, makes sense. I will close this.