From f49def2d3909e8709167ee34610aab181a015452 Mon Sep 17 00:00:00 2001 From: Daniel Steglich Date: Mon, 21 Sep 2015 21:39:20 +0200 Subject: [PATCH] Add network connection: Show current IP address when editing a connection - Added some generic network helper functions to global network helper class to get some information from a device by it's name. This is used when editing a connection (no ip was shown before). - ToDo: This is only a workaround because we want to get the information from the connection but not from the device which belongs to the connection. If multiple connections are setup on the same device, this workaround will not work anymore. --- plinth/modules/networks/networks.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plinth/modules/networks/networks.py b/plinth/modules/networks/networks.py index e6a522528..db224e227 100644 --- a/plinth/modules/networks/networks.py +++ b/plinth/modules/networks/networks.py @@ -204,11 +204,8 @@ def edit(request, uuid): settings_ipv4 = connection.get_setting_ip4_config() form_data['ipv4_method'] = settings_ipv4.get_method() - if settings_ipv4.get_num_addresses(): - # XXX: Plinth crashes here. Possibly because a double free bug - # address = settings_ipv4.get_address(0) - # form_data['ipv4_address'] = address.get_address() - pass + name = connection.get_interface_name() + form_data['ipv4_address'] = network.get_ip_from_device(name) if settings_connection.get_connection_type() == '802-11-wireless': settings_wireless = connection.get_setting_wireless()