On Wed, Apr 25, 2001 at 05:47:23PM -0700, Lydia Leong wrote:
> On Apr 7, 8:37am, Eric Kidder wrote:
>
> > I rewrote the patch to use getaddrinfo() instead of gethostbyname().
> > Otherwise, it (seems to) works identically to the previous patch. Yay.
>
>
> Unfortunately, getaddrinfo() and related functions are part of the
> extensions to sockets for IPv6. The functions are effectively
> non-portable at this time, since few operating system libraries
> currently support them.
>
Actually, this isn't true. getaddrinfo() and such are part of POSIX 1003.1g,
"Protocol Independent Interfaces", and are present on current versions of
most unix-ish OSes that people are likely to run mushes on (Linux, all the
*BSDs, and less common others like Solaris), and there are freely available
implementations for older systems that can be used with a few extra
Configure checks. A slightly modified version of the one from W. Richard
Stevens' Unix Network Programming books is what's in PennMUSH if it's not
found in the host's libraries.
I used getaddrinfo() and friends when making PennMUSH mostly IP version
independent last summer, and it has worked out great after a few growing
pains dealing with the vagaries of older systems (For example, you can't
assume that IPv6 structures are present just because AF_INET6 is #defined).
It's nice. If a server has an IPv6 stack running, Penn will automatically
use it, and otherwise stick with IPv4, without us having to do anything
special in the code. Theoretically, it'll work with minor-to-no changes with
whatever will eventually replace IPv6. I know this doesn't do much good
until the people who write clients start supporting IPv6 (Preferably with
the right way of getaddrinfo(), rather than using explicit protocol versions
and structs), and till more of the net starts speaking IPv6, but every
little bit helps that along.
Since most OSes will automatically map incoming IPv4 connections to a port
listening with IPv6 into an IPv6 address, people tend not to even know their
mush is using the newer protocol until they look at how it displays their IP
address. Then they usually report it as a bug, grumble grumble. :)
Anyways, don't just dismiss getaddrinfo() out of hand. It's the Right Way to
go about adding IPv6 support or more general IP version independence to a
program. Of course, if you have no intentions of doing that for TM, then I
suppose you can ignore it, if you so desire.
-Raevnos.
--
Shawn Wagner
shawnw@...
|