From a82b23badec73f6da6cff5337b5ebf18856b39b6 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 29 Nov 2010 16:04:40 -0800 Subject: Fix use of undefined in comparison The test for mixing dhcp and static ipv4 could cause perl warning from comparing undefined with numeric. --- scripts/vyatta-interfaces.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts/vyatta-interfaces.pl') 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); -- cgit v1.2.3