Add the missing disconnect() call. In case where the D-Bus
'disconnect' method call is not used to shutdown the connection, we
leak the connection.
For example when the users edits the config file, we end up in the
stop_vpn() function with an active WireGuard connection.
Fixes 12f095a32eff ("vpn: Introduce VPN_FLAG_NO_DAEMON")
Reported by Christian Hewitt
---
vpn/plugins/vpn.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/vpn/plugins/vpn.c b/vpn/plugins/vpn.c
index b1a64b18a1bb..e4d04635654e 100644
--- a/vpn/plugins/vpn.c
+++ b/vpn/plugins/vpn.c
@@ -89,8 +89,10 @@ static int stop_vpn(struct vpn_provider *provider)
vpn_driver_data = g_hash_table_lookup(driver_hash, name);
if (vpn_driver_data && vpn_driver_data->vpn_driver &&
- vpn_driver_data->vpn_driver->flags & VPN_FLAG_NO_TUN)
+ vpn_driver_data->vpn_driver->flags & VPN_FLAG_NO_TUN) {
+ vpn_driver_data->vpn_driver->disconnect(data->provider);
return 0;
+ }
memset(&ifr, 0, sizeof(ifr));
ifr.ifr_flags = data->tun_flags | IFF_NO_PI;
--
2.24.0