]> git.sur5r.net Git - u-boot/commitdiff
net: Get mac address from driver as seed
authorJimmy Du <jimmy.du@ni.com>
Tue, 6 Jun 2017 16:58:54 +0000 (11:58 -0500)
committerJoe Hershberger <joe.hershberger@ni.com>
Mon, 7 Aug 2017 20:18:28 +0000 (15:18 -0500)
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@ni.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
net/net_rand.h

index ba9d0642cf231ab2ed14c162f2c7fb975f315574..4bf9bd817e5f6fa3df21ebfc14101cf1e30f66af 100644 (file)
  */
 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;