You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
name_change and hostname_change split on escaped dots, so a conflict rename breaks an instance name with dots #546
When a probe finds a conflict, the conflict handler renames the record with name_change (or hostname_change for A/AAAA). Both take the first label with original.split('.'), which also splits on a dot escaped as \. (RFC 6763 section 4.3). For an instance name with dots, the rename lands in the wrong place:
name_change(r"L\.A\.R\.A Hub._lara._tcp.local.")
split('.') → ["L\", "A\", "R\", "A Hub", "_lara", "_tcp", "local", ""]
result: r"L\ (2).A\.R\.A Hub._lara._tcp.local."
on the wire: ["L\ (2)", "A.R.A Hub", "_lara", "_tcp", "local"]
The expected result is L\.A\.R\.A Hub (2)._lara._tcp.local..
hostname_change has the same problem: hostname_change(r"my\.host.local.") gives my\-2.host.local. instead of my\.host-2.local..
Impact: after a conflict, the service is announced under a name with an extra label, which is not the instance the app registered. The new name also does not survive a round trip: write_name sends \ as a literal backslash, and a name read back from a packet escapes it as L\\ (2), which does not equal the stored L\ (2). So queries for the renamed instance still go unanswered.
This becomes reachable with #540. Before it, a peer's record name never matched our escaped probe name, so the conflict path never ran for an instance with dots.
Possible fix: find the end of the first label at the first unescaped dot, the way DnsOutPacket::parse_escaped_name does, and keep the rest of the name as it is. Add cases with \. and \\ in the first label to test_name_change and test_hostname_change.
Activity
fix: keep escaped dots inside first label in name_change/hostname_cha…
fix: keep escaped dots inside first label in name_change/hostname_cha…