summaryrefslogtreecommitdiff
path: root/scripts/vyatta-interfaces.pl
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-11-29 16:04:40 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-11-29 16:04:40 -0800
commita82b23badec73f6da6cff5337b5ebf18856b39b6 (patch)
treea3f7bf5e39abcef6bc1f6c597b92ce1a4cf862cf /scripts/vyatta-interfaces.pl
parent051a4f5cc9b9f9f89d45a78724457973bbcb59e3 (diff)
downloadvyatta-cfg-system-a82b23badec73f6da6cff5337b5ebf18856b39b6.tar.gz
vyatta-cfg-system-a82b23badec73f6da6cff5337b5ebf18856b39b6.zip
Fix use of undefined in comparison
The test for mixing dhcp and static ipv4 could cause perl warning from comparing undefined with numeric.
Diffstat (limited to 'scripts/vyatta-interfaces.pl')
-rwxr-xr-xscripts/vyatta-interfaces.pl3
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index a7384eea..5a17be04 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -466,7 +466,8 @@ sub is_valid_addr_commit {
if (defined($bond));
my $dhcp = grep { /^dhcp$/ } @addrs;
- my $static_v4 = grep { is_ip_v4_or_v6($_) == 4 } @addrs;
+ my $static_v4 = grep { my $v = is_ip_v4_or_v6($_);
+ defined($v) && $v == 4 } @addrs;
die "Can't configure static IPv4 address and DHCP on the same interface.\n"
if ($static_v4 && $dhcp);