From 135f49a4f952140fb24fb81d9a577c0b1c72dbbc Mon Sep 17 00:00:00 2001 From: Eugeni Dodonov Date: Mon, 1 Jun 2009 15:15:19 +0000 Subject: Preserving wireless network settings (patch by Christian Lohmaier, bug #46010). --- lib/network/connection/ethernet.pm | 4 ++++ lib/network/connection/wireless.pm | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/network/connection/ethernet.pm b/lib/network/connection/ethernet.pm index 986947f..1722da7 100644 --- a/lib/network/connection/ethernet.pm +++ b/lib/network/connection/ethernet.pm @@ -76,7 +76,11 @@ sub load_interface_settings { my ($self) = @_; $self->network::connection::load_interface_settings; + $self->map_ifcfg2config_settings; +} +sub map_ifcfg2config_settings { + my ($self) = @_; $self->{protocol} = $self->{ifcfg}{BOOTPROTO}; $self->{address}{needhostname} = $self->get_ifcfg_bool('NEEDHOSTNAME'); diff --git a/lib/network/connection/wireless.pm b/lib/network/connection/wireless.pm index 0ca26dd..97c9975 100644 --- a/lib/network/connection/wireless.pm +++ b/lib/network/connection/wireless.pm @@ -360,8 +360,15 @@ sub check_device { sub load_interface_settings { my ($self) = @_; - $self->SUPER::load_interface_settings; + $self->network::connection::load_interface_settings; $self->{hide_passwords} = 1; + # override ifcfg with network-specific settings if available + my $network = $self->get_selected_network; + $self->{ifcfg}= $network ? + get_network_ifcfg($network->{ap}) || get_network_ifcfg($network->{essid}) : + $self->{ifcfg}; + + $self->SUPER::map_ifcfg2config_settings; } sub get_networks { @@ -401,11 +408,8 @@ sub get_network_ifcfg { sub guess_network_access_settings { my ($self) = @_; - my $ifcfg; my $network = $self->get_selected_network; - $ifcfg = $network ? - get_network_ifcfg($network->{ap}) || get_network_ifcfg($network->{essid}) : - $self->{ifcfg}; + my $ifcfg = $self->{ifcfg}; $ifcfg ||= {}; $self->{access}{network}{bssid} = $network && $network->{hidden} && $network->{ap}; -- cgit v1.2.1