]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Use NULL hostname for services on the loopback interface (Issue #902)
authorMichael R Sweet <msweet@msweet.org>
Sat, 6 Apr 2024 13:51:14 +0000 (09:51 -0400)
committerMichael R Sweet <msweet@msweet.org>
Sat, 6 Apr 2024 13:51:14 +0000 (09:51 -0400)
cups/dnssd.c

index 1a265814b4113dcfb5649fdd62468e0a924963ad..d5e9e15e55219697ed1660d99b9c8b38479ac841 100644 (file)
@@ -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);