mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
feat(cli): add mac command to set the management MAC from the config
Add a `mac <aa:bb:cc:dd:ee:ff>` console command (and a bare `mac` to show the current address) that overrides the management MAC at runtime. The address is validated (unicast, globally administered, non-zero OUI) and the static L2 management entry is re-registered so the change applies without a reboot. Because it is a normal command, a line in the startup config persists it across boots: execute_config() runs it before the final static L2 entry and the derived hostname are set up. Also point the keepLink KP-9000-9XHML-X V3.1 machine definition at the factory MAC area (0x1FC000, same location other machines use) so a valid factory MAC is picked up at boot instead of falling back to a locally administered address. The MAC parsing/printing lives in parse_mac()/print_mac() helpers next to parse_ip()/print_ip() so future commands can reuse them, and a memcmp() helper joins the project's own memcpy()/memset() (no libc is linked).
This commit is contained in:
1 parent
6488433584
commit
6616a0c9ce
4 files changed
+109
No files matched your search
@@ -359,6 +359,19 @@ void memcpy(__xdata void * __xdata dst, __xdata const void * __xdata src, uint16
|
||||
*d++ = *s++;
|
||||
}
|
||||
|
||||
int memcmp(__xdata const void *a, __xdata const void *b, uint16_t len)
|
||||
{
|
||||
__xdata const uint8_t *x = a;
|
||||
__xdata const uint8_t *y = b;
|
||||
while (len--) {
|
||||
if (*x != *y)
|
||||
return *x - *y;
|
||||
x++;
|
||||
y++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void memcpyc(__xdata uint8_t *dst, __code uint8_t *src, uint16_t len)
|
||||
{
|
||||
while (len--)
|
||||
|
||||
Reference in new issue
Block a user