Skip to content

Commit c9cfdeb

Browse files
committed
ethernet: fix MACAddress(uint8_t *mac)
1 parent aae3937 commit c9cfdeb

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

libraries/Ethernet/src/Ethernet.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ void EthernetClass::setMACAddress(const uint8_t *mac_address) {
8181
}
8282
}
8383

84-
void EthernetClass::MACAddress(uint8_t *mac_address) {
85-
setMACAddress(mac_address);
86-
}
87-
8884
IPAddress EthernetClass::localIP() {
8985
return NetworkInterface::localIP();
9086
}

libraries/Ethernet/src/Ethernet.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ class EthernetClass : public NetworkInterface {
5757
int disconnect(void);
5858
void end(void);
5959

60-
void MACAddress(uint8_t *mac_address);
6160
IPAddress localIP();
6261
IPAddress subnetMask();
6362
IPAddress gatewayIP();

libraries/SocketWrapper/SocketHelpers.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ void NetworkInterface::enable_dhcpv4_server(struct net_if *netif, char *_netmask
9292
LOG_INF("DHCPv4 server started...\n");
9393
}
9494

95+
void NetworkInterface::MACAddress(uint8_t *mac) {
96+
if (netif == NULL || netif->if_dev == NULL || mac == NULL) {
97+
return;
98+
}
99+
memcpy(mac, netif->if_dev->link_addr.addr, netif->if_dev->link_addr.len);
100+
}
101+
95102
IPAddress NetworkInterface::localIP() {
96103
return IPAddress(netif->config.ip.ipv4->unicast[0].ipv4.address.in_addr.s_addr);
97104
}

libraries/SocketWrapper/SocketHelpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ class NetworkInterface {
4343
~NetworkInterface() {
4444
}
4545

46+
void MACAddress(uint8_t *mac);
4647
IPAddress localIP();
47-
4848
IPAddress subnetMask();
4949
IPAddress gatewayIP();
5050
IPAddress dnsServerIP();

0 commit comments

Comments
 (0)