ifup/down broken!!!

David Henderson dhenderson at digital-pipe.com
Mon Sep 26 15:34:44 UTC 2016


Noted, thanks for the info Danomi!

Dave


On 9/25/16, Danomi Manchego <danomimanchego123 at gmail.com> wrote:
> All,
>
> i thought I'd share a previous experience, in case it helped.  In one
> of our projects, we had multiple ethernet interfaces for a time,
> controlled by full-blown ifplugd, but using bb ifupdown.  On start-up,
> I would find that the two interfaces coming up at the same time would
> result in incomplete /var/run/ifstate file, because each ifplugd would
> use ifupdown to read the file, do work, then write out an update.  But
> there's no write lock in bb ifupdown, so the two interfaces can
> trample each other, losing state of one interface or the other.  Not
> so good.
>
> Good luck,
> Danomi -
>
>
> On Sat, Sep 24, 2016 at 5:09 PM, Denys Vlasenko
> <vda.linux at googlemail.com> wrote:
>> ..On Sat, Sep 24, 2016 at 7:41 PM, David Henderson
>> <dhenderson at digital-pipe.com> wrote:
>>> Good afternoon all!  This is to let those that are attempting to work
>>> with the busybox applets 'ifup' and 'ifdown' that their current status
>>> is broken in certain conditions and to let them know the unfortunate
>>> work around you must go through to make it work.
>>>
>>> Testing has shown that there are two conditions that must be meet in
>>> order for an 'ifup -a' call during boot to process correctly:
>>>
>>> 1) you must have a pre-existing /etc/network/interfaces file
>>
>>> 2) each adapter must have static network config information (e.g. no
>>> dhcp)
>>
>>> If those two conditions are true, then everything works as designed.
>>> Any alterations causes the applets to choke from an apparent issue
>>> writing to the /var/run/ifstate file.
>>
>>
>> Trying to reproduce.
>>
>> My /etc/network/interfaces is two lines:
>> iface lo inet loopback
>> iface eth0 inet dhcp
>>
>> I have these empty directories:
>> /etc/network/if-down.d
>> /etc/network/if-post-down.d
>> /etc/network/if-pre-up.d
>> /etc/network/if-up.d
>> /var/run
>>
>>
>> Booting a qemu machine:
>>
>> ./run-qemu /boot/vmlinuz-4.8.0-rc5+
>> [    0.000000] Linux version 4.8.0-rc5+ (root at localhost) (gcc version
>> 6.1.1 20160810 (Red Hat 6.1.1-5) (GCC) ) #7 SMP Sat Sep 17 23:24:30
>> CEST 2016
>> [    0.000000] Command line: panic=1 console=ttyS0
>> [    0.000000] x86/fpu: Legacy x87 FPU detected.
>> [    0.000000] x86/fpu: Using 'eager' FPU context switches.
>> [    0.000000] e820: BIOS-provided physical RAM map:
>> [    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff]
>> usable
>> ...
>> ...
>> [    1.761051] tsc: Refined TSC clocksource calibration: 2712.012 MHz
>> [    1.761931] clocksource: tsc: mask: 0xffffffffffffffff max_cycles:
>> 0x271791bffc3, max_idle_ns: 440795320414 ns
>> [    1.893550] input: ImExPS/2 BYD TouchPad as
>> /devices/platform/i8042/serio1/input/input3
>> [    2.771797] clocksource: Switched to clocksource tsc
>> Your current kernel is:
>> Linux (none) 4.8.0-rc5+ #7 SMP Sat Sep 17 23:24:30 CEST 2016 x86_64
>> GNU/Linux
>> I see following modules in current directory:
>> e1000.ko
>> e1000e.ko
>>
>>       (need to load e1000 module for eth0 to exist:)
>>
>> / # insmod e1000.ko
>> [   45.919343] e1000: Intel(R) PRO/1000 Network Driver - version
>> 7.3.21-k8-NAPI
>> [   45.919590] e1000: Copyright (c) 1999-2006 Intel Corporation.
>> [   46.412214] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11
>> [   46.706789] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit)
>> 52:54:00:12:34:56
>> [   46.707506] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network
>> Connection
>> [   46.714497] insmod (127) used greatest stack depth: 12872 bytes left
>>
>>       (ok, let's try it!!!)
>>
>> / # ifup eth0
>> [   50.696362] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
>> [   50.697526] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow
>> Control: RX
>> [   50.700412] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
>> udhcpc: started, v1.26.0.git
>> udhcpc: sending discover
>> udhcpc: sending select for 10.0.2.15
>> udhcpc: lease of 10.0.2.15 obtained, lease time 86400
>>
>> / # ip a
>> 1: lo: <LOOPBACK> mtu 65536 qdisc noop qlen 1
>>     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>> 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen
>> 1000
>>     link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
>>     inet6 fec0::5054:ff:fe12:3456/64 scope site tentative dynamic
>>        valid_lft 86400sec preferred_lft 14400sec
>>     inet6 fe80::5054:ff:fe12:3456/64 scope link
>>        valid_lft forever preferred_lft forever
>>
>> / # cat /var/run/ifstate
>> eth0=eth0
>>
>> / # ifup lo
>>
>> / # ip a
>> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1
>>     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>>     inet 127.0.0.1/8 scope host lo
>>        valid_lft forever preferred_lft forever
>>     inet6 ::1/128 scope host
>>        valid_lft forever preferred_lft forever
>> 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen
>> 1000
>>     link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
>>     inet6 fec0::5054:ff:fe12:3456/64 scope site dynamic
>>        valid_lft 86400sec preferred_lft 14400sec
>>     inet6 fe80::5054:ff:fe12:3456/64 scope link
>>        valid_lft forever preferred_lft forever
>>
>> / # cat /var/run/ifstate
>> eth0=eth0
>> lo=lo
>>
>>
>> So. Works for me.
>>
>>> The only solution I can see is
>>> that the burden of manually maintaining the /var/run/ifstate file is
>>> on the user/interface.
>>
>>
>> In my attempt at reproducing it, /var/run/ifstate was successfully
>> created.
>>
>> Please provide the LOG file from the following command:
>>
>> strace -oLOG -tt -f -s99 ifup eth0
>>
>> (You were already asked to provide this information)
>> _______________________________________________
>> busybox mailing list
>> busybox at busybox.net
>> http://lists.busybox.net/mailman/listinfo/busybox
>


More information about the busybox mailing list