Re: [PATCH] Time-based RFC 4122 UUID generator

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Helge Deller
Date: Tuesday, November 20, 2007 - 3:40 pm

On Tuesday 20 November 2007, Andrew Morton wrote:

Ok.
 

Thanks. I'll fix this with a #define.
 

Ok, I'll change that to an initcall. 
It's possible for userspace to write a new random new clock_seq value to
/proc/sys/kernel/random/uuid_time_clockseq at any time at bootup, although
this shouldn't be necessary at all if the clock is correct at the time the first
UUID is asked for.
So, in principle it shouldn't be a big problem if it's an initcall.



Me neither :-)
If people here prefer, I'll come up with a patch for net/.

What this code basically does is:
- Look if a net device with a given MAC still exists in this machine. If yes, return this MAC again.
- If it does not exist any longer, return the MAC address of the _first_ true network card
- If no network card exists at all, return e.g. 'false' (in which case the UUID function will use a random MAC).

What does the network people here think ? Should this be a helper function in net/ ?


Basically that's just the steps the RFC describes. I just sticked to the RFC.
The RFC is aware, that it's probably not globally-unique, that's why a 'clock_seq' number and 
the time stamp adds some more 'uniqueness' to the full UUID.


See above. Only all pieces together (timestamp + clock_seq + MAC) builds up 
the full UUID.
The timestamp value is the current time, and clock_seq is a random value. 
MAC is preferrably a real MAC, or if not available a random MAC-like number.


Acording to the RFC you should generate a random number and use it 
as MAC, if no network device was found.
The current Linux kernel generates a "random unique boot ID" for
/proc/sys/kernel/random/uuid, and the last part of this UUID is the 
"bootid/nodeID" (a random MAC). It's then used by my code if no 
network card is found.
 

Yes. Basically it's just the RFC 4122 implementation, but I'll better describe 
it with the next patch.

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Time-based RFC 4122 UUID generator, Helge Deller, (Sun Nov 18, 12:38 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Andrew Morton, (Sun Nov 18, 2:05 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Sam Ravnborg, (Sun Nov 18, 2:34 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Helge Deller, (Sun Nov 18, 2:40 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Andrew Morton, (Mon Nov 19, 11:15 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Matt Mackall, (Mon Nov 19, 11:31 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Helge Deller, (Tue Nov 20, 2:59 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Helge Deller, (Tue Nov 20, 3:40 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Matt Mackall, (Tue Nov 20, 3:55 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Theodore Tso, (Tue Nov 20, 4:00 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Helge Deller, (Tue Nov 20, 4:11 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Helge Deller, (Tue Nov 20, 4:30 pm)
Re: [PATCH] Time-based RFC 4122 UUID generator, Matt Mackall, (Tue Nov 20, 4:34 pm)