diff options
author | John Southworth <john.southworth@vyatta.com> | 2011-07-05 16:20:57 -0500 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2011-07-05 16:20:57 -0500 |
commit | 7beacb03c80c24305b5b450dc79783bcbe398780 (patch) | |
tree | d22e398e6177b0047315f52d0fe8385ca80b1a5d | |
parent | 3ace5d0d11c6293a954b7f8cc7ecaf9edfc87405 (diff) | |
download | vyatta-cfg-system-7beacb03c80c24305b5b450dc79783bcbe398780.tar.gz vyatta-cfg-system-7beacb03c80c24305b5b450dc79783bcbe398780.zip |
Move the is_uniq_address function to Interface.pm
-rwxr-xr-x | scripts/vyatta-interfaces.pl | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index f139dcf6..a5bb2553 100755 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -103,31 +103,6 @@ sub is_ip_configured { return ($found > 0); } -sub is_uniq_address { - my $ip = pop(@_); - my @cfgifs = Vyatta::Interface::get_all_cfg_interfaces(); - my $config = new Vyatta::Config; - my %addr_hash = (); - foreach my $intf ( @cfgifs ) { - my $addrs = [ ]; - my $path = "$intf->{'path'}"; - if ($path =~ /openvpn/) { - $addrs = [$config->listNodes("$path local-address")]; - } else { - $addrs = [$config->returnValues("$path address")]; - } - foreach my $addr ( @{$addrs} ){ - if (not exists $addr_hash{$addr}){ - $addr_hash{$addr} = { _intf => [ $intf->{name} ] }; - } else { - $addr_hash{$addr}->{_intf} = - [ @{$addr_hash{$addr}->{_intf}}, $intf->{name} ]; - } - } - } - return ((scalar @{$addr_hash{$ip}->{_intf}}) <= 1); -} - sub is_ipv4 { return index($_[0],':') < 0; } @@ -317,7 +292,7 @@ sub is_valid_addr_commit { next if ($addr eq 'dhcpv6'); if ($addr eq 'dhcp') { $dhcp = 1; - } elsif (!is_uniq_address($addr)) { + } elsif (!Vyatta::Interface::is_uniq_address($addr)) { my $h = Vyatta::Misc::get_ipnet_intf_hash(); print "Error: duplicate address $addr on $h->{$addr}\n"; exit 1; |