Skip to content

Bug: network module shows a saved/preferred SSID (stale Wi-Fi name) when Wi-Fi is off on macOS #396

Open

Description

@ykworx

Description

On macOS, scripts/network.sh derives the candidate Wi-Fi name (wifi_network) via:

networksetup -listpreferredwirelessnetworks "$ifname" | awk 'NR==2 && sub("\t","") { print; exit }'

listpreferredwirelessnetworks lists the saved / preferred networks — not the currently associated one. The first saved entry (NR==2) is then used as the fallback whenever networksetup -getairportnetwork reports "You are not associated with an AirPort network."

As a result, when Wi-Fi is OFF but the machine is online via Ethernet, the host ping succeeds, getairportnetwork correctly reports "not associated", and the module falls back to the first saved network — displaying a stale SSID (e.g. an old phone hotspot) the machine is not actually connected to.

Steps to reproduce (macOS 15+ / 26)

  1. Have at least one saved Wi-Fi network (e.g. a phone hotspot used previously).
  2. Turn Wi-Fi off.
  3. Stay online via Ethernet.
  4. The network module shows the first saved network name instead of Ethernet.

Root cause

networksetup -listpreferredwirelessnetworks != current association. It was introduced in #370 as a workaround for ipconfig getsummary returning <redacted> on Darwin >= 25, but it reflects saved networks, so it yields a name even when Wi-Fi is not connected.

Environment

  • macOS 26.3, tmux 3.6a
  • dracula/tmux @ current master

Suggested fix

Gate the Wi-Fi branch on the interface actually being associated (ifconfig "$ifname" -> status: active) before consulting any SSID source. A not-associated interface then reports Ethernet/Offline instead of a saved name. This leaves the #370 connected-Wi-Fi SSID resolution untouched, so there's no regression risk for users currently on Wi-Fi. PR incoming.

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