From 8528e99ba95c33aeffd8285162fa009b5aa4f240 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 9 May 2011 09:35:34 -0700 Subject: Convert mac octets from hex Bug 7063 Need to convert MAC octets from hex to numeric before doing math operations. --- scripts/vyatta-interfaces.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index 30b35c05..26f2791a 100755 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -255,10 +255,10 @@ sub is_valid_mac { ($#octets == 5) or die "Error: wrong number of octets: $#octets\n"; - (($octets[0] & 1) == 0) or die "Error: $mac is a multicast address\n"; + ((hex($octets[0]) & 1) == 0) or die "Error: $mac is a multicast address\n"; my $sum = 0; - $sum += strtoul('0x' . $_) foreach @octets; + $sum += hex( $_) foreach @octets; ( $sum != 0 ) or die "Error: zero is not a valid address\n"; exit 0; -- cgit v1.2.3