Skip to content

fix: cap TTL to 10s in legacy unicast responses - #504

Merged
keepsimple1 merged 2 commits into
mainfrom
fix/issue-496-2
Sep 7, 2026
Merged

keepsimple1 merged 2 commits into
mainfrom
fix/issue-496-2

Conversation

@keepsimple1

@keepsimple1 keepsimple1 commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Fixes: #496 , the second problem.

Implement this part in RFC 6762 §6.7:
The resource record TTL given in a legacy unicast response SHOULD NOT be greater than ten seconds, even if the true TTL of the Multicast DNS resource record is higher. This is because Multicast DNS responders that fully participate in the protocol use the cache coherency mechanisms described in Section 10, "Resource Record TTL Values and Cache Coherency", to update and invalidate stale data. Were unicast responses sent to legacy resolvers to use the same high TTLs, these legacy resolvers, which do not implement these cache coherency mechanisms, could retain stale cached resource record data long after it is no longer valid.

keepsimple1 and others added 2 commits September 7, 2026 12:39
Problem:
RFC 6762 §6.7 requires the records in a legacy unicast response to carry
a TTL no greater than 10 seconds, since legacy resolvers cache them
without the mDNS cache-coherency mechanisms. Responses went out with the
records' true TTLs (120s for host records, 4500s for PTR/TXT).

Fix:
Fold the TTL cap into the existing per-record pass that clears cache-flush
bits, renaming clear_cache_flush_bits() to update_records_for_legacy_unicast().
Add the LEGACY_UNICAST_MAX_TTL constant and assert the cap in
test_legacy_unicast_response.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@keepsimple1
keepsimple1 merged commit d8ab875 into main Sep 7, 2026
4 checks passed
@keepsimple1
keepsimple1 deleted the fix/issue-496-2 branch September 7, 2026 22:32
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.

Legacy unicast responses do not echo the query ID or cap TTLs (RFC 6762 §6.7)

1 participant