Re: Revised address selection preference API draft-chakrabarti-ipv6-addrselect-api-04

Rémi Denis-Courmont <rdenis@simphalempin.com> Fri, 20 October 2006 12:42 UTC

Received: from [127.0.0.1] (helo=stiedprmman1.va.neustar.com) by megatron.ietf.org with esmtp (Exim 4.43) id 1GathO-0001De-SP; Fri, 20 Oct 2006 08:42:06 -0400
Received: from [10.91.34.44] (helo=ietf-mx.ietf.org) by megatron.ietf.org with esmtp (Exim 4.43) id 1GathM-0000uF-Lk for ipv6@ietf.org; Fri, 20 Oct 2006 08:42:04 -0400
Received: from poy.chewa.net ([2002:c2f2:7249::1]) by ietf-mx.ietf.org with esmtp (Exim 4.43) id 1GathK-0007Jb-6O for ipv6@ietf.org; Fri, 20 Oct 2006 08:42:04 -0400
Received: by poy.chewa.net (Postfix, from userid 1002) id E8DB596507; Fri, 20 Oct 2006 14:41:40 +0200 (CEST)
Date: Fri, 20 Oct 2006 15:41:40 +0300
From: Rémi Denis-Courmont <rdenis@simphalempin.com>
To: Julien Laganier <julien.IETF@laposte.net>
Message-ID: <20061020124140.GA18063@simphalempin.com>
References: <200610201320.21651.julien.IETF@laposte.net>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Disposition: inline
In-Reply-To: <200610201320.21651.julien.IETF@laposte.net>
Organization: Remlab.net
User-Agent: Mutt/1.5.9i
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.8 (--)
X-Scan-Signature: 8b431ad66d60be2d47c7bfeb879db82c
Cc: ipv6@ietf.org
Subject: Re: Revised address selection preference API draft-chakrabarti-ipv6-addrselect-api-04
X-BeenThere: ipv6@ietf.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "IP Version 6 Working Group \(ipv6\)" <ipv6.ietf.org>
List-Unsubscribe: <https://www1.ietf.org/mailman/listinfo/ipv6>, <mailto:ipv6-request@ietf.org?subject=unsubscribe>
List-Post: <mailto:ipv6@ietf.org>
List-Help: <mailto:ipv6-request@ietf.org?subject=help>
List-Subscribe: <https://www1.ietf.org/mailman/listinfo/ipv6>, <mailto:ipv6-request@ietf.org?subject=subscribe>
Errors-To: ipv6-bounces@ietf.org

	Hello,

Some random comments:

The proposed API adds a new IPv6-level socket option
(IPV6_ADDRESS_PREFERENCES). IMHO, it ought to
also specify that this can also be used as a "non-sticky" option through
sendmsg() ancilliarry data, like other IPv6 options found in the
advanced IPv6 API.

It might be nicer to have the SA/SB DA/DB example for getaddrinfo() in a
subsection of its own mentionning that it is an example. The struct
definition should probably be moved into an appendix as an example
implementation detail. Similarly, the actual specification part of that
chapter deserves to be separated from introductory text and example.

The example getaddrinfo() is flawed. DO NOT let this flow into an RFC...
freeaddrinfo() must be applied to the pointer returned by getaddrinfo(),
i.e. the pointer to the first struct addrinfo in the linked list. Your
code is essentially equivalent to freeaddrinfo(NULL) !

Please specify the interaction between AI_PREFERENCES and AI_PASSIVE -
the current spec seems to assume AI_PASSIVE is not set.

More seriously, there are some design flaws in the proposed
getaddrinfo() extensions:

For a start, there is a race condition if the locally available
addresses or the routing table change between the getaddrinfo()
invocation and connect() calls, we may get unwanted results. Maybe a
solution would be to return ai_bindaddr and ai_connaddr instead of just
ai_addr.

Also, extending the byte size of an already existing structure might
pose some problem: imagine an application initializes a "hint" struct
addrinfo, and passes it to a library API that would tweak it depending
on some configuration or whatever, then the application would use the
same hint as a parameter to getaddrinfo(). Now what if the application
was built with the old-style struct addrinfo without the ai_eflags, but
the library uses it? we risk a buffer overflow there.

IMHO, it might be wiser to define extended getaddrinfo, freeaddrinfo and
struct addrinfo variants (geteaddrinfo ?) - that woud allow to use the
ai_bindaddr and ai_connaddr thing at the same time.

Regards,

-- 
Rémi Denis-Courmont,
looking for a job
http://www.simphalempin.com/home/infos/CV-en.pdf

--------------------------------------------------------------------
IETF IPv6 working group mailing list
ipv6@ietf.org
Administrative Requests: https://www1.ietf.org/mailman/listinfo/ipv6
--------------------------------------------------------------------