Tool/software:
Hello,
We have a use case where after the Ethernet connection is already up and running normally, we modify the IP and MAC addresses by changing parameters. After modifying the MAC address, we found that it didn't take effect and the device became unpingable. We need to know how to properly modify the MAC address.
sys_lock_tcpip_core();
netif_set_down(g_pNetif[0]);
netif_set_ipaddr(g_pNetif[0], &ip4_ipaddr);
netif_set_netmask(g_pNetif[0], &ip4_maskaddr);
netif_set_gw(g_pNetif[0], &ip4_gwaddr);
tempMacAddr[0] = MACADDR0;
tempMacAddr[1] = MACADDR1;
tempMacAddr[2] = MACADDR2;
tempMacAddr[3] = macAddr3;
tempMacAddr[4] = macAddr4;
tempMacAddr[5] = macAddr5;
if(NULL != g_pNetif[0])
{
for(i=0; i<6; i++)
g_pNetif[0]->hwaddr[i] = tempMacAddr[i];
}
netif_set_up(g_pNetif[0]);
sys_unlock_tcpip_core();