Bug in bb 1.5.0 ifupdown applet

Natanael Copa natanael.copa at gmail.com
Tue May 1 15:51:11 UTC 2007


On Tue, 2007-05-01 at 00:27 +0000, Nathan Angelacos wrote:
> Hello,
> 
> The ifupdown applet in 1.5.0 appears to have a bug that was not present
> in 1.4.1.  The bug is that /var/run/ifstate is not updated with all
> interfaces if an interface stanza calls ifup statement to bring up a
> second interface.
>
> Given the following interfaces file:
> 
> iface lo inet static
>     address 127.0.0.1
>     netmask 255.0.0.0
>     up ifup tunl
>     down ifdown tunl
> 
> iface tunl inet manual
>     up modprobe ipip || true
>     up ip tun add tunl mode ipip local 127.0.0.1 remote 192.168.0.1
>     up ip link set tunl up
>     down ip link set tunl down
>     down ip tunl del
> 
> 
> "ifup lo" correctly brings up lo and the tunl interface.  However,
>  /var/run/ifstate only lists "lo=lo".

Which gives the effect that ifdown will fail to take down the tunl
interface as expected when running "ifdown lo"

I can confirm this. ifup/ifdown is not reentrant.

> An strace for "ifup lo" shows:
> 
> 1. the "parent" ifup reads /var/run/ifstate
> 2. the "parent" forks to run the child ifup
> 2. the "child" ifup reads /var/run/ifstate
> 3. the "child" writes its interface to /var/run/ifstate
> 4. the "child" exits
> 5. the "parent" writes its interface to /var/run/ifstate, using the info
> from step 1
> 
> That is, the parent does not re-read ifstate before writing.
> 
> Its not a simple case of re-reading /var/run/ifstate, since the code
> between the read (line 1122) and write (line 1262) could itself update
> the linked list.

I had a short look at the source. I don't think the fix is trivial but i
might be missing something.

It would be nice if this could be fixed in 1.5.1.

Thanks!

Natanael Copa




More information about the busybox mailing list