Skip to content

Link-local addresses returned without scope. #1567

Closed

Description

@dwmw2

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

Activity

  1. bdraco commented on Apr 16, 2025

    @bdraco
    Member

    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.

  2. agners commented on Apr 16, 2025

    @agners
    Collaborator

    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.

  3. bdraco commented on May 20, 2026

    @bdraco
    Member
  4. added a commit that references this issue on May 20, 2026
    28cffed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions