From fc9fbf2abb37e65a2cf07b3d2b07550ee53aee9d Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Mon, 26 Jan 2009 14:55:09 +0000 Subject: [ar71xx] move random MAC address generation into the platform initialization code git-svn-id: svn://svn.openwrt.org/openwrt/trunk@14204 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/files/arch/mips/ar71xx/platform.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'target/linux/ar71xx/files/arch/mips') diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/platform.c b/target/linux/ar71xx/files/arch/mips/ar71xx/platform.c index ef70867a2b..a01aecbd99 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/platform.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/platform.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -456,8 +457,15 @@ void __init ar71xx_add_device_eth(unsigned int id) break; } - memcpy(pdata->mac_addr, ar71xx_mac_base, ETH_ALEN); - pdata->mac_addr[5] += ar71xx_eth_instance; + if (is_valid_ether_addr(ar71xx_mac_base)) { + memcpy(pdata->mac_addr, ar71xx_mac_base, ETH_ALEN); + pdata->mac_addr[5] += ar71xx_eth_instance; + } else { + random_ether_addr(pdata->mac_addr); + printk(KERN_DEBUG + "ar71xx: using random MAC address for eth%d\n", + ar71xx_eth_instance); + } platform_device_register(pdev); ar71xx_eth_instance++; -- cgit v1.2.3