8000 Link-local addresses returned without scope. · Issue #1567 · python-zeroconf/python-zeroconf · GitHub
[go: up one dir, main page]

Skip to content

Link-local addresses returned without scope. #1567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dwmw2 opened this issue Apr 16, 2025 · 2 comments
Open

Link-local addresses returned without scope. #1567

dwmw2 opened this issue Apr 16, 2025 · 2 comments

Comments

@dwmw2
Copy link
dwmw2 commented Apr 16, 2025

(Following on from the discussion at esphome/esphome#8536 (comment))

>>> import zeroconf
>>> zc = zeroconf.Zeroconf()
>>> info = zeroconf.AddressResolver("landing-blind-1.local.")
>>> info.request(zc, 10000)
True
>>> print(info.parsed_scoped_addresses())
['172.31.31.173', '2001:8b0:10b:5:f2f5:bdff:fe5f:556c', 'fe80::f2f5:bdff:fe4f:556c']
>>> 

But parsed_scoped_addresses is explicitly documented to return properly scoped link-local addresses "qualified with %<interface_index> when available".

zeroconf 0.146.3 on Ubuntu 24.04.

@bdraco
Copy link
Member
bdraco commented Apr 16, 2025

Looks like the response comes in over IPv4 first so we don't associate a scope to it. Probably not an easy problem to solve.

@agners
Copy link
Collaborator
agners commented Apr 16, 2025

Yeah that is something I am looking into it. Unfortunately, we don't get the interface id when a IPv4 frame is received on our listen socket.

There are two ways how to get the interface id:

  • Using packet info auxiliary data ((with socket options IP_PKTINFO/IPV6_PKTINFO). However, that doesn't work with the Python asyncio transport as is, we'd need to spin our own thing.
  • Use a listen socket per interface.

I have the second option locally in a test branch, I need to clean things up a bit first, but I intend to create a PR soon.

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

No branches or pull requests

3 participants
0