From 5044be2b4f6bbfd0431c5344cbe16ace9a2f985d Mon Sep 17 00:00:00 2001 From: Eugeni Dodonov Date: Thu, 25 Jun 2009 14:55:09 +0000 Subject: Show what device we are conflicting with for duplicate addresses. --- lib/network/connection/ethernet.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/network/connection/ethernet.pm') diff --git a/lib/network/connection/ethernet.pm b/lib/network/connection/ethernet.pm index c7a76ea..1818826 100644 --- a/lib/network/connection/ethernet.pm +++ b/lib/network/connection/ethernet.pm @@ -185,8 +185,12 @@ sub check_address_settings { return 0; } #- test if IP address is already used - if (find { text2bool($_->{ONBOOT}) && $_->{DEVICE} ne $self->get_interface && $_->{IPADDR} eq $self->{address}{ip_address} } values %{$net->{ifcfg}}) { - $self->{address}{error}{message} = N("%s is already used by connection that starts on boot. 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}); + if (my $conflict = find_index { 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}; + + $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}; return 0; } -- cgit v1.2.1