[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200710202158.40645.deller@gmx.de>
Date: Sat, 20 Oct 2007 21:58:40 +0200
From: Helge Deller <deller@....de>
To: Andrew Morton <akpm@...l.org>
Cc: linux-kernel@...r.kernel.org, Valdis.Kletnieks@...edu
Subject: [PATCH 1/2] UUID: set multicast bit in pseudo-random MAC address
Fix a bug in the current random UUID generator:
Section 4.1.6 of RFC 4122 states regarding the "NodeID" of a UUID:
: For systems with no IEEE address, a randomly or pseudo-randomly
: generated value may be used; see Section 4.5. The multicast bit must
: be set in such addresses, in order that they will never conflict with
: addresses obtained from network cards.
So up to now it was just pure ("random") luck if this bit was set or not.
This tiny patch sets the bit explicitely.
Signed-off-by: Helge Deller <deller@....de>
CC: Valdis.Kletnieks@...edu
random.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1157,6 +1158,8 @@ void generate_random_uuid(unsigned char uuid_out[16])
uuid_out[6] = (uuid_out[6] & 0x0F) | 0x40;
/* Set the UUID variant to DCE */
uuid_out[8] = (uuid_out[8] & 0x3F) | 0x80;
+ /* Set multicast bit to avoid conflicts with NIC MAC addresses */
+ uuid_out[10] |= 0x80;
}
EXPORT_SYMBOL(generate_random_uuid);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists