set-mac-addresses: Prevent setting of DVT MACs
DVT boards are special in that their MAC addresses were allocated in large
blocks rather than strided fashion like how we did for PVT units.
For now, this blocks setting the MAC for these boards.
Change-Id: Ibba1afcf7787907f038d82d1dc546a2f697eb370
diff --git a/etc/runonce.d/10-set-mac-addresses b/etc/runonce.d/10-set-mac-addresses
index 893ebd4..a48e9ef 100755
--- a/etc/runonce.d/10-set-mac-addresses
+++ b/etc/runonce.d/10-set-mac-addresses
@@ -134,6 +134,18 @@
print('Error writing bluetooth configuration to %s: %s' % (BD_ADDR_PATH, e))
+def IsDVTMacAddress(base_mac_address):
+ '''Checks to see if the given MAC address is within the allocated DVT range.'''
+ dvt_mac_start = MacDeviceSuffixToNumber('51:F7:6E')
+ dvt_mac_end = MacDeviceSuffixToNumber('51:FA:1B')
+ mac_suffix = MacDeviceSuffixToNumber(GetMacDeviceSuffixString(base_mac_address))
+
+ if mac_suffix >= dvt_mac_start and mac_suffix <= dvt_mac_end:
+ return True
+
+ return False
+
+
def Main():
base_mac_address = FindEthernetMacString(ETHERNET_DEVICE)
@@ -141,6 +153,11 @@
sys.stderr.write('Unable to find MAC address for device %s\n' % (ETHERNET_DEVICE))
sys.exit(1)
+ if IsDVTMacAddress(base_mac_address):
+ sys.stderr.write('Detected DVT MAC address for device %s\n' % (ETHERNET_DEVICE))
+ sys.stderr.write('Cowardly refusing to set the MAC addresses\n')
+ sys.exit(0)
+
next_mac = GenerateNextMac(base_mac_address)
print('Wifi/Bt MAC address will be %s' % next_mac)