On Fri, Feb 29, 2008 at 10:07:01AM -0700, John Calcote wrote:
I'm thinking the right change here is to use the loopback address as a fallback. Normally, I'd want to identify myself to my server by a non-local address - it's silly to send 127.0.0.1 to a server to identify yourself - unless of course that really is your only address! I think I'll change this code so that it uses the first non-loopback address it finds, but if none exists, then it falls back to the loopback address. This way it can assume that if loopback is the only one it can find, then the server must also be local. Does this sound reasonable?
Yes, sounds sane to me.
Also, I've been wondering about this sort of code for years. I mean, if you're multi-homed, then which non-local address do you tell your server about?
IMHO the routing layer is the natural enemy of multi homed ;-)
Clearly the right way is to calculate the route to your server, and ensure you're telling the server that your name is some address by which he really can reach you. In this case, it doesn't matter, as we're using this address more as a human-readable indication of which machine is processing the server's data, but in a more rigorous environment, where the address might be used by the server to return information to the client, you'd want to pick an address with a proper route.
Is there some example code of doing this sort of thing that you're aware of?
Uh, first of all, I'm no network expert at all. Having said that, I think a pretty standard way is to do a DNS lookup on the hostname and use what the DNS server indicates to be canonical. Cheers, Michael. -- Michael Schroeder mls@suse.de SUSE LINUX Products GmbH, GF Markus Rex, HRB 16746 AG Nuernberg main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);} --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org