René's URL Explorer Experiment


Title: Link-local AAAA records stay unscoped on a dual-stack host: the scoped IPv6 copy is dropped as a duplicate of the IPv4 one (follow-up to #1567) · Issue #1927 · python-zeroconf/python-zeroconf · GitHub

Open Graph Title: Link-local AAAA records stay unscoped on a dual-stack host: the scoped IPv6 copy is dropped as a duplicate of the IPv4 one (follow-up to #1567) · Issue #1927 · python-zeroconf/python-zeroconf

X Title: Link-local AAAA records stay unscoped on a dual-stack host: the scoped IPv6 copy is dropped as a duplicate of the IPv4 one (follow-up to #1567) · Issue #1927 · python-zeroconf/python-zeroconf

Description: #1764 made parsed_scoped_addresses() prefer a scoped copy of an AAAA record when an unscoped one is also cached, and left "the IPv4-only-arrival case" for a follow-up. I couldn't find an issue for that follow-up, so here it is with measu...

Open Graph Description: #1764 made parsed_scoped_addresses() prefer a scoped copy of an AAAA record when an unscoped one is also cached, and left "the IPv4-only-arrival case" for a follow-up. I couldn't find an issue for ...

X Description: #1764 made parsed_scoped_addresses() prefer a scoped copy of an AAAA record when an unscoped one is also cached, and left "the IPv4-only-arrival case" for a follow-up. I couldn't find...

Opengraph URL: https://github.com/python-zeroconf/python-zeroconf/issues/1927

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Link-local AAAA records stay unscoped on a dual-stack host: the scoped IPv6 copy is dropped as a duplicate of the IPv4 one (follow-up to #1567)","articleBody":"#1764 made `parsed_scoped_addresses()` prefer a scoped copy of an AAAA record when an unscoped one is also cached, and left \"the IPv4-only-arrival case\" for a follow-up. I couldn't find an issue for that follow-up, so here it is with measurements. In short: on a dual-stack host the scoped copy usually never reaches the cache, so #1764 has nothing to prefer. Disabling packet duplicate suppression is enough for 0.151.5 to return `fe80::…%\u003cidx>`.\n\n## Setup\n\n- **Querier:** Linux 6.12, 32-bit ARM (armv7l), Python 3.14. One wired interface (index 2) with IPv4, a link-local address, and global and ULA IPv6 addresses (SLAAC, with temporary addresses). `AsyncZeroconf(ip_version=IPVersion.All)`, default interfaces.\n- **Peers:** embedded devices on the same link. Each answers with its A record and three AAAA records (link-local, global, ULA) in one message, over both IPv4 and IPv6.\n- **Version:** 0.151.5, and master at f0c27b38 (2026-10-01), whose `src/zeroconf` is identical to 0.151.5. Both were run as pure Python so `AsyncListener._process_datagram_at_time` could be wrapped. For every response carrying a peer's link-local AAAA, the wrapper logged which socket it arrived on, the sender's address, and the scope zeroconf would give it. It logged before the duplicate check runs.\n- **Control:** a plain IPv6 UDP socket on 5353, joined to ff02::fb on interface 2, sent an AAAA query. All 18 peers answered by multicast from their `fe80::` address, and `recvfrom` gave scope 2 for every one. The peers do their part, and the kernel supplies the scope.\n\n## Results\n\n**One-shot lookups:** `AddressResolver(host).async_request(zc, 3000)`, a fresh instance each time, 10 rounds over 3 peers (0.151.5).\n\n| Measurement | 0.151.5 |\n|---|---|\n| Lookups where `parsed_scoped_addresses()` gave a usable link-local scope | 0 / 30 |\n| IPv6 respond socket bound to a global address, not link-local | 30 / 30 |\n| First copy of the link-local AAAA in an IPv4 packet (scope `None`) | 14 |\n| First copy by unicast IPv6 from the peer's global address (scope 0) | 16 |\n| A scoped copy (from the peer's `fe80::`, scope 2) received at all | 1 |\n| ...that ended up in the cache | 0 |\n\nIn that one lookup, the IPv4 copy arrived on the `::` listen socket from v4-mapped `::ffff:192.0.2.x` (scope 0) at 571 ms. The IPv6 copy from the peer's `fe80::` address (scope 2) followed at 573 ms. The cache ended with only the scope-0 and `None` entries.\n\n**Browsing:** an `AsyncServiceBrowser` for the peers' service type, with the cache read every 10 s.\n\n- **Unmodified (0.151.5, 300 s):** the link-local addresses stayed unscoped throughout.\n- **0.151.5 with `_DUPLICATE_PACKET_SUPPRESSION_INTERVAL = 0`, otherwise unchanged:** the same pair (v4-mapped first, `fe80::` 4 ms later) arrived at 202 s for all three peers. From then on the cache held a scope-2 entry for each, and `parsed_scoped_addresses()` returned `fe80::…%2` for all three.\n\n**Duplicate drops on master:** a 300 s browse with debug logging logged 43 \"Ignoring duplicate message\" lines for packets from the peers' `fe80::` addresses. Those are the only copies that carry a scope. It also logged 183 for v4-mapped senders. All were on the `::` socket.\n\n## Why: four ways the scope is lost\n\n1. **Duplicate suppression ignores the sender.** The IPv6 listen socket is bound to `::` with `IPV6_V6ONLY` off, so it receives both IPv4 and IPv6 multicast. A peer's IPv4 and IPv6 announcements are byte-identical, and the IPv4 copy usually arrives first. The listener's duplicate checks compare payload bytes only: both the last-packet check and the `_recent_packets` cache from #1750. So the IPv6 copy, the only one that carries a scope, is dropped. #1750 keeps that state per listener \"so a duplicate seen on one interface does not suppress\" a packet arriving on another. But with the dual-stack `::` socket, the IPv4 and IPv6 sides of one interface share a listener. #1764 can't help, because the scoped record never reaches the cache.\n2. **The IPv4 copy is scoped from its sender.** On the `::` socket it arrives as `::ffff:a.b.c.d` with scope 0. That gives a cache entry with scope 0, which is no more usable than one with none.\n3. **The first answer comes over IPv4, unicast.** The first query is QU, so the peer answers by unicast to the query's source address, and an IPv4 answer carries the AAAA records too. It arrives on the IPv4 respond socket, so it has no scope, although that socket belongs to one interface.\n4. **The IPv6 respond socket is bound to a global address.** zeroconf binds one IPv6 respond socket per interface, to one of the interface's addresses. Here it was always a global one (which one varied between runs), never the link-local. So a QU answer over IPv6 comes from the peer's global address, and the scope taken from that sender is 0.\n\n## The RFCs\n\n- **RFC 6762 §6.2:** a responder \"MUST include all addresses that are valid on the interface on which it is sending the message\". The RFC's example is a link-local plus a routable address, \"so that queriers receive both and can make their own choice\", and it says this \"allows a querier that only has an IPv6 link-local address to connect to the link-local address\". The same section says a responder SHOULD include the other address type in the additional section, so that \"all a device's addresses are delivered atomically in a single message\". An AAAA record arriving in an IPv4 packet (cases 1 to 3) is therefore normal, conformant behaviour, not an edge case.\n- **RFC 6762 §14:** addresses in responses \"MUST be valid for use on the interface on which the response is being sent\", and a host needs \"network programming APIs that allow applications ... to discover on what interface a Multicast DNS response was received\". So a link-local address in a response belongs to the interface the response arrived on. For the respond sockets that interface is known, since each is bound to one. The shared `::` listen socket serves every interface, so there it isn't known. Either way, the sender's sockaddr only gives the interface when the sender happens to be link-local.\n- **RFC 6762 §5.4:** the first questions are QU, and \"a responder SHOULD usually respond with a unicast packet directed back to the querier\". That is why the first answer arrives unicast, on whichever family and source address the query went out from (cases 3 and 4).\n- **RFC 6762 §20:** a dual-stack host \"acts like a multihomed host, with one connection to the logical 'IPv4 Ethernet segment', and a connection to the logical 'IPv6 Ethernet segment'\". On that view an IPv4 and an IPv6 copy of the same answer are two separate arrivals, not a duplicate packet (case 1).\n- **RFC 4007 §6 and §11.2:** a non-global address needs a zone index, and zone 0 or no zone means the default zone. Linux has no default zone for link-local addresses, so connecting to `fe80::…` or `fe80::…%0` fails with `EINVAL`. A cache entry with scope 0 is as unusable as one with none.\n\n## Possible fixes\n\nRoughly from smallest to largest:\n\n- **Key duplicate suppression on the scope the packet's records would get** (`addrs[3]`, 0 otherwise), so the scoped IPv6 copy of an answer isn't dropped behind the unscoped IPv4 one (case 1). This looks like the change that would matter most in practice. The control above shows it's enough for #1764 to work whenever a peer multicasts over IPv6. PR #1926 does this.\n- **Don't scope records from a v4-mapped sender** (case 2). Those packets are IPv4, and scope 0 means \"unknown\".\n- **Bind the per-interface IPv6 respond socket to the interface's link-local address** (case 4). QU answers over IPv6 then come from the peer's link-local address, with the right scope.\n- **Scope link-local AAAA records from the receiving interface**, IPv4 packets included (case 3), as RFC 6762 §14 describes. The draft #1568 (\"Use per-interface per-protocol sockets\") does this: one socket per interface and per address family, each listener stamping its interface index on what it receives, and IPv6 bound to link-local. That would also cover cases 1, 2 and 4. The alternative #1567 mentions is `IP_PKTINFO`/`IPV6_RECVPKTINFO` with `recvmsg`.\n\nOur workaround in the meantime is to derive the scope ourselves: the interface whose IPv4 subnet or IPv6 prefix contains one of the peer's other addresses.\n\nWe'd be glad to help further, including running any patched build (#1568 rebased, for instance) against the same peers with the same measurements.\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n","author":{"url":"https://github.com/akiernan","@type":"Person","name":"akiernan"},"datePublished":"2026-10-23T15:52:34Z","url":"https://github.com/python-zeroconf/python-zeroconf/issues/1927"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:9b298be6-0781-5419-72ac-a27c09c5b3d4
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE348:74B5:113A2:18265:6B007D38
html-safe-nonce533ab3c9d0e69859a3362ca3938c327c73fbd190050dff2c61a5ebf634d12b89
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzQ4Ojc0QjU6MTEzQTI6MTgyNjU6NkIwMDdEMzgiLCJ2aXNpdG9yX2lkIjoiNzA4MDQyOTUxNTQwNjYwNTYyNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac18a2a3b11ed9694cb91c05511b0cd89775d2bb895851e49f2f38f0c8ec3b8330
hovercard-subject-tagissue:6001009007
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-zeroconf/python-zeroconf/1927/issue_layout
twitter:imagehttps://opengraph.githubassets.com/78a41b29be52847dc7c3c59fa0d7e5f006361ddea804e1b7f000a19e20612faa/python-zeroconf/python-zeroconf/issues/1927
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/78a41b29be52847dc7c3c59fa0d7e5f006361ddea804e1b7f000a19e20612faa/python-zeroconf/python-zeroconf/issues/1927
og:image:alt#1764 made parsed_scoped_addresses() prefer a scoped copy of an AAAA record when an unscoped one is also cached, and left "the IPv4-only-arrival case" for a follow-up. I couldn't find an issue for ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameakiernan
hostnamegithub.com
expected-hostnamegithub.com
None82c186f13e104004ab7bdb779f3195e59dd38bfde531aaa74b76470fc2462b83
turbo-cache-controlno-preview
go-importgithub.com/python-zeroconf/python-zeroconf git https://github.com/python-zeroconf/python-zeroconf.git
octolytics-dimension-user_id120192235
octolytics-dimension-user_loginpython-zeroconf
octolytics-dimension-repository_id21548731
octolytics-dimension-repository_nwopython-zeroconf/python-zeroconf
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id21548731
octolytics-dimension-repository_network_root_nwopython-zeroconf/python-zeroconf
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
released1bc2aa1939001689f5ce935982c10a6138f745c
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python-zeroconf/python-zeroconf/issues/1927#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-zeroconf%2Fpython-zeroconf%2Fissues%2F1927
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-zeroconf%2Fpython-zeroconf%2Fissues%2F1927
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python-zeroconf%2Fpython-zeroconf
Reloadhttps://github.com/python-zeroconf/python-zeroconf/issues/1927
Reloadhttps://github.com/python-zeroconf/python-zeroconf/issues/1927
Reloadhttps://github.com/python-zeroconf/python-zeroconf/issues/1927
python-zeroconfhttps://github.com/python-zeroconf
python-zeroconfhttps://github.com/python-zeroconf/python-zeroconf
Codehttps://github.com/python-zeroconf/python-zeroconf
Issues50 (50)https://github.com/python-zeroconf/python-zeroconf/issues
Pull requests16 (16)https://github.com/python-zeroconf/python-zeroconf/pulls
Discussionshttps://github.com/python-zeroconf/python-zeroconf/discussions
Actionshttps://github.com/python-zeroconf/python-zeroconf/actions
Projectshttps://github.com/python-zeroconf/python-zeroconf/projects
Wikihttps://github.com/python-zeroconf/python-zeroconf/wiki
Security and quality5 (5)https://github.com/python-zeroconf/python-zeroconf/security
Insightshttps://github.com/python-zeroconf/python-zeroconf/insights
https://github.com/python-zeroconf/python-zeroconf
New issuehttps://github.com/login?return_to=https://github.com/python-zeroconf/python-zeroconf/issues/1927
New issuehttps://github.com/login?return_to=https://github.com/python-zeroconf/python-zeroconf/issues/1927
Link-local AAAA records stay unscoped on a dual-stack host: the scoped IPv6 copy is dropped as a duplicate of the IPv4 one (follow-up to #1567)https://github.com/python-zeroconf/python-zeroconf/issues/1927#top
https://github.com/akiernan
akiernanhttps://github.com/akiernan
on Oct 23, 2026https://github.com/python-zeroconf/python-zeroconf/issues/1927#issue-6001009007
#1764https://github.com/python-zeroconf/python-zeroconf/pull/1764
#1764https://github.com/python-zeroconf/python-zeroconf/pull/1764
f0c27b3https://github.com/python-zeroconf/python-zeroconf/commit/f0c27b38ea02484d7bb96f4d06e8e1941c4525f9
fix: bound duplicate-packet dedup against alternating-payload floods #1750https://github.com/python-zeroconf/python-zeroconf/pull/1750
fix: bound duplicate-packet dedup against alternating-payload floods #1750https://github.com/python-zeroconf/python-zeroconf/pull/1750
fix: preserve scope_id when scoped AAAA arrives alongside unscoped #1764https://github.com/python-zeroconf/python-zeroconf/pull/1764
fix: preserve scope_id when scoped AAAA arrives alongside unscoped #1764https://github.com/python-zeroconf/python-zeroconf/pull/1764
fix: don't suppress a scoped copy of a packet as a duplicate of an unscoped one #1926https://github.com/python-zeroconf/python-zeroconf/pull/1926
WIP: Use per-interface per-protocol sockets #1568https://github.com/python-zeroconf/python-zeroconf/pull/1568
Link-local addresses returned without scope. #1567https://github.com/python-zeroconf/python-zeroconf/issues/1567
#1568https://github.com/python-zeroconf/python-zeroconf/pull/1568
Claude Codehttps://claude.com/claude-code
Sign up for freehttps://github.com/signup?return_to=https://github.com/python-zeroconf/python-zeroconf/issues/1927
Sign in to commenthttps://github.com/login?return_to=https://github.com/python-zeroconf/python-zeroconf/issues/1927
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.