mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 05:52:36 +02:00
util/nvmutil: tidy up set_mac_nib
Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -408,13 +408,13 @@ set_mac_nib(int mac_pos, int nib)
|
||||
mac[mac_pos + nib]);
|
||||
|
||||
/* If random, ensure that local/unicast bits are set */
|
||||
if (byte == 0 && nib == 1) {
|
||||
if ((mac[mac_pos + nib] == '?') ||
|
||||
(mac[mac_pos + nib] == 'x') ||
|
||||
(mac[mac_pos + nib] == 'X')) /* random */
|
||||
h = (h & 0xE) | 2; /* local, unicast */
|
||||
}
|
||||
if (byte == 0 && nib == 1 &&
|
||||
(mac[mac_pos + nib] == '?') ||
|
||||
(mac[mac_pos + nib] == 'x') ||
|
||||
(mac[mac_pos + nib] == 'X')) /* random */
|
||||
h = (h & 0xE) | 2; /* local, unicast */
|
||||
|
||||
/* Store the new nibble as part of the new MAC address */
|
||||
macbuf[byte >> 1] |= (uint16_t)h <<
|
||||
(((byte & 1) << 3) + (4 * (nib ^ 1)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user