ifupdown problem

Martin Townsend mtownsend1973 at gmail.com
Mon Sep 19 15:58:59 UTC 2016


Hi,

any thoughts on this??? shall I submit as a patch??


On Tue, Sep 6, 2016 at 2:11 PM, Martin Townsend <mtownsend1973 at gmail.com> wrote:
> Hi,
>
> I'm using busybox with ENABLE_FEATURE_IFUPDOWN_IP and when using
> ifdown with a virtual interface it takes down the primary interface as
> well.  For our board we setup eth0:0 on a 10.10.10.x/29 network and
> using ifup eth0:0 does the following:
> ip addr add 10.10.10.9/29 dev eth0:0 label eth0:0
> ip link set eth0:0 up
> run-parts /etc/network/if-up.d
>
> and ip addr show gives us
> ...
> 2 : eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
> state UP group default qlen 1000
>     link/ether a0:f6:fd:18:2b:13 brd ff:ff:ff:ff:ff:ff
>     inet 172.27.105.10/22 brd 172.27.107.255 scope global eth0
>        valid_lft forever preferred_lft forever
>     inet 10.10.10.9/29 scope global eth0:0
>        valid_lft forever preferred_lft forever
>     inet6 fe80::a2f6:fdff:fe18:2b13/64 scope link
>        valid_lft forever preferred_lft forever
>
>
> Taking it down runs
>
> ip addr flush dev eth0:0
> ip link set eth0:0 down
> run-parts /etc/network/if-post-down.d
>
> The problem is ip addr flush dev eth0:0 removes all ip addresses from
> eth0.  You can see this if you run
> ip -stat -stat addr flush dev eth0:0
>
> 2: eth0    inet 172.27.105.10/22 brd 172.27.107.255 scope global eth0
>        valid_lft forever preferred_lft forever
> 2: eth0    inet 10.10.10.9/29 scope global eth0:0
>        valid_lft forever preferred_lft forever
> 2: eth0    inet6 fe80::a2f6:fdff:fe18:2b13/64 scope link
>        valid_lft forever preferred_lft forever
>
> *** Round 1, deleting 3 addresses ***
> *** Flush is complete after 1 round ***
>
> To work around this I have added the following patch which adds a
> label to the flush command so only flush the eth0:0 address:
>
> As I'm no networking expert is this a valid fix? if not what's the
> correct way to handle virtual interfaces.
>
> I've also tried the switch to use ifconfig and this also fails for a
> completely different reason and it's because you can't run 'if config
> eth0:0 up' before using ifconfig eth0:0 10.10.10.9 etc.."
> You get "SIOCSIFFLAGS: Cannot assign requested address".  As it
> attempts to run all commands you do actually get the interface and if
> you run ifup eth0:0 again it will work.  I see there is a reason for
> running the commands in this order so I don't know what the fix would
> be for this one.
>
> Best Regards,
> Martin.
>
> Index: busybox-1.24.1/networking/ifupdown.c
> ===================================================================
> --- busybox-1.24.1.orig/networking/ifupdown.c 2016-09-06
> 13:39:03.264378441 +0100
> +++ busybox-1.24.1/networking/ifupdown.c 2016-09-06 13:39:59.288380571 +0100
> @@ -501,7 +501,7 @@
>  {
>   int result;
>  # if ENABLE_FEATURE_IFUPDOWN_IP
> - result = execute("ip addr flush dev %iface%", ifd, exec);
> + result = execute("ip addr flush dev %iface% [[ label %label%]]", ifd, exec);
>   result += execute("ip link set %iface% down", ifd, exec);
>  # else
>   /* result = execute("[[route del default gw %gateway% %iface%]]",
> ifd, exec); */


More information about the busybox mailing list