Skip to content

Commit 62c01bb

Browse files
committed
Fix DNS-SD lookups of local services with Avahi (Issue #970)
1 parent b7000b0 commit 62c01bb

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Changes in CUPS v2.4.9 (TBA)
1111
- Really raised `cups_enum_dests()` timeout for listing available IPP printers
1212
(Issue #751)...
1313
- Fixed `Host` header regression (Issue #967)
14+
- Fixed DNS-SD lookups of local services with Avahi (Issue #970)
1415

1516

1617
Changes in CUPS v2.4.8 (2024-04-26)

cups/http-support.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2540,6 +2540,18 @@ http_resolve_cb(
25402540
return;
25412541
}
25422542

2543+
// Map the addresses "127.0.0.1" (IPv4) and "::1" (IPv6) to "localhost" to work around a well-known Avahi registration bug for local-only services (Issue #970)
2544+
if (address->proto == AVAHI_PROTO_INET && address->data.ipv4.address == htonl(0x7f000001))
2545+
{
2546+
DEBUG_puts("5http_resolve_cb: Mapping 127.0.0.1 to localhost.");
2547+
hostTarget = "localhost";
2548+
}
2549+
else if (address->proto == AVAHI_PROTO_INET6 && address->data.ipv6.address[0] == 0 && address->data.ipv6.address[1] == 0 && address->data.ipv6.address[2] == 0 && address->data.ipv6.address[3] == 0 && address->data.ipv6.address[4] == 0 && address->data.ipv6.address[5] == 0 && address->data.ipv6.address[6] == 0 && address->data.ipv6.address[7] == 0 && address->data.ipv6.address[8] == 0 && address->data.ipv6.address[9] == 0 && address->data.ipv6.address[10] == 0 && address->data.ipv6.address[11] == 0 && address->data.ipv6.address[12] == 0 && address->data.ipv6.address[13] == 0 && address->data.ipv6.address[14] == 0 && address->data.ipv6.address[15] == 1)
2550+
{
2551+
DEBUG_puts("5http_resolve_cb: Mapping ::1 to localhost.");
2552+
hostTarget = "localhost";
2553+
}
2554+
25432555
/*
25442556
* If we have a UUID, compare it...
25452557
*/

0 commit comments

Comments
 (0)