From f2891ee3484870b5d86028c9ddd74b0721033085 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sun, 14 Mar 2021 22:15:48 +0100 Subject: [PATCH] make generates MAC addr compliant with the IEEE standard by setting the Locally Administered bit and clearing the Group Adress bit --- DCCTimer.cpp | 9 ++++++++- EthernetInterface.cpp | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/DCCTimer.cpp b/DCCTimer.cpp index 46cd2ea..622b798 100644 --- a/DCCTimer.cpp +++ b/DCCTimer.cpp @@ -81,6 +81,8 @@ INTERRUPT_CALLBACK interruptHandler=0; void DCCTimer::getSimulatedMacAddress(byte mac[6]) { memcpy(mac,(void *) &SIGROW.SERNUM0,6); // serial number + mac[0] &= 0xFE; + mac[0] |= 0x02; } #else @@ -139,7 +141,12 @@ INTERRUPT_CALLBACK interruptHandler=0; #include void DCCTimer::getSimulatedMacAddress(byte mac[6]) { - for (byte i=0; i<6; i++) mac[i]=boot_signature_byte_get(0x0E + i); + for (byte i=0; i<6; i++) { + mac[i]=boot_signature_byte_get(0x0E + i); + } + mac[0] &= 0xFE; + mac[0] |= 0x02; + } #endif diff --git a/EthernetInterface.cpp b/EthernetInterface.cpp index 38a0b24..6d21d3c 100644 --- a/EthernetInterface.cpp +++ b/EthernetInterface.cpp @@ -54,7 +54,7 @@ EthernetInterface::EthernetInterface() DCCTimer::getSimulatedMacAddress(mac); DIAG(F("\n+++++ Ethernet Setup. Simulatd mac=")); for (byte i=0;i