linux-stable/arch/um
Jeff Dike f3e7ed2b61 [PATCH] uml: assign random MACs to interfaces if necessary
Assign a random MAC to an ethernet interface if one was not provided on the
command line.  This became pressing when distros started bringing interfaces
up before assigning IPs to them.  The previous pattern of assigning an IP then
bringing it up allowed the MAC to be generated from the first IP assigned.
However, once the thing is up, it's probably a bad idea to change the MAC, so
the MAC stayed initialized to fe:fd:0:0:0:0.

Now, if there is no MAC from the command line, one is generated.  We use the
microseconds from gettimeofday (20 bits), plus the low 12 bits of the pid to
seed the random number generator.  random() is called twice, with 16 bits of
each result used.  I didn't want to have to try to fill in 32 bits optimally
given an arbitrary RAND_MAX, so I just assume that it is greater than 65536
and use 16 bits of each random() return.

There is also a bit of reformatting and whitespace cleanup here.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:04 -07:00
..
drivers [PATCH] uml: assign random MACs to interfaces if necessary 2006-09-29 09:18:04 -07:00
include [PATCH] uml: assign random MACs to interfaces if necessary 2006-09-29 09:18:04 -07:00
kernel [PATCH] uml: fix sleep length bug 2006-09-27 08:26:16 -07:00
os-Linux [PATCH] uml: thread creation tidying 2006-09-27 08:26:16 -07:00
scripts kbuild: fix ia64 breakage after introducing make -rR 2006-07-01 09:58:02 +02:00
sys-i386 Merge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6 2006-09-26 13:07:55 -07:00
sys-ia64 Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sys-ppc Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
sys-x86_64 [PATCH] uml: Use klibc setjmp/longjmp 2006-09-26 08:49:05 -07:00
config.release Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
defconfig [PATCH] uml: remove syscall debugging 2006-07-10 13:24:24 -07:00
Kconfig [PATCH] uml: skas0 support for 2G/2G hosts 2006-05-01 18:17:43 -07:00
Kconfig.char [PATCH] uml: Rename Kconfig files to be like the other arches 2005-09-05 00:06:19 -07:00
Kconfig.debug [PATCH] uml: remove syscall debugging 2006-07-10 13:24:24 -07:00
Kconfig.i386 [PATCH] uml: skas0 support for 2G/2G hosts 2006-05-01 18:17:43 -07:00
Kconfig.net [PATCH] uml: Rename Kconfig files to be like the other arches 2005-09-05 00:06:19 -07:00
Kconfig.scsi [PATCH] uml: Rename Kconfig files to be like the other arches 2005-09-05 00:06:19 -07:00
Kconfig.x86_64 [PATCH] um: fix undefined reference to hweight32 2006-03-26 08:57:09 -08:00
Makefile [PATCH] uml: uml-makefile-nicer uses SYMLINK incorrectly 2006-05-01 18:17:45 -07:00
Makefile-i386 [PATCH] uml: add -ffreestanding to CFLAGS 2006-06-05 12:29:17 -07:00
Makefile-ia64 Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Makefile-os-Linux Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Makefile-ppc Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Makefile-skas [PATCH] uml makefiles sanitized 2005-09-29 08:46:26 -07:00
Makefile-tt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Makefile-x86_64 [PATCH] uml: use -mcmodel=kernel for x86_64 2006-09-27 08:26:15 -07:00