Re: [U-Boot] ethernet: ROM MAC address vs env variable MAC address
On 13-11-17 20:49, Wolfgang Denk wrote: Dear Prabhakar, In messageyou wrote: Why ROM MAC address getting overwritten by environment env MAC address. Because in U-Boot we give the user the freedom to do what he needs/wants to do. Usually the environment value gets initialized from the value in the ROM, so there is no difference anyway. But if the user wants a specific setting, he can change it. MAC address is something unique and assigned to a particular device. So one should never change its MAC address. U-Boot follows good old UNIX style here: "UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things." - Doug Gwyn Many board manufacturers "assign" this unique MAC address by printing it on a sticker and sticking that on the board somewhere. It's pretty darn hard to read a printed sticker in software, so we have to revert to solutions that actually work. In the "clever things" department, protocols like IPv6 merrily broadcast your MAC address across gateways on the big bad internet, so if you value your privacy, you'll appreciate the possibility to change your MAC address at will. Kind regards, Mike Looijmans System Expert TOPIC Products Materiaalweg 4, NL-5681 RJ Best Postbus 440, NL-5680 AK Best Telefoon: +31 (0) 499 33 69 79 E-mail: mike.looijm...@topicproducts.com Website: www.topicproducts.com Please consider the environment before printing this e-mail ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] ethernet: ROM MAC address vs env variable MAC address
Dear Prabhakar, In messageyou wrote: > > Why ROM MAC address getting overwritten by environment env MAC address. Because in U-Boot we give the user the freedom to do what he needs/wants to do. Usually the environment value gets initialized from the value in the ROM, so there is no difference anyway. But if the user wants a specific setting, he can change it. > MAC address is something unique and assigned to a particular device. So one > should never change its MAC address. U-Boot follows good old UNIX style here: "UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things." - Doug Gwyn Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de If in any problem you find yourself doing an immense amount of work, the answer can be obtained by simple inspection. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] ethernet: ROM MAC address vs env variable MAC address
Hi Prabhakar, > Hi All, > > I am seeing following type of code for MAC address write for a > network device. > > net/eth-uclass.c eth_post_probe() or net/eth_legacy.c > eth_write_hwaddr() > > eth_env_get_enetaddr_by_index("eth", dev->seq, env_enetaddr); > if (!is_zero_ethaddr(env_enetaddr)) { > if (!is_zero_ethaddr(pdata->enetaddr) && > memcmp(pdata->enetaddr, env_enetaddr, ARP_HLEN)) { > printf("\nWarning: %s MAC addresses don't > match:\n", dev->name); > printf("Address in ROM is %pM\n", > pdata->enetaddr); > printf("Address in environment is %pM\n", > env_enetaddr); > } > > /* Override the ROM MAC address */ > memcpy(pdata->enetaddr, env_enetaddr, ARP_HLEN); > > Why ROM MAC address getting overwritten by environment env MAC > address. MAC address is something unique and assigned to a particular > device. So one should never change its MAC address. > It may happen that company which uses NXP processor wants to use their own set of MAC addresses. > Please suggest. > > Regards, > Prabhakar > > ___ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de pgpYDzGVQ3mvH.pgp Description: OpenPGP digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] ethernet: ROM MAC address vs env variable MAC address
Hi All, I am seeing following type of code for MAC address write for a network device. net/eth-uclass.c eth_post_probe() or net/eth_legacy.c eth_write_hwaddr() eth_env_get_enetaddr_by_index("eth", dev->seq, env_enetaddr); if (!is_zero_ethaddr(env_enetaddr)) { if (!is_zero_ethaddr(pdata->enetaddr) && memcmp(pdata->enetaddr, env_enetaddr, ARP_HLEN)) { printf("\nWarning: %s MAC addresses don't match:\n", dev->name); printf("Address in ROM is %pM\n", pdata->enetaddr); printf("Address in environment is %pM\n", env_enetaddr); } /* Override the ROM MAC address */ memcpy(pdata->enetaddr, env_enetaddr, ARP_HLEN); Why ROM MAC address getting overwritten by environment env MAC address. MAC address is something unique and assigned to a particular device. So one should never change its MAC address. Please suggest. Regards, Prabhakar ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot