[U-Boot] [PATCH] net: Get mac address from driver as seed
Jimmy Du
jimmy.du at ni.com
Tue Jun 6 16:58:54 UTC 2017
Previously seeded by obtaining mac addr from env. If mac addr was
never set, rand would output 0. This fix obtains the mac addr
from driver instead.
Signed-off-by: Jimmy Du <jimmy.du at ni.com>
Acked-by: Joe Hershberger <joe.hershberger at ni.com>
---
net/net_rand.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/net_rand.h b/net/net_rand.h
index ba9d064..4bf9bd8 100644
--- a/net/net_rand.h
+++ b/net/net_rand.h
@@ -16,11 +16,11 @@
*/
static inline unsigned int seed_mac(void)
{
- unsigned char enetaddr[6];
+ unsigned char enetaddr[ARP_HLEN];
unsigned int seed;
/* get our mac */
- eth_getenv_enetaddr("ethaddr", enetaddr);
+ memcpy(enetaddr, eth_get_ethaddr(), ARP_HLEN);
seed = enetaddr[5];
seed ^= enetaddr[4] << 8;
--
2.1.4
More information about the U-Boot
mailing list