1 // SPDX-License-Identifier: GPL-2.0+
4 * Murray Jensen <Murray.Jensen@cmst.csiro.au>
13 main(int argc, char *argv[])
15 unsigned long ethaddr_low, ethaddr_high;
17 srand(time(0) + (getpid() << 8));
20 * setting the 2nd LSB in the most significant byte of
21 * the address makes it a locally administered ethernet
24 ethaddr_high = (rand() & 0xfeff) | 0x0200;
27 printf("%02lx:%02lx:%02lx:%02lx:%02lx:%02lx\n",
28 ethaddr_high >> 8, ethaddr_high & 0xff,
29 ethaddr_low >> 24, (ethaddr_low >> 16) & 0xff,
30 (ethaddr_low >> 8) & 0xff, ethaddr_low & 0xff);