mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Use a MAC address based on the SoC's UUID
We use the SoC's UUID to generate a fixed MAC for a particular switch device. The MAC generated uses a Realtek prefix and then is followed by 3 bytes genertaed from the first 3 bytes of the UUID xored with the last byte in order to prevent being able to deduce the UUID from the public MAC.
This commit is contained in:
@@ -132,8 +132,6 @@ static __code const uip_ipaddr_t all_zeroes_addr =
|
||||
{0x0000,0x0000};
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
|
||||
extern __code struct uip_eth_addr uip_ethaddr;
|
||||
|
||||
#ifndef UIP_CONF_EXTERNAL_BUFFER
|
||||
u8_t uip_buf[UIP_BUFSIZE + 2]; /* The packet buffer that contains
|
||||
incoming packets. */
|
||||
|
||||
+5
-5
@@ -306,8 +306,8 @@ uip_arp_arpin(void) __banked
|
||||
BUF_O->opcode = HTONS(2);
|
||||
|
||||
memcpy(BUF_O->dhwaddr.addr, BUF->shwaddr.addr, 6);
|
||||
memcpyc(BUF_O->shwaddr.addr, uip_ethaddr.addr, 6);
|
||||
memcpyc(BUF_O->ethhdr.src.addr, uip_ethaddr.addr, 6);
|
||||
memcpy(BUF_O->shwaddr.addr, uip_ethaddr.addr, 6);
|
||||
memcpy(BUF_O->ethhdr.src.addr, uip_ethaddr.addr, 6);
|
||||
memcpy(BUF_O->ethhdr.dest.addr, BUF->dhwaddr.addr, 6);
|
||||
|
||||
BUF_O->dipaddr[0] = BUF->sipaddr[0];
|
||||
@@ -399,8 +399,8 @@ uip_arp_out(void) __banked
|
||||
|
||||
memset(BUF_O->ethhdr.dest.addr, 0xff, 6);
|
||||
memset(BUF_O->dhwaddr.addr, 0x00, 6);
|
||||
memcpyc(BUF_O->ethhdr.src.addr, uip_ethaddr.addr, 6);
|
||||
memcpyc(BUF_O->shwaddr.addr, uip_ethaddr.addr, 6);
|
||||
memcpy(BUF_O->ethhdr.src.addr, uip_ethaddr.addr, 6);
|
||||
memcpy(BUF_O->shwaddr.addr, uip_ethaddr.addr, 6);
|
||||
|
||||
uip_ipaddr_copy(BUF_O->dipaddr, ipaddr);
|
||||
uip_ipaddr_copy(BUF_O->sipaddr, uip_hostaddr);
|
||||
@@ -420,7 +420,7 @@ uip_arp_out(void) __banked
|
||||
/* Build an ethernet header. */
|
||||
memcpy(IPBUF->ethhdr.dest.addr, tabptr->ethaddr.addr, 6);
|
||||
}
|
||||
memcpyc(IPBUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
|
||||
memcpy(IPBUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
|
||||
|
||||
IPBUF->ethhdr.type = HTONS(UIP_ETHTYPE_IP);
|
||||
|
||||
|
||||
@@ -55,8 +55,6 @@
|
||||
#include "uip.h"
|
||||
#include "../rtl837x_common.h"
|
||||
|
||||
extern __code struct uip_eth_addr uip_ethaddr;
|
||||
|
||||
/**
|
||||
* The Ethernet header.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user