[GH-ISSUE #3323] KillSwitch deadlocks network and client on suspend/resume on Linux #3192

Open
opened 2026-10-26 04:13:30 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @yar101 on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amnezia-client/issues/3323

Bug Report: KillSwitch deadlocks network and client on suspend/resume on Linux

Environment:

• OS: Linux (Debian 13, kernel 6.12, Wayland/Sway / any DE)
• Amnezia version: 4.x / latest
• Protocol: AmneziaWG (AWG) with KillSwitch enabled

Steps to reproduce:

  1. Connect to any server using AmneziaWG with KillSwitch (route all traffic) enabled.
  2. Put laptop to sleep (suspend / close lid) for ~15 seconds.
  3. Wake up the laptop (open lid).

Actual behavior:

  1. Wi-Fi reconnects to the local network, but there is zero internet access on the
    entire system.
  2. Amnezia GUI enters an infinite loop: "Reconnecting..." (Переподключение...).
  3. Killing the GUI process (pkill -9 AmneziaVPN) immediately clears the KillSwitch
    and restores network connectivity.

Root cause analysis from logs:

  1. In AmneziaVPN-service, LinuxNetworkWatcherWorker detects NM interface property
    changes on wake, but completely ignores the link drop because the AP didn't change:
    [DEBUG] AmneziaVPN LinuxNetworkWatcherWorker : Properties changed for interface org.freedesktop.NetworkManager.Device.Wireless
    [DEBUG] AmneziaVPN LinuxNetworkWatcherWorker : Access point did not changed. Ignoring the changes

  2. The GUI client attempts to activate the VPN tunnel immediately upon resume before
    DHCP lease / default gateway on Wi-Fi is ready (which takes 3–5 seconds).

  3. The daemon inserts KillSwitch iptables rules (amnvpn.100.blockAll, amnvpn.310.blockDNS), but the handshake packets to the VPN endpoint fail because there is no
    route yet.

  4. The client's Qt state machine gets stuck in a handshake wait loop (polling every
    250ms), while the KillSwitch blocks all traffic and DNS on the machine.

Suggested fix:

  1. Implement support for org.freedesktop.login1.Manager.PrepareForSleep (systemd
    inhibitor lock) to cleanly suspend/pause the tunnel before sleep.
  2. On resume, wait for default route / network gateway availability before re-
    engaging KillSwitch and handshake attempts.
  3. Add a timeout / reset logic in the GUI client to avoid unrecoverable
    "Reconnecting..." state.
Originally created by @yar101 on GitHub (Oct 25, 2026). Original GitHub issue: https://github.com/amnezia-vpn/amnezia-client/issues/3323 ### Bug Report: KillSwitch deadlocks network and client on suspend/resume on Linux Environment: • OS: Linux (Debian 13, kernel 6.12, Wayland/Sway / any DE) • Amnezia version: 4.x / latest • Protocol: AmneziaWG (AWG) with KillSwitch enabled Steps to reproduce: 1. Connect to any server using AmneziaWG with KillSwitch (route all traffic) enabled. 2. Put laptop to sleep (suspend / close lid) for ~15 seconds. 3. Wake up the laptop (open lid). Actual behavior: 1. Wi-Fi reconnects to the local network, but there is zero internet access on the entire system. 2. Amnezia GUI enters an infinite loop: "Reconnecting..." (Переподключение...). 3. Killing the GUI process (pkill -9 AmneziaVPN) immediately clears the KillSwitch and restores network connectivity. Root cause analysis from logs: 1. In AmneziaVPN-service, LinuxNetworkWatcherWorker detects NM interface property changes on wake, but completely ignores the link drop because the AP didn't change: [DEBUG] AmneziaVPN LinuxNetworkWatcherWorker : Properties changed for interface org.freedesktop.NetworkManager.Device.Wireless [DEBUG] AmneziaVPN LinuxNetworkWatcherWorker : Access point did not changed. Ignoring the changes 2. The GUI client attempts to activate the VPN tunnel immediately upon resume before DHCP lease / default gateway on Wi-Fi is ready (which takes 3–5 seconds). 3. The daemon inserts KillSwitch iptables rules (amnvpn.100.blockAll, amnvpn.310.blockDNS), but the handshake packets to the VPN endpoint fail because there is no route yet. 4. The client's Qt state machine gets stuck in a handshake wait loop (polling every 250ms), while the KillSwitch blocks all traffic and DNS on the machine. Suggested fix: 1. Implement support for org.freedesktop.login1.Manager.PrepareForSleep (systemd inhibitor lock) to cleanly suspend/pause the tunnel before sleep. 2. On resume, wait for default route / network gateway availability before re- engaging KillSwitch and handshake attempts. 3. Add a timeout / reset logic in the GUI client to avoid unrecoverable "Reconnecting..." state.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#3192
No description provided.