From: Michael R Sweet Date: Sat, 6 Apr 2024 13:51:14 +0000 (-0400) Subject: Use NULL hostname for services on the loopback interface (Issue #902) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a88910bd0bc79aa9d051c183c13a211d863e7ea1;p=thirdparty%2Fcups.git Use NULL hostname for services on the loopback interface (Issue #902) --- diff --git a/cups/dnssd.c b/cups/dnssd.c index 1a265814b4..d5e9e15e55 100644 --- a/cups/dnssd.c +++ b/cups/dnssd.c @@ -1080,6 +1080,11 @@ cupsDNSSDServiceAdd( char *regtype, // Registration type *subtypes; // Subtypes (if any) + // Avahi has trouble with hostnames for services that are only available on + // the loopback interface/localhost... + if (service->if_index == CUPS_DNSSD_IF_LOCAL || !_cups_strcasecmp(host, "localhost")) + host = NULL; + // Build the string list from the TXT array... for (i = 0; i < num_txt; i ++) txtrec = avahi_string_list_add_printf(txtrec, "%s=%s", txt[i].name, txt[i].value);