Skip to content

Fix Windows TAP handle reopen without resetting the device - #2628

Open
Faulo wants to merge 1 commit into
zerotier:devfrom
Faulo:fix/windows-tap-reopen
Open

Faulo wants to merge 1 commit into
zerotier:devfrom
Faulo:fix/windows-tap-reopen

Conversation

@Faulo

@Faulo Faulo commented Oct 17, 2026

Copy link
Copy Markdown

Fixes #2625.

Problem

The Windows TAP thread disables and enables the persistent device twice before every handle-open attempt. This makes startup and ordinary handle recovery reset an adapter that may already be administratively up and can disturb bindings attached to it.

Change

  • Query the TAP's existing interface LUID with GetIfEntry2 before opening the handle.
  • Request a PnP enable only when AdminStatus is NET_IF_ADMIN_STATUS_DOWN.
  • Preserve the current behavior when the device really is disabled while avoiding resets for up, testing, missing, and unqueryable interfaces.
  • Add a focused CTest regression executable for the decision logic.

Validation

  • Windows x64 Debug with VS 2022 Build Tools 17.14 / MSVC 14.44 and Ninja.
  • windows-tap-device-state: passed.
  • The isolated no-reset build reached Swarm readiness after a Windows Server 2019 boot with an HNS external network. A later managed-address loss is handled by the separate stacked IP-ownership change.

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.

Windows TAP handle reopen unconditionally resets the device

1 participant