Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2000:
[Freeciv-Dev] Re: Hostname lookups again.
Home

[Freeciv-Dev] Re: Hostname lookups again.

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Hostname lookups again.
From: Gaute B Strokkenes <gs234@xxxxxxxxx>
Date: 19 Sep 2000 14:35:13 +0200

Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx> writes:

> On 18 Sep 2000, Gaute B Strokkenes wrote:
> 
> > I have attached a (slighly) updated version.  It's a very
> > straightforward fix.  It would be great if someone gave me some
> > feedback, or just applied the damn thing...
> 
> Well, i really don't see why you're making all those checks to see if a
> name is of the AF_INET family in look up using gethostbyname().  It's not
> like DNS is used for non IP stuff...  as far as i know...

AF_INET6.  There are various other, though less common, possibilities
as well.

I'm not that familiar with inetv6, and I don't have the opportunity to
test it either, but I'd be surprised if Freeciv compiled and ran
cleanly on such a system.  I'm just insuring that we'll fail cleanly
rather than crash and/or play yankee doodle or anything else funny
when the time comes.  When/if inetv6 becomes popular, it should be
easy to adapt Freeciv anyway.

> And it's not like replacing the memcpy()'s with attributions is
> doing much too.

My problem with that code was that it would use the size field in the
result of the look-up to determine how much to copy.  I didn't
investigate the affected data structures too much, but sooner or later
you'll end up being sorry for copying a 128-bit inetv6 address instead
of a 32-bit inetv4 address.  If you prefer memcpy() over struct
assignments, please feel free to change it back.  But do it
properly... >8-)

Actually checking the length field of the look-up (when we've already
ascertained that it's AF_INET) might be a bit anal, but why not.

> And we probably could use inet_aton() instead of inet_addr() since the
> Linux man page says it's obsolete (funny hadn't noticed that before).

Or just forget about them altogether (as my patch does,) since
gethostbyname() is supposed to do the right thing when presented with
a dotted quad.  I suppose there might be brain-damaged systems out
there that don't do this.  If anyone knows of one, they might wish to
chime in.

-- 
Big Gaute (not to be confused with LG)
My DIGITAL WATCH has an automatic SNOOZE FEATURE!!



[Prev in Thread] Current Thread [Next in Thread]