summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2011-05-09 09:35:34 -0700
committerStephen Hemminger <shemminger@vyatta.com>2011-05-09 09:35:34 -0700
commit8528e99ba95c33aeffd8285162fa009b5aa4f240 (patch)
treef3e1b3be67cc9cf241ca4eb349b8b52de19a2f21
parentbdba1ac96e48e5d3b4cfa0b31ebafa1f8255787f (diff)
downloadvyatta-cfg-system-8528e99ba95c33aeffd8285162fa009b5aa4f240.tar.gz
vyatta-cfg-system-8528e99ba95c33aeffd8285162fa009b5aa4f240.zip
Convert mac octets from hex
Bug 7063 Need to convert MAC octets from hex to numeric before doing math operations.
-rwxr-xr-xscripts/vyatta-interfaces.pl4
1 files changed, 2 insertions, 2 deletions
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;