aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/Kconfig9
-rw-r--r--net/eth-uclass.c2
-rw-r--r--net/eth_legacy.c2
3 files changed, 9 insertions, 4 deletions
diff --git a/net/Kconfig b/net/Kconfig
index 7a2d145..cabe93c 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -27,10 +27,11 @@ config BOOTP_SEND_HOSTNAME
config NET_RANDOM_ETHADDR
bool "Random ethaddr if unset"
help
- Selecting this will allow the Ethernet interface to function
- even when the ethaddr variable for that interface is unset.
- A new MAC address will be generated on every boot and it will
- not be added to the environment.
+ Selecting this will allow the Ethernet interface to function even
+ when the ethaddr variable for that interface is unset. In this case,
+ a random MAC address in the locally administered address space is
+ generated. It will be saved to the appropriate environment variable,
+ too.
config NETCONSOLE
bool "NetConsole support"
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index 0da0e85..58c308f 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -583,6 +583,8 @@ static int eth_post_probe(struct udevice *dev)
net_random_ethaddr(pdata->enetaddr);
printf("\nWarning: %s (eth%d) using random MAC address - %pM\n",
dev->name, dev_seq(dev), pdata->enetaddr);
+ eth_env_set_enetaddr_by_index("eth", dev_seq(dev),
+ pdata->enetaddr);
#else
printf("\nError: %s address not set.\n",
dev->name);
diff --git a/net/eth_legacy.c b/net/eth_legacy.c
index f383ccc..0b282d9 100644
--- a/net/eth_legacy.c
+++ b/net/eth_legacy.c
@@ -164,6 +164,8 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
net_random_ethaddr(dev->enetaddr);
printf("\nWarning: %s (eth%d) using random MAC address - %pM\n",
dev->name, eth_number, dev->enetaddr);
+ eth_env_set_enetaddr_by_index("eth", eth_number,
+ dev->enetaddr);
#else
printf("\nError: %s address not set.\n",
dev->name);