util/nvmutil: one more comment

fsdg20230625
Leah Rowe 2023-04-06 19:41:53 +01:00
parent d3ad50dcb4
commit 9372ae3ddc
1 changed files with 2 additions and 1 deletions

View File

@ -225,9 +225,10 @@ parseMacAddress(const char *strMac, uint16_t *mac)
for (int nib = 0; nib < 2; nib++, total += h) { for (int nib = 0; nib < 2; nib++, total += h) {
if ((h = hextonum(strMac[i + nib])) > 15) if ((h = hextonum(strMac[i + nib])) > 15)
return -1; return -1;
/* ensure local, unicast mac address if random: */
if ((byte == 0) && (nib == 1)) if ((byte == 0) && (nib == 1))
if (strMac[i + nib] == '?') if (strMac[i + nib] == '?')
h = (h & 0xE) | 2; h = (h & 0xE) | 2; /* local, unicast */
mac[byte >> 1] |= ((uint16_t ) h) mac[byte >> 1] |= ((uint16_t ) h)
<< ((8 * ((byte % 2) ^ 1)) + (4 * (nib ^ 1))); << ((8 * ((byte % 2) ^ 1)) + (4 * (nib ^ 1)));
} }