Skip to content

mDNS: ignore truncated DNS headers before updating discovery state - #2926

Open
SeoFood wants to merge 2 commits into
postlund:masterfrom
SeoFood:seofood/mdns-truncated-packets
Open

SeoFood wants to merge 2 commits into
postlund:masterfrom
SeoFood:seofood/mdns-truncated-packets

Conversation

@SeoFood

@SeoFood SeoFood commented Oct 12, 2026

Copy link
Copy Markdown

Truncated DNS headers raise struct.error in the discovery protocol handlers. Ignore these malformed replies before changing response counters or per-host discovery state, then continue processing valid responses.

The multicast handler also avoids creating empty host entries for replies with no services or only unrelated services.

Fixes #2703.

Validation on this branch with Python 3.12 in Docker (--network none):

  • All 59 mDNS unit and functional tests pass. The 24 truncated-header cases and two filtered-reply cases fail against the base code.
  • The full test suite passes: 1,273 passed, 5 skipped.
  • Formatting, linting and type checks using the project configuration pass.

The tests send synthetic packets followed by valid replies. No Apple TV or Home Assistant instance was used. The outer receive delegate already catches exceptions; this fixes malformed-packet handling and logging, not a demonstrated process crash.

This branch has not been deployed

No deployments
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.

mDNS crash

1 participant