Subject: Re: draft-ietf-ipngwg-scopedaddr-format-00.txt

From: David Borman <[email-masked]>
Date: Thu, 4 Nov 1999 01:19:03 -0600 (CST)

> From: [email-masked] (Sam Manthorpe)
> Subject: Re: draft-ietf-ipngwg-scopedaddr-format-00.txt
> Date: Wed, 3 Nov 1999 22:39:29 -0800 (PST)
>
> Erik Nordmark wrote:
> > Why not just use getaddrinfo instead of getipnodebyname?
> > This might mean changing 20 lines of code compared to 10 lines of code
> > with getipnodebyname (for a port of trivial example code to the new API).
>
> Because the semantics of getipnodebyname() are very similar to those
> of gethostbyname() whereas the semantics of getaddrinfo() are not
> only more complex but _different_.  I'm not disputing that getaddrinfo()
> is a nice, powerful function that solves the problem in an elegant
> fashion, but I would be happier if porting applications to use IPv6
> were made as easy as possible.  I think at the very least 
> ...

I'll just put in my $.02 again...  Converting an AF_INET/gethostbyname()
application to AF_INET6/getipnodebyname() is straight forward, but
it assumes that the resulting binary will only be run on systems that
support AF_INET6.  If you take your binary, and try and run it on
a kernel that does not have AF_INET6 support, it won't work.  I like
using getaddrinfo() because the resulting binary will work with both
IPv6 and IPv4 addresses on kernels built with AF_INET6 support, and
will still work with IPv4 addresses on kernels built without AF_INET6
support, since it will open up an AF_INET socket for an IPv4 address,
instead of an AF_INET6 socket with an IPv4-mapped IPv6 address.

We (BSDI) ship with IPv6 support, but we don't require that
everyone build their kernels with IPv6 support.  We ship one
set of binaries that work both with and without IPv6 kernel support.

I don't expect everyone to agree with me, and I won't try and
convince those that feel that getipnodebyname() is sufficient.
As long as your kernels always have AF_INET6 support, things will
work just fine with AF_INET6/getipnodebyname().  But it just seems
to me that getaddrinfo() provides a cleaner solution to multiple
protocol support.

(Of course, you could use IN6_IS_ADDR_V4MAPPED() to check the
returned address from getipnodebyname(), and if it is one,
then open an AF_INET socket instead of an AF_INET6 socket,
and pull out the IPv4 address from the mapped address and fill
in a sockaddr_in structure.  Then your binary will run on
non-AF_INET6 kernels.  But if you do all that work, you might
as well have just used getaddrinfo() in the first place, and
have much cleaner looking code.)

			-David Borman, [email-masked]
--------------------------------------------------------------------
IETF IPng Working Group Mailing List
IPng Home Page:                      http://playground.sun.com/ipng
FTP archive:                      ftp://playground.sun.com/pub/ipng
Direct all administrative requests to [email-masked]
--------------------------------------------------------------------

---

From: Jim Bound <[email-masked]>
Date: Thu, 04 Nov 1999 10:45:01 -0500

dave,

done it both ways and have code running with getipnodebyname.

getipnodebyname when you ship v4 and v6 binaries.

I agree with sam..........

also works nice with utilities like ifconfig, netstat, tcpdump etc.

we have a choice lets leave it that and not get into a religious debate
as I think that is what it will generate too.

/jim