diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-04-24 11:36:53 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-04-24 11:36:53 -0700 |
commit | 00795af8682d03f44e8c2e152beb87ec04e96e39 (patch) | |
tree | 0026290fa8d797152ebc927fb465cb8452c04a5a | |
parent | cd7b67d5e03a719bd993d7dc5fa90264f06aa30d (diff) | |
parent | 8c0697b5b5c1c666f84622f632936c96b78d0efe (diff) | |
download | vyatta-cfg-00795af8682d03f44e8c2e152beb87ec04e96e39.tar.gz vyatta-cfg-00795af8682d03f44e8c2e152beb87ec04e96e39.zip |
Merge branch 'jenner' of 192.168.100.1:git/vyatta-cfg into jenner
-rwxr-xr-x | scripts/vyatta-interfaces.pl | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index 8fc5226..997230d 100755 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -85,12 +85,8 @@ exit 0; sub is_ip_configured { my ($intf, $ip) = @_; - my $wc = `ip addr show $intf | grep -c $ip`; - if (defined $wc and $wc > 0) { - return 1; - } else { - return 0; - } + my @found = grep $ip, getIP($intf); + return ($#found > 0); } sub is_ip_duplicate { @@ -103,17 +99,12 @@ sub is_ip_duplicate { chomp @ipaddrs; my %ipaddrs_hash = map { $_ => 1 } @ipaddrs; - if (defined $ipaddrs_hash{$ip}) { - # - # allow dup if it's the same interface - # - if (is_ip_configured($intf, $ip)) { - return 0; - } - return 1; - } else { - return 0; - } + return unless($ipaddrs_hash{$ip}); + + # + # allow dup if it's the same interface + # + return is_ip_configured($intf, $ip); } sub touch { |