diff --git a/eduvpn/connection.py b/eduvpn/connection.py index 292c2a05..f473abbf 100644 --- a/eduvpn/connection.py +++ b/eduvpn/connection.py @@ -80,6 +80,5 @@ def parse(cls, config_str, _) -> "WireGuardConnection": def connect(self, manager, default_gateway, dns_search_domains, callback): manager.start_wireguard_connection( self.config, - default_gateway, callback=callback, ) diff --git a/eduvpn/nm.py b/eduvpn/nm.py index e6213dfa..1a523510 100644 --- a/eduvpn/nm.py +++ b/eduvpn/nm.py @@ -396,7 +396,7 @@ def set_connection( self, new_connection: "NM.SimpleConnection", callback: Callable, - default_gateway: bool, + default_gateway: Optional[bool], dns_search_domains: List[str]=[], ): new_connection = self.set_setting_ip_config( @@ -411,14 +411,15 @@ def set_connection( self.add_connection(new_connection, callback) def set_setting_ip_config( - self, con: "NM.SimpleConnection", default_gateway: bool, dns_search_domains: List[str]=[] + self, con: "NM.SimpleConnection", default_gateway: Optional[bool], dns_search_domains: List[str]=[] ) -> "NM.SimpleConnection": "Set IP config settings like default gateway and search domains." _logger.debug(f"setting ip config, default gateway: {default_gateway}, dns_search_domains: {dns_search_domains}") ipv4_setting = con.get_setting_ip4_config() ipv6_setting = con.get_setting_ip6_config() - ipv4_setting.set_property("never-default", not default_gateway) - ipv6_setting.set_property("never-default", not default_gateway) + if default_gateway is not None: + ipv4_setting.set_property("never-default", not default_gateway) + ipv6_setting.set_property("never-default", not default_gateway) if dns_search_domains: ipv4_setting.set_property("dns-search", dns_search_domains) ipv6_setting.set_property("dns-search", dns_search_domains) @@ -444,7 +445,6 @@ def start_openvpn_connection( def start_wireguard_connection( # noqa: C901 self, config: ConfigParser, - default_gateway, *, callback=None, ) -> None: @@ -583,7 +583,7 @@ def start_wireguard_connection( # noqa: C901 profile.add_setting(s_con) profile.add_setting(w_con) - self.set_connection(profile, callback, default_gateway) # type: ignore + self.set_connection(profile, callback, None) # type: ignore @run_in_glib_thread def activate_connection(self, callback: Optional[Callable] = None) -> None: