diff --git a/rust/headless-client/src/ipc_service.rs b/rust/headless-client/src/ipc_service.rs
index 77933e7ad..8fe27afdc 100644
--- a/rust/headless-client/src/ipc_service.rs
+++ b/rust/headless-client/src/ipc_service.rs
@@ -375,14 +375,20 @@ impl<'a> Handler<'a> {
ConnlibMsg::OnDisconnect {
error_msg,
is_authentication_error,
- } => self
- .ipc_tx
- .send(&ServerMsg::OnDisconnect {
- error_msg,
- is_authentication_error,
- })
- .await
- .context("Error while sending IPC message `OnDisconnect`")?,
+ } => {
+ if let Some(session) = self.session.take() {
+ // Identical to dropping, but looks nicer
+ session.connlib.disconnect();
+ }
+ self.dns_controller.deactivate()?;
+ self.ipc_tx
+ .send(&ServerMsg::OnDisconnect {
+ error_msg,
+ is_authentication_error,
+ })
+ .await
+ .context("Error while sending IPC message `OnDisconnect`")?
+ }
ConnlibMsg::OnSetInterfaceConfig { ipv4, ipv6, dns } => {
self.tun_device.set_ips(ipv4, ipv6).await?;
self.dns_controller.set_dns(dns).await?;
diff --git a/website/src/components/Changelog/GUI.tsx b/website/src/components/Changelog/GUI.tsx
index 972cfcf04..f89d75f42 100644
--- a/website/src/components/Changelog/GUI.tsx
+++ b/website/src/components/Changelog/GUI.tsx
@@ -19,6 +19,9 @@ export default function GUI({ title }: { title: string }) {
Fixes a bug where the Linux Clients didn't work on ZFS filesystems
+
+ Fixes a bug where auto-sign-in with an expired token would cause a "Couldn't send Disconnect" error message.
+