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

Re: How to solve race condition between IPv6 ifup and start of services?



On Sat, 2011-05-21 at 20:29 +0200, Marc Haber wrote:
> On Sat, 21 May 2011 14:31:45 +0100, Ben Hutchings
> <ben@decadent.org.uk> wrote:
> >On Sat, 2011-05-21 at 15:01 +0200, Marc Haber wrote:
> >> with the increasing deployment of IPv6 I begin to see an issue
> >> icreasingly often: When an interface is configured for IPv6, it takes
> >> a few seconds before the IPv6 address actually becomes available.
> >> Services that are started in this time window won't listen on IPv6,
> >> which may be unintended behavior. Many people see this behavior as a
> >> bug in the distribution, which is why I am addressing this issue here
> >> on -devel.
> >> 
> >> Unfortunately, it is non-trivial to find out whether my IPv6
> >> configuration has completed or not. How many addresses will be
> >> assigned to us via stateless autoconfig? Are we running with privacy
> >> extensions? Do we have additional static configuration?
> >> 
> >> The most "clean" solutions for this issue would be
> >> (a) Modify the services to notice when additional IP addresses come up
> >>     and listen there if the service is configured for that IP address
> >> (b) Parse the configuration of each service in the init script and
> >>     wait for the configured IP addresses to actually come up.
> >[...]
> >
> >(c) Set the IP_FREEBIND socket option before binding.
> 
> What does this do? And it needs changes to the software as well.

It allows the socket to be bound to an address that is not (yet) local.
It should be a relatively simple code change.  The down-side is that a
typo in the configured bind address no longer results in an error on
startup.

Network interfaces can come and go dynamically, and our packages should
not assume otherwise.  As an example, I configure lighttpd to listen on
lo and on a local bridge to VM guests.  The bridge is created only when
I actually start some guests, but I don't want lighttpd to wait for it
to be created, nor do I want to have to restart it after the bridge is
created (as I do now).

Ben.

-- 
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.

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


Reply to: