summaryrefslogtreecommitdiffstats
path: root/lib/network/connection/ethernet.pm
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni@mandriva.org>2009-07-11 01:49:19 +0000
committerEugeni Dodonov <eugeni@mandriva.org>2009-07-11 01:49:19 +0000
commitf22e9bd58a02e19f27ef6f07c42f12bc383b0c68 (patch)
tree1f2d9f65004f7d9e5fcf750738f61b913b178a01 /lib/network/connection/ethernet.pm
parent38b8816cf113c34d83a277eaad261b0bc9ec45c4 (diff)
downloaddrakx-net-f22e9bd58a02e19f27ef6f07c42f12bc383b0c68.tar
drakx-net-f22e9bd58a02e19f27ef6f07c42f12bc383b0c68.tar.gz
drakx-net-f22e9bd58a02e19f27ef6f07c42f12bc383b0c68.tar.bz2
drakx-net-f22e9bd58a02e19f27ef6f07c42f12bc383b0c68.tar.xz
drakx-net-f22e9bd58a02e19f27ef6f07c42f12bc383b0c68.zip
Simplify duplicated IP check and prevent crashing if not found.
Diffstat (limited to 'lib/network/connection/ethernet.pm')
-rw-r--r--lib/network/connection/ethernet.pm5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/network/connection/ethernet.pm b/lib/network/connection/ethernet.pm
index 1818826..6d4d25b 100644
--- a/lib/network/connection/ethernet.pm
+++ b/lib/network/connection/ethernet.pm
@@ -185,10 +185,9 @@ sub check_address_settings {
return 0;
}
#- test if IP address is already used
- if (my $conflict = find_index { text2bool($_->{ONBOOT}) && $_->{DEVICE} ne $self->get_interface && $_->{IPADDR} eq $self->{address}{ip_address} } values %{$net->{ifcfg}} ) {
+ if (my $conflict = find { text2bool($_->{ONBOOT}) && $_->{DEVICE} ne $self->get_interface && $_->{IPADDR} eq $self->{address}{ip_address} } values %{$net->{ifcfg}} ) {
# find out what connection we are conflicting with
- my @conflicting_conn = values %{$net->{ifcfg}};
- my $conflict_device = @conflicting_conn[$conflict]->{DEVICE};
+ my $conflict_device = $conflict->{DEVICE};
$self->{address}{error}{message} = N("%s is already used by connection that starts on boot (%s). To use this address with this connection, first disable all other devices which use it, or configure them not to start on boot", $self->{address}{ip_address}, $conflict_device);
$self->{address}{error}{field} = \$self->{address}{ip_address};