diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-08-09 16:29:03 -0300 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-08-14 08:41:17 -0300 |
| commit | 93aea8ea55d2cd36cfa8c9dff12056f01201107c (patch) | |
| tree | c4d217177eef3b2446ae0ad857a4c9a7498961d0 | |
| parent | d141d63df0ccfbbf1cd24d2b1748b51d83649ba0 (diff) | |
| download | mullvadvpn-93aea8ea55d2cd36cfa8c9dff12056f01201107c.tar.xz mullvadvpn-93aea8ea55d2cd36cfa8c9dff12056f01201107c.zip | |
Restart tunnel when IPv6 enabled setting changes
| -rw-r--r-- | mullvad-daemon/src/main.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs index e9a02a77f3..9c87bdef74 100644 --- a/mullvad-daemon/src/main.rs +++ b/mullvad-daemon/src/main.rs @@ -586,10 +586,22 @@ impl Daemon { enable_ipv6: bool, ) -> Result<()> { let save_result = self.settings.set_openvpn_enable_ipv6(enable_ipv6); + match save_result.chain_err(|| "Unable to save settings") { - Ok(_) => Self::oneshot_send(tx, (), "set_openvpn_enable_ipv6 response"), + Ok(settings_changed) => { + Self::oneshot_send(tx, (), "set_openvpn_enable_ipv6 response"); + + let tunnel_needs_restart = + self.state == TunnelState::Connecting || self.state == TunnelState::Connected; + + if settings_changed && tunnel_needs_restart { + info!("Initiating tunnel restart because the enable IPv6 setting changed"); + self.kill_tunnel()?; + } + } Err(e) => error!("{}", e.display_chain()), }; + Ok(()) } |
