void __netconfig_set_ether_macaddr()
{
-
DBG("Set wired Mac address ");
char *mac_addr = NULL;
+ char rand_addr[WLAN_MAC_ADDR_MAX];
int rv = -1;
mac_addr = vconf_get_str(VCONF_ETH_MAC_ADDRESS);
/*Generate the Random Mac address*/
unsigned char rand_mac_add[ETH_MAC_ADDR_SIZE+1];
- if (__netconfig_get_random_mac(rand_mac_add, ETH_MAC_ADDR_SIZE == -1)) {
+ if (__netconfig_get_random_mac(rand_mac_add, ETH_MAC_ADDR_SIZE) == -1) {
ERR("Could not generate the Random Mac address");
g_free(mac_addr);
rand_mac_add[0] |= 0x02; /*set local assignment bit*/
/*Set the Mac address in Vconf*/
- snprintf(mac_addr, WLAN_MAC_ADDR_MAX, "%x:%x:%x:%x:%x:%x",
+ snprintf(rand_addr, WLAN_MAC_ADDR_MAX, "%x:%x:%x:%x:%x:%x",
rand_mac_add[0], rand_mac_add[1],
rand_mac_add[2], rand_mac_add[3],
rand_mac_add[4], rand_mac_add[5]);
- netconfig_set_vconf_str(VCONF_ETH_MAC_ADDRESS, mac_addr);
+ netconfig_set_vconf_str(VCONF_ETH_MAC_ADDRESS, rand_addr);
}
- DBG("MAC Address of eth0 [%s]", mac_addr);
+ DBG("MAC Address of eth0 [%s]", rand_addr);
const char *path = NET_EXEC_PATH;
char *const args[] = { "/sbin/ifconfig", "eth0", "hw",
- "ether", mac_addr, "up", NULL};
+ "ether", rand_addr, "up", NULL};
char *const envs[] = { NULL };
rv = netconfig_execute_file(path, args, envs);