windows: the kill switch holds to AmneziaWG tunnels already up when the service starts

From the security review of aa44527: a profile turned on by hand keeps its
tunnel (a Windows service of its own) running across a restart of this
service, but only autostart profiles were wanted on at start: such a
tunnel fell out of the kill switch. Running ones count at start too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 5.5 committed 2026-10-28 00:23:39 +03:00
1 parent aa44527082
commit 29304452f7
1 file changed
+4 -1
+4 -1
View File
@@ -260,8 +260,11 @@ impl Service {
let cfg = self.cfg().clone();
let boot = !self.awg_vpn_started;
self.awg_vpn_started = true;
// At start: the autostart profiles, and any tunnel already up (turned on before this
// service restarted: an update, a crash), are wanted on.
if boot {
self.awg_wanted.extend(crate::awgvpn::profiles(&cfg).into_iter().filter(|v| v.autostart).map(|v| v.iface));
let running = |iface: &str| matches!(crate::awgvpn::state(iface).as_str(), "active" | "activating");
self.awg_wanted.extend(crate::awgvpn::profiles(&cfg).into_iter().filter(|v| v.autostart || running(&v.iface)).map(|v| v.iface));
}
if !cfg!(windows) {
if !crate::awgvpn::profiles(&cfg).is_empty() {