From ff412c2af1f4b68ddf77b6d0f9365eb1f1f841cc Mon Sep 17 00:00:00 2001 From: Daniel Steglich Date: Sat, 28 Nov 2015 14:15:05 +0000 Subject: [PATCH] network: Fix changing addressing method (GH #307) When changing the addressing method from manual to automatic, the IP addresses where removed from connection object without removing the Gateway property. This causes a networkmanager error. Create new SettingIP4Config object to avoid the need to reset all propertys when changing methods --- plinth/network.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/plinth/network.py b/plinth/network.py index a8d8fde3c..68979b10a 100644 --- a/plinth/network.py +++ b/plinth/network.py @@ -293,10 +293,8 @@ def _update_common_settings(connection, connection_uuid, name, type_, def _update_ipv4_settings(connection, ipv4_method, ipv4_address): """Edit IPv4 settings for network manager connections.""" - settings = connection.get_setting_ip4_config() - if not settings: - settings = nm.SettingIP4Config.new() - connection.add_setting(settings) + settings = nm.SettingIP4Config.new() + connection.add_setting(settings) settings.set_property(nm.SETTING_IP_CONFIG_METHOD, ipv4_method) if ipv4_method == nm.SETTING_IP4_CONFIG_METHOD_MANUAL and ipv4_address: @@ -307,8 +305,6 @@ def _update_ipv4_settings(connection, ipv4_method, ipv4_address): settings.add_address(address) settings.set_property(nm.SETTING_IP_CONFIG_GATEWAY, '0.0.0.0') - else: - settings.clear_addresses() def _update_ethernet_settings(connection, connection_uuid, name, interface,