]>
git.ipfire.org Git - people/ms/u-boot.git/blob - tools/gen_eth_addr.c
3 * Murray Jensen <Murray.Jensen@cmst.csiro.au>
5 * SPDX-License-Identifier: GPL-2.0+
14 main(int argc
, char *argv
[])
16 unsigned long ethaddr_low
, ethaddr_high
;
18 srand(time(0) | getpid());
21 * setting the 2nd LSB in the most significant byte of
22 * the address makes it a locally administered ethernet
25 ethaddr_high
= (rand() & 0xfeff) | 0x0200;
28 printf("%02lx:%02lx:%02lx:%02lx:%02lx:%02lx\n",
29 ethaddr_high
>> 8, ethaddr_high
& 0xff,
30 ethaddr_low
>> 24, (ethaddr_low
>> 16) & 0xff,
31 (ethaddr_low
>> 8) & 0xff, ethaddr_low
& 0xff);