Skip to content

fix: send goodbye packets under conflict-resolved names - #495

Merged
keepsimple1 merged 1 commit into
keepsimple1:mainfrom
dhavli:fix-goodbye-renamed-records
Aug 26, 2026
Merged

fix: send goodbye packets under conflict-resolved names#495
keepsimple1 merged 1 commit into
keepsimple1:mainfrom
dhavli:fix-goodbye-renamed-records

Conversation

@dhavli

@dhavli dhavli commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Problem

When probing renames a record after a name conflict (RFC 6762 section 9), announcements and query responses correctly use the new name via DnsRegistry::name_changes / resolve_name. But unregister_service still builds the TTL=0 goodbye records from the original ServiceInfo names.

Peers on the link only ever cached the renamed records, so the goodbye never matches anything in their caches. An auto-renamed instance therefore lingers in browse lists until its record TTLs expire after unregister() or shutdown(), instead of disappearing within seconds.

Fix

Resolve the service fullname and hostname through the interface's DnsRegistry (the same resolve_name used by prepare_announce) when building the goodbye packet in unregister_service, so the goodbye carries the names peers actually cached. Interfaces without a registry entry keep the original names, as before.

Test

Added test_goodbye_uses_conflict_resolved_name: it forces a conflict rename between two daemons, resolves the renamed instance from a third (browser) daemon, unregisters the renamed service, and asserts the browser receives ServiceRemoved for the renamed fullname well before any TTL could expire.

The test fails on current main (no goodbye ever observed for the renamed instance) and passes with this change. Full cargo test passes.

@keepsimple1 keepsimple1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix! LGTM, with a minor comment inline.

Comment thread tests/mdns_test.rs Outdated
When probing renames a record due to a name conflict (RFC 6762
section 9), announcements and query responses use the new name via
DnsRegistry::name_changes, but unregister_service still built the
TTL=0 goodbye records from the original ServiceInfo names. Peers that
cached the renamed records never saw a matching goodbye, so an
auto-renamed instance lingered in browsers until its record TTLs
expired after unregister or shutdown.

Resolve the service fullname and hostname through the interface's
DnsRegistry when building the goodbye packet, so the goodbye carries
the names peers actually cached.

Add a regression test that forces a conflict rename and verifies a
browser sees ServiceRemoved for the renamed instance promptly after
unregister.
@dhavli
dhavli force-pushed the fix-goodbye-renamed-records branch from 299430f to 076255a Compare August 25, 2026 10:51
@keepsimple1
keepsimple1 merged commit fe525a6 into keepsimple1:main Aug 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants