[Gllug] Problem starting up

Nix nix at esperi.demon.co.uk
Thu Aug 9 20:49:45 UTC 2001


On 08 Aug 2001, Jon Masters gibbered:
> Surely what this chap wants is a simple preloadable
> library which can override gethostname calls and
> return a result of <whatever the hell you want here>?

Ugh, no. A system already exists for this, and it's not LD_PRELOAD.

> Then all you need is a simple entry in your hosts
> (or DNS) so that lookups for that name also return
> the current machine's address - this should work?

I completely fail to understand what you're driving at. Do you mean that

192.168.1.4 womble

looking up `womble' should return `192.168.1.4'? If so, uh, that's what
/etc/hosts does anyway. If you mean

127.0.0.1 localhost

looking up `localhost' should return `192.168.1.4', then, well, how do
you get to local loopback?

A single name maps to *one* IP address, not many. (Round-robin DNS is a
rather ugly hack which doesn't affect this fundamental issue, that
programs can and do cache the result of resolver calls and use the same
IP address over and over again.)

> Does anyone have such a module handy or does one
> need knocking up - I figure there must be a toolkit
> somewhere with a few standard ones like this and
> overriding date/time functions.

This sort of thing is what the NSS module system is for. Read the _Name
Service Switch_ chapter of the glibc manual. It's quite simple to use
(but horrible to write; ye gods Ulrich likes his huge macros way too
much).

-- 
`It's all about bossing computers around. Users have to say "please".
Programmers get to say "do what I want NOW or the hard disk gets it".'
                        -- Richard Heathfield on the nature of programming

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list