Subject: Re: Host IDs
To: None <itojun@iijlab.net>
From: Al B. Snell <alaric@alaric-snell.com>
List: tech-kern
Date: 01/02/2001 04:50:49
On Tue, 2 Jan 2001 itojun@iijlab.net wrote:
[many kludges]
Ugh.
There is no requirement for the link-local part of an IPv6 address to
actually be the MAC address of *that* interface - a machine with multiple
interfaces can use the same link local part on all connected links
etc. just as long as they're unique.
Is there anything inherently *wrong* with my dream of using a sysctl to
store a 64 bit host ID? Then a userland tool run early in the boot
sequence can set it from the hostname/MAC address/phase of moon as
necessary, before IPv6 interfaces are brought up.
I'll gladly write the code myself... which bit of the sysctl MIB should I
put such a beast in, though? I'm not sure what POSIX has to say about such
stuff. I see that kern.hostid seems to be 0 on x86 but has some kind of
value (1469743693) on my sparc box - is this the beginnings of what I
want? It seems to be writable. If it is, then I don't need to hack a new
sysctl into the kernel. Then again, it seems only to be 32 bits :-( The
variable is defined as "long hostid", and is treated as an int for the
sysctl.
Can this be upped to 64 bits and treated as a string instead of an
integer? Or should I just let sleeping dogs lie and define a new sysctl
variable for an EUI64 ID for a machine (which can of course be glboally or
locally defined - the EUI64 spec allows for a bit to be flipped in the ID
to mark it as a local one, then the site admin gets to allocate them as
they see fit - eg, from hostnames!)
I note that /usr/src/sys/arch/sparc/sparc/clock.c reads:
idp = &idprom;
h = idp->id_machine << 24;
h |= idp->id_hostid[0] << 16;
h |= idp->id_hostid[1] << 8;
h |= idp->id_hostid[2];
hostid = h;
- which is where my initial host ID on NetBSD/sparc comes from then :-)
A grep in /usr/src/sys/arch/*/*/*.c for "hostid" suggests that the
following ports set hostid from the depths of their PROMs:
amiga
sparc
sparc64
sun
Having an EUI64 stored in the kernel, I would change the code to ifconfig
fe80:: and rtsold to use this number. At what point does an interface gain
the fe80:: address? I think it's kernel code that sets it up, but is it
set before init is started? If so, that wouldm mess up my plans unless I
removed the automatic setup of fe80:: in ther kernel and hat
/etc/rc.d/network do it based upon the output of sysctl and a bit of sed
magic.
Also, I suggest that the following line from /etc/rc.d/network:
route add -inet6 fec0:: -prefixlen 10 ::1 -reject
(which the comment above suggests commenting out for interior routers) be
controlled by an rc.conf variable instead of asking me to edit scripts in
/etc/rc.d! I'm using site local addresses for my home LAN since I don't
have an address allocation yet.
ABS
--
Alaric B. Snell
http://www.alaric-snell.com/ http://RFC.net/ http://www.warhead.org.uk/
Any sufficiently advanced technology can be emulated in software