We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c9cfdeb commit 7a10967Copy full SHA for 7a10967
libraries/SocketWrapper/SocketHelpers.cpp
@@ -116,10 +116,17 @@ IPAddress NetworkInterface::dnsServerIP() {
116
}
117
118
void NetworkInterface::setMACAddress(const uint8_t *mac) {
119
- struct net_eth_addr new_mac;
120
struct ethernet_req_params params = {0};
121
122
- memcpy(¶ms.mac_address, &new_mac, sizeof(struct net_eth_addr));
+ if (mac == nullptr) {
+ LOG_ERR("MAC address pointer is null");
123
+ return;
124
+ }
125
+ memcpy(¶ms.mac_address, mac, sizeof(struct net_eth_addr));
126
+ if (!net_eth_is_addr_valid(¶ms.mac_address)) {
127
+ LOG_ERR("Invalid MAC address");
128
129
130
131
net_if_down(netif); // Ensure the interface is down before changing the MAC address
132
0 commit comments