linux-kernel-test/arch
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
..
alpha [PATCH] alpha: Fix ALPHA_EV56 dependencies typo 2006-09-26 08:48:57 -07:00
arm Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2006-09-28 14:40:39 -07:00
arm26 [PATCH] tty: Remove include of screen_info.h from tty.h 2006-07-10 13:24:16 -07:00
avr32 [PATCH] AVR32: Use unsigned long flags for saving interrupt state 2006-09-27 08:26:13 -07:00
cris [PATCH] pcf8563: remove MOD_INC_USE_COUNT, MOD_DEC_USE_COUNT 2006-07-10 13:24:22 -07:00
frv [PATCH] FRV: permit __do_IRQ() to be dispensed with 2006-09-26 08:48:53 -07:00
h8300 [PATCH] reduce MAX_NR_ZONES: fix MAX_NR_ZONES array initializations 2006-09-26 08:48:46 -07:00
i386 [PATCH] convert i386 Summit subarch to use SRAT info for apicid_to_node calls 2006-09-29 09:18:03 -07:00
ia64 [IPV4]: annotate struct in_ifaddr 2006-09-28 18:00:55 -07:00
m32r [PATCH] reduce MAX_NR_ZONES: fix MAX_NR_ZONES array initializations 2006-09-26 08:48:46 -07:00
m68k [PATCH] irq-flags: M68K: Use the new IRQF_ constants 2006-07-02 13:58:47 -07:00
m68knommu [PATCH] reduce MAX_NR_ZONES: fix MAX_NR_ZONES array initializations 2006-09-26 08:48:46 -07:00
mips [PATCH] sysctl: Allow /proc/sys without sys_sysctl 2006-09-27 08:26:19 -07:00
parisc [PATCH] NUMA: Add zone_to_nid function 2006-09-26 08:48:52 -07:00
powerpc [PATCH] sysctl: Allow /proc/sys without sys_sysctl 2006-09-27 08:26:19 -07:00
ppc [PATCH] Have Power use add_active_range() and free_area_init_nodes() 2006-09-27 08:26:11 -07:00
s390 [PATCH] convert s390 page handling macros to functions 2006-09-29 09:18:03 -07:00
sh sh: Fix occasional flush_cache_4096() stack corruption. 2006-09-27 18:37:30 +09:00
sh64 [PATCH] reduce MAX_NR_ZONES: fix MAX_NR_ZONES array initializations 2006-09-26 08:48:46 -07:00
sparc [PATCH] Standardize pxx_page macros 2006-09-26 08:48:51 -07:00
sparc64 Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6 2006-09-27 08:32:01 -07:00
um [PATCH] uml: assign random MACs to interfaces if necessary 2006-09-29 09:18:04 -07:00
v850 [PATCH] v850: call init_page_count() instead of set_page_count() 2006-07-31 13:28:38 -07:00
x86_64 [PATCH] sysctl: Allow /proc/sys without sys_sysctl 2006-09-27 08:26:19 -07:00
xtensa [IPV4]: annotate struct in_ifaddr 2006-09-28 18:00:55 -07:00