move 'randomize MAC' setting to firmware settings, and add setting for changing the MAC.

make things overall betterer.
This commit is contained in:
Arisotura
2021-11-19 13:31:14 +01:00
parent 1fc775d964
commit 1472a0ec4b
11 changed files with 335 additions and 129 deletions

View File

@ -201,6 +201,43 @@ std::string GetConfigString(ConfigEntry entry)
return "";
}
bool GetConfigArray(ConfigEntry entry, void* data)
{
switch (entry)
{
case Firm_MAC:
{
char* mac_in = Config::FirmwareMAC;
u8* mac_out = (u8*)data;
int o = 0;
u8 tmp = 0;
for (int i = 0; i < 18; i++)
{
char c = mac_in[i];
if (c == '\0') break;
int n;
if (c >= '0' && c <= '9') n = c - '0';
else if (c >= 'a' && c <= 'f') n = c - 'a' + 10;
else if (c >= 'A' && c <= 'F') n = c - 'A' + 10;
else continue;
if (!(o & 1))
tmp = n;
else
mac_out[o >> 1] = n | (tmp << 4);
o++;
if (o >= 12) return true;
}
}
return false;
}
return false;
}
FILE* OpenFile(std::string path, std::string mode, bool mustexist)
{