[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: IPv6, tentative addresses, bind(), wheezy

On Sun, 2012-11-04 at 10:18 +0100, Marc Haber wrote:
> On Fri, 2 Nov 2012 23:24:55 +0100, martin f krafft
> <madduck@debian.org> wrote:
> >The reason is that by the time bind() is called, the IPv6 address
> >(configured with /e/n/i inet6 static, which unbound should listen
> >on) is not yet ready, but "tentative", so the bind() call fails.
> Last time when I asked a question along those lines (with bind as the
> application), the answer was the usual Debian-like "your application
> is broken, have upstream convert the app to an event-based approach
> and do not bother us".
> This answer is partially right, applications need to be able to handle
> dynamically changing IP addresses at run-time to properly support
> IPv6. If they don't, one of the major advantages of IPv6 ("renumbering
> is easy") is lost. This goes especially if the app's configuration
> contains IP addresses.
> The problem is, that the distributions, IMO, need to work around these
> shortcomings until the applications are eventually fixed (which might
> never happen). The socket API also has several shortcomings which
> makes this approach harder to do. For examle, there is no semantic for
> operations like "listen on this host address in all prefixes that the
> host system is aware of", probably written along the line of
> ::224:d7ff:fed0:5adc.

This wouldn't solve the problem that the UDP servers have, which is that
they need to be able to send replies from the same address the request
was sent to.  The old portable way to do this is to bind a socket to
each local address and reply using whichever socket the request was
received on.  That's why they enumerate local addresses rather than just
binding to and ::.

For IPv6 the IPV6_PKTINFO socket option described in RFC 3542 allows
applications to get and set the local address per-packet; this is
hopefully implemented on most Unix-like systems.

For IPv4, Linux has a similar IP_PKTINFO option whereas BSD and Solaris
provide the options IP_{RECVDST,SENDSRC}ADDR.  This lack of portability
may explain why more applications have not adopted this approach yet.


Ben Hutchings
No political challenge can be met by shopping. - George Monbiot

Attachment: signature.asc
Description: This is a digitally signed message part

Reply to: