The patch titled uml: don't roll my own random MAC generator has been added to the -mm tree. Its filename is uml-dont-roll-my-own-random-mac-generator.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: uml: don't roll my own random MAC generator From: Jeff Dike <jdike@xxxxxxxxxxx> Use the existing random_ether_addr() instead of cooking up my own version. Pointed out by Dave Hollis and Jason Lunz. Signed-off-by: Jeff Dike <jdike@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- arch/um/drivers/net_kern.c | 4 +--- arch/um/drivers/net_user.c | 29 ----------------------------- arch/um/include/net_user.h | 2 -- 3 files changed, 1 insertion(+), 34 deletions(-) diff -puN arch/um/drivers/net_kern.c~uml-dont-roll-my-own-random-mac-generator arch/um/drivers/net_kern.c --- a/arch/um/drivers/net_kern.c~uml-dont-roll-my-own-random-mac-generator +++ a/arch/um/drivers/net_kern.c @@ -310,9 +310,7 @@ static void setup_etheraddr(char *str, u return; random: - addr[0] = 0xfe; - addr[1] = 0xfd; - random_mac(addr); + random_ether_addr(addr) } static DEFINE_SPINLOCK(devices_lock); diff -puN arch/um/drivers/net_user.c~uml-dont-roll-my-own-random-mac-generator arch/um/drivers/net_user.c --- a/arch/um/drivers/net_user.c~uml-dont-roll-my-own-random-mac-generator +++ a/arch/um/drivers/net_user.c @@ -259,32 +259,3 @@ char *split_if_spec(char *str, ...) va_end(ap); return str; } - -void random_mac(unsigned char *addr) -{ - struct timeval tv; - long n; - unsigned int seed; - - gettimeofday(&tv, NULL); - - /* Assume that 20 bits of microseconds and 12 bits of the pid are - * reasonably unpredictable. - */ - seed = tv.tv_usec | (os_getpid() << 20); - srandom(seed); - - /* Don't care about endianness here - switching endianness - * just rearranges what are hopefully random numbers. - * - * Assume that RAND_MAX > 65536, so random is called twice and - * we use 16 bits of the result. - */ - n = random(); - addr[2] = (n >> 8) & 255; - addr[3] = n % 255; - - n = random(); - addr[4] = (n >> 8) & 255; - addr[5] = n % 255; -} diff -puN arch/um/include/net_user.h~uml-dont-roll-my-own-random-mac-generator arch/um/include/net_user.h --- a/arch/um/include/net_user.h~uml-dont-roll-my-own-random-mac-generator +++ a/arch/um/include/net_user.h @@ -50,6 +50,4 @@ extern char *split_if_spec(char *str, .. extern int dev_netmask(void *d, void *m); -extern void random_mac(unsigned char *addr); - #endif _ Patches currently in -mm which might be from jdike@xxxxxxxxxxx are origin.patch uml-assign-random-macs-to-interfaces-if-necessary.patch uml-mechanical-tidying-after-random-macs-change.patch uml-locking-documentation.patch uml-close-file-descriptor-leaks.patch uml-stack-consumption-reduction.patch uml-dont-roll-my-own-random-mac-generator.patch uml-remove-pte_mkexec.patch simplify-update_times-avoid-jiffies-jiffies_64-aliasing-problem-2.patch kill-wall_jiffies.patch const-struct-tty_operations.patch namespaces-utsname-switch-to-using-uts-namespaces.patch introduce-kernel_execve.patch rename-the-provided-execve-functions-to-kernel_execve.patch provide-kernel_execve-on-all-architectures.patch provide-kernel_execve-on-all-architectures-fix.patch remove-the-use-of-_syscallx-macros-in-uml.patch sh64-remove-the-use-of-kernel-syscalls.patch remove-remaining-errno-and-__kernel_syscalls__-references.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html