Skip to content

fix: do not suppress answers on a known-answer TTL above our own - #539

Merged
keepsimple1 merged 1 commit into
keepsimple1:mainfrom
meliodaff:fix/537-known-answer-impossible-ttl
Nov 3, 2026
Merged

keepsimple1 merged 1 commit into
keepsimple1:mainfrom
meliodaff:fix/537-known-answer-impossible-ttl

Conversation

@meliodaff

Copy link
Copy Markdown
Contributor

Fixes #537

suppressed_by_answer suppresses an answer when the known-answer TTL is more than half of ours, with no upper limit. An Android 13 phone lists our 4500 s PTR with a TTL of about 390000 s, so every answer is suppressed. The phone stops getting the 120 s SRV and A records sent along with it, and drops the service when they expire, every 2 minutes.

A known answer whose TTL is above the record's own is now treated as invalid and does not suppress.

As you noted on the issue, a querier that cached the record from an earlier registration with a larger custom TTL now gets one extra answer, which is harmless. The doc comment on suppressed_by_answer records this.

Tests

  • New test_known_answer_with_impossible_ttl_does_not_suppress: known TTLs of 4501 and 390000 against our 4500 are still answered. It fails without the fix.
  • New `test_known_answer_suppresses_above_half_ttleep working. 2250 is answered; 2251 and 4500 are
    suppressed.

Both build a real query with DnsOutgoing, parse eck the result of add_answer.

cargo test passes on Windows 11 against main (0.21.7): 88 unit, 39 network (mdns_test), 8 shutdown, 3 address-parsing and 4 doc tests. --all-features passes too (89 unit). clippy commands and cargo doc are clean.

Checked on a phone (0.21.6 with this change, before 0.21.7 came out): the Redmi Note 12 from the issue held the service for 6 minutes with no TTL expired. Without the change s in the same length of capture.

An Android 13 phone lists our 4500 s PTR as a known answer with a TTL of
about 390000 s. Any value above half of our TTL suppressed the answer, so
the phone stopped getting the 120 s SRV and A records sent along with it,
and dropped the service when they expired, every 2 minutes.

A correct querier cannot have more time left than the TTL we send, so
treat such a known answer as invalid. A querier that cached the record
from an earlier registration with a larger TTL gets one extra answer,
which is harmless.

Fixes keepsimple1#537

@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.

Changes LGTM, thanks!

nitpick: the PR description is garbled in three places: “ttleep working”, “parse eck the result”, and “Without the change s in the same length of capture”. It looks like text got lost while pasting.

@keepsimple1
keepsimple1 merged commit fc0c597 into keepsimple1:main Nov 3, 2026
6 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.

Android 13 drops a service every 2 minutes: known answers with an impossible TTL suppress all answers

2 participants