OpenPrinting / cups

OpenPrinting CUPS Sources
https://openprinting.github.io/cups
Apache License 2.0
958 stars 174 forks source link

dnssd.c: Let Avahi decide the hostname for register #902

Closed zdohnal closed 3 months ago

zdohnal commented 4 months ago

Sometimes it happens Avahi can register local service under a hostname of different machine, if the local daemon enforces the hostname as parameter, but the hostname is already taken by different machine.

If NULL is passed as hostname into Avahi API for adding services, Avahi figures out hostname and IP address to use based on interface index passed into the function, and handles hostname changes as well.

This way enables adding services to localhost only, because Avahi takes localhost as an invalid FQDN (unless the machine hostname is localhost). The current way of how to share the service on localhost only in Avahi is to use interface index for loopback and pass NULL as hostname.

michaelrsweet commented 3 months ago

[master a88910bd0] Use NULL hostname for services on the loopback interface (Issue #902)