← 输入框|github.com|刷新
Skip to content

async_update_interfaces does not report whether the requested interfaces were bound #1916

Open

Description

@bdraco

Problem

Zeroconf.async_update_interfaces is best-effort and returns None, so a caller cannot tell whether the requested configuration was applied.

Two failure paths are logged and swallowed:

  • A listen socket rebuild that fails, for example switching an IPv4 instance to IPVersion.All on a host that cannot open a dual-stack AF_INET6 socket. The engine logs Skipping interface update; listen socket rebuild failed and returns False.
  • A requested interface that fails to bind. The engine logs Interface ... not added once and carries on.

In both cases Zeroconf.async_update_interfaces still commits the requested interfaces and ip_version as the retained configuration, and returns normally.

Where

Why it matters

A caller that asks for dual-stack and cannot get it has no signal to fall back to IPVersion.V4Only, or to retry later. It also cannot log an accurate outcome: a caller that logs "reconciled with IPVersion.All" after a swallowed rebuild failure is wrong.

In esphome/device-builder#2864 this meant a runtime IPv4-only fallback could not be implemented, because the failure it would react to never surfaces.

Suggested fix

Report the outcome from the public method. Options:

  • Return whether the desired interface set fully bound, or the list of interfaces that were skipped.
  • Raise when the address family rebuild fails, since in that case none of the requested change was applied.

Either keeps the best-effort behaviour for per-interface failures while letting callers react.

Activity

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