1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+ 25745185eSwdenk /* 35745185eSwdenk * (C) Copyright 2001 45745185eSwdenk * Murray Jensen <Murray.Jensen@cmst.csiro.au> 55745185eSwdenk */ 65745185eSwdenk 75745185eSwdenk #include <stdio.h> 85745185eSwdenk #include <stdlib.h> 95745185eSwdenk #include <unistd.h> 105745185eSwdenk #include <time.h> 115745185eSwdenk 125745185eSwdenk int main(int argc,char * argv[])135745185eSwdenkmain(int argc, char *argv[]) 145745185eSwdenk { 155745185eSwdenk unsigned long ethaddr_low, ethaddr_high; 165745185eSwdenk 173e4dad50SJosh Wu srand(time(0) + (getpid() << 8)); 185745185eSwdenk 195745185eSwdenk /* 205745185eSwdenk * setting the 2nd LSB in the most significant byte of 215745185eSwdenk * the address makes it a locally administered ethernet 225745185eSwdenk * address 235745185eSwdenk */ 242eeb4e95SPeter Tyser ethaddr_high = (rand() & 0xfeff) | 0x0200; 252eeb4e95SPeter Tyser ethaddr_low = rand(); 265745185eSwdenk 275745185eSwdenk printf("%02lx:%02lx:%02lx:%02lx:%02lx:%02lx\n", 285745185eSwdenk ethaddr_high >> 8, ethaddr_high & 0xff, 295745185eSwdenk ethaddr_low >> 24, (ethaddr_low >> 16) & 0xff, 305745185eSwdenk (ethaddr_low >> 8) & 0xff, ethaddr_low & 0xff); 315745185eSwdenk 325745185eSwdenk return (0); 335745185eSwdenk } 34