From f790ecbc1151161be94f83f2a30258ff32ecfef9 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 29 Nov 2010 16:53:42 -0800 Subject: Fix interface scanning on boot - allow more mac addresses The code to match on locally assigned bit had a bad regex. Use conversion to hex and mask instead. Also don't allow multicast address bit. --- scripts/system/vyatta_interface_rescan | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/system/vyatta_interface_rescan b/scripts/system/vyatta_interface_rescan index bdc8fd67..a33f8ee9 100755 --- a/scripts/system/vyatta_interface_rescan +++ b/scripts/system/vyatta_interface_rescan @@ -45,11 +45,15 @@ my %whitelist = ( sub persistent_address { my $mac = shift; - # is local assignment bit (IEEE802) not set? - return 1 unless ($mac =~ /^.[2367abef]:/); + return if ($mac eq '00:00:00:00:00:00'); # zero address is reserved - # is address bogus? - return if ($mac eq '00:00:00:00:00:00'); + # get first octet + return unless ($mac =~ /^([0-9a-f][0-9a-f]):/); + my $oct0 = hex($1); + + return if ($oct0 & 0x1); # skip it is a multicast address + + return 1 unless ($oct0 & 0x2); # this is good, not locally assigned # unless it is in whitelist, it is non persistent $mac =~ /^([0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f])/; -- cgit v1.2.3