Comment 6 for bug 20073

Revision history for this message
Thomas Hood (jdthood) wrote :

(In reply to comment #5)
> there is a huge race condition on bringing up the
> interfaces. The net.rc script sleeps waiting for a file to be removed, but by
> the time it has reacted, some other init scripts may have been called that
> needed the network to be up.

It is instances of the _net.ifup_ script, started by net.agent, which sleep
waiting for a flag file (net.agent) to be _created_.

The reason for the wait loop is that the networking subsystem is initialized
by the carefully crafted sequence of boot scripts leading up to and
including S40networking; hotplug cannot bring up any interfaces before that;
however, net.agent can get run earlier in the boot sequence; so it has to
spawn children that wait.

There is no race between net.ifup and boot scripts. If there is a problem
with boot scripts then it is their failing to observe this rule: Services
must not make assumptions about when hot plugged network interfaces will
become available.

If one has a hot plugged network interface and there are things that should
happen when the interface is created then those things should be executed
by hotplug or udev hooks, not by boot scripts.

It looks as if there is a race between multiple instances of net.ifup.
This is only a race because ifrename is being used in a way that makes
it vulnerable; that is, it is used to assign names to interfaces that
lie in the namespace used by the kernel. The race is then:

   eth0 created... ...eth0 renamed to 'eth1' (fails)
                  eth1 created... ...eth1 renamed to
'eth0' (fails)

If a separate namespace is used then no race occurs:

   eth0 created... ...eth0 renamed to ethfoo (succeeds)
                  eth1 created... ...eth1 renamed to
'ethbar' (succeeds)

This bug has been marked as a duplicate of bug 7050.