aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorRoger Quadros <rogerq@ti.com>2017-03-13 15:04:33 +0200
committerTom Rini <trini@konsulko.com>2017-03-20 17:57:16 -0400
commitee6fdfadaafeb50a2e7d2a5a4f978332b5198000 (patch)
tree5eca0c7ca6c0428ad8cddfdb6d62493726ba8ca0 /net
parent752a8311e9c13af807ff9a32fbb2491282a41c8a (diff)
downloadu-boot-ee6fdfadaafeb50a2e7d2a5a4f978332b5198000.zip
u-boot-ee6fdfadaafeb50a2e7d2a5a4f978332b5198000.tar.gz
u-boot-ee6fdfadaafeb50a2e7d2a5a4f978332b5198000.tar.bz2
net: don't override ethernet address environment
If the ethernet address environment is set with a valid ethernet address prevent overriding it as it is most likely set by the user and he/she doesn't want board code to automatically override it whatsoever. Signed-off-by: Roger Quadros <rogerq@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'net')
-rw-r--r--net/eth_common.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/eth_common.c b/net/eth_common.c
index e9d3c66..58fa295 100644
--- a/net/eth_common.c
+++ b/net/eth_common.c
@@ -34,6 +34,9 @@ int eth_setenv_enetaddr(const char *name, const uchar *enetaddr)
{
char buf[ARP_HLEN_ASCII + 1];
+ if (eth_getenv_enetaddr(name, (uchar *)buf))
+ return -EEXIST;
+
sprintf(buf, "%pM", enetaddr);
return setenv(name, buf);