diff --git a/src/vpn_manager_globalprotect/vpnc.py b/src/vpn_manager_globalprotect/vpnc.py index 82866e4..d2c2c77 100644 --- a/src/vpn_manager_globalprotect/vpnc.py +++ b/src/vpn_manager_globalprotect/vpnc.py @@ -279,9 +279,11 @@ async def configure_with_networkd(): else: filename = f"10-{config.tun_device}.network" + path = Path("/run/systemd/network") / filename + if config.reason in {Reason.CONNECT, Reason.ATTEMPT_RECONNECT, Reason.RECONNECT}: # only write out the file if the reason indicates a new connection. - config.write_config(Path("/run/systemd/network") / filename) + config.write_config(path) elif config.reason == Reason.PRE_INIT: # idk what this does, but the script does it, so we will too. try: @@ -296,7 +298,7 @@ async def configure_with_networkd(): os.close(fd) return elif config.reason == Reason.DISCONNECT: - config.destroy_config() + config.destroy_config(path) # always reload networkd state unless it's the config. bus = bus_var.get() intro = await bus.introspect(