Re: sockets APIs extensions for Host Identity Protocol

der Mouse <mouse@Rodents.Montreal.QC.CA> Fri, 11 May 2007 16:42 UTC

Return-path: <discuss-bounces@apps.ietf.org>
Received: from [127.0.0.1] (helo=stiedprmman1.va.neustar.com) by megatron.ietf.org with esmtp (Exim 4.43) id 1HmYCG-0003Zn-M6; Fri, 11 May 2007 12:42:24 -0400
Received: from discuss by megatron.ietf.org with local (Exim 4.43) id 1HmYCF-0003Zi-Pg for discuss-confirm+ok@megatron.ietf.org; Fri, 11 May 2007 12:42:23 -0400
Received: from [10.91.34.44] (helo=ietf-mx.ietf.org) by megatron.ietf.org with esmtp (Exim 4.43) id 1HmYCE-0003ZX-UR for discuss@apps.ietf.org; Fri, 11 May 2007 12:42:23 -0400
Received: from sparkle.rodents.montreal.qc.ca ([216.46.5.7]) by ietf-mx.ietf.org with esmtp (Exim 4.43) id 1HmYCE-0004WV-BB for discuss@apps.ietf.org; Fri, 11 May 2007 12:42:22 -0400
Received: from localhost (localhost [[UNIX: localhost]]) by Sparkle.Rodents.Montreal.QC.CA (8.8.8/8.8.8) id MAA19058; Fri, 11 May 2007 12:42:21 -0400 (EDT)
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
Message-Id: <200705111642.MAA19058@Sparkle.Rodents.Montreal.QC.CA>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
X-Erik-Conspiracy: There is no Conspiracy - and if there were I wouldn't be part of it anyway.
X-Message-Flag: Microsoft: the company who gave us the botnet zombies.
Date: Fri, 11 May 2007 12:02:00 -0400
To: discuss@apps.ietf.org
Subject: Re: sockets APIs extensions for Host Identity Protocol
In-Reply-To: <4644830D.7050302@cs.utk.edu>
References: <Pine.SOL.4.64.0705041801060.14418@kekkonen.cs.hut.fi> <20070507082737.GB21759@nic.fr> <46413DD7.8020702@cs.utk.edu> <20070509121703.GA21070@nic.fr> <4641CA52.70504@cs.utk.edu> <Pine.LNX.4.64.0705091449360.26169@hermes-1.csi.cam.ac.uk> <4641D94C.9070304@cs.utk.edu> <Pine.SOL.4.64.0705102013550.10049@kekkonen.cs.hut.fi> <46436B10.5090706@cs.utk.edu> <Pine.SOL.4.64.0705102159020.10049@kekkonen.cs.hut.fi> <4643F873.3000501@cs.utk.edu> <Pine.SOL.4.64.0705110851440.24038@kekkonen.cs.hut.fi> <46442588.7020405@cs.utk.edu> <200705111314.JAA17866@Sparkle.Rodents.Montreal.QC.CA> <4644830D.7050302@cs.utk.edu>
X-Spam-Score: 0.0 (/)
X-Scan-Signature: c3a18ef96977fc9bcc21a621cbf1174b
X-BeenThere: discuss@apps.ietf.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: general discussion of application-layer protocols <discuss.apps.ietf.org>
List-Unsubscribe: <https://www1.ietf.org/mailman/listinfo/discuss>, <mailto:discuss-request@apps.ietf.org?subject=unsubscribe>
List-Post: <mailto:discuss@apps.ietf.org>
List-Help: <mailto:discuss-request@apps.ietf.org?subject=help>
List-Subscribe: <https://www1.ietf.org/mailman/listinfo/discuss>, <mailto:discuss-request@apps.ietf.org?subject=subscribe>
Errors-To: discuss-bounces@apps.ietf.org

>> What do you see as wrong with [getaddrinfo()]?
> the nice thing about it is that it does two things for you.  one is
> that it completely initializes sockaddr structures for you.   the
> other is that (at least in recent versions?) it can take either a DNS
> name or an address literal and do the right thing with it.

The major thing *I* use it for is to insulate the application from
knowledge of what address families are available.  If correctly written
(getaddrinfo() can be used wrong, as most things can), an application
can be totally new-AF-ready.  If I write an SMTP client with
getaddrinfo() and then, a year later, someone defines SMTP-over-DECnet
(or SMTP-over-IPv7, or whatever), my code will start trying DECnet
without any changes whatsoever to the application.  (If, of course,
it's running on a DECnet-aware - or IPv7-aware - system.)

> - it's actually more difficult to set the parameters for
>    getaddrinfo() to get it to do what you want, than it is to
>    initialize the fields in a sockaddr_in*

Yes, if all you want is AF_INET - or AF_INET6 - it is.  But this is
*not* true if "what you want" is for the app code to be AF-agnostic, as
I sketched above.  I'm not even sure it's true if you want AF_INET
*and* AF_INET6; I find it about evenly balanced whether getaddrinfo()
or doing both INET* AFs is messier, more difficult, whatever.

> - getaddrinfo encourages use of string constants to specify ports,
>    rather than numeric constants, which is wrong -

No, this is very right.  The notion that "ports" are small integers is
a *horribly* IP-centric notion.  DECnet, for example, uses short
strings (8-char? 12-char? I don't know the limit) which do *not* have
to map into numbers - I think X over DECnet, for example, uses "port"
strings like "X$0" and "X$1".

>    it adds an extra layer of indirection that can (and does) fail,
>    and it tempts people to try to use that layer of indirection to do
>    things that violate protocol specifications (like do a SRV lookup
>    for protocols that aren't specified to use SRV)

We must be talking about different getaddrinfo()s.  The one I'm used to
doesn't do anything with SRV records, ever, as far as I can see (I
checked both the manpage and the code).

> - it has no way to be used asynchronously other than to put each call
>    to getaddrinfo in a separate thread,

Neither does gethostbyname().  And, without a lot of callback or AIO
scaffolding - or threading - it *can't*.

> - it's not specified to use DNS.

It's not really specified clearly at all, it appears.  Again, a valid
criticism, but a fixable one.

But it can't really be specified to use DNS, since it is not restricted
to address families that the DNS supports, and it also has to work on
systems not connected to the Internet (/etc/hosts and its ilk).  If I
had to set up a private DNS root just to use host names on an isolated
subnet, I'd call that cripplingly broken.

>    so if a protocol is specified to use DNS in some particular way,
>    and the implementation of the protocol uses getaddrinfo(), the
>    implementation may fail to strictly follow the protocol spec.

This is not a problem with getaddrinfo(); this is a problem with
implementors using inappropriate calls.  getaddrinfo() is not
appropriate for implementing protocols defined must-use-DNS, because of
the above issues.  (I'd actually argue that such specs are broken,
because they mean the protocol is unreasonably difficult to use
according to spec except on the public Internet.)

> - the handling of v4 vs v6 vs mapped v4 addresses is confusing.

No more than v4 vs v6 vs mapped v4 are to begin with.

The rest of your points - including the pieces I cut from the oens I
did address specifically - seem to fall into two categories: "no clear
agreed-upon spec" and "buggy implementations are common".  While these
are fair answers to my question, neither one seems to me like a reason
to ditch the interface entirely when considering standardizing
something for (say) HIP/HIT use.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B