}
}
+static void set_mac_if_invalid(int i, u8 *mac)
+{
+ u8 oldmac[6];
+
+ if (is_valid_ethaddr(mac) &&
+ !eth_env_get_enetaddr_by_index("eth", i, oldmac))
+ eth_env_set_enetaddr_by_index("eth", i, mac);
+}
+
int misc_init_r(void)
{
int err;
mac[4] = mac1[2];
mac[5] = mac1[3];
- if (is_valid_ethaddr(mac))
- eth_env_set_enetaddr("eth1addr", mac);
-
+ set_mac_if_invalid(1, mac);
increment_mac(mac);
-
- if (is_valid_ethaddr(mac))
- eth_env_set_enetaddr("eth2addr", mac);
-
+ set_mac_if_invalid(2, mac);
increment_mac(mac);
-
- if (is_valid_ethaddr(mac))
- eth_env_set_enetaddr("ethaddr", mac);
+ set_mac_if_invalid(0, mac);
out:
return 0;