[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH] ifupdown: do not fail if interface disappears during ifdown
From: Denys Vlasenko <vda.linux () googlemail ! com>
Date: 2018-03-27 22:03:22
Message-ID: CAK1hOcOvXufN0jaGoAFTiUCrfA6H3AnqBcaJ0hGhjgkUVvBcLg () mail ! gmail ! com
[Download RAW message or body]
applied, thanks!
On Fri, Mar 23, 2018 at 2:45 PM, Kaarle Ritvanen
<kaarle.ritvanen@datakunkku.fi> wrote:
> Interface may not exist because it got deleted by an ifdown hook script
> earlier. This may happen when a virtual interface, such as VLAN, has multiple
> iface blocks defined.
>
> Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
> ---
> networking/ifupdown.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/networking/ifupdown.c b/networking/ifupdown.c
> index 534c9f0c7..35d13c5e1 100644
> --- a/networking/ifupdown.c
> +++ b/networking/ifupdown.c
> @@ -141,6 +141,7 @@
> #include "libbb.h"
> #include "common_bufsiz.h"
> /* After libbb.h, since it needs sys/types.h on some systems */
> +#include <net/if.h>
> #include <sys/utsname.h>
> #include <fnmatch.h>
>
> @@ -503,6 +504,7 @@ static int FAST_FUNC static_up6(struct interface_defn_t *ifd, execfn *exec)
>
> static int FAST_FUNC static_down6(struct interface_defn_t *ifd, execfn *exec)
> {
> + if (!if_nametoindex(ifd->iface)) return 1;
> # if ENABLE_FEATURE_IFUPDOWN_IP
> return execute("ip link set %iface% down", ifd, exec);
> # else
> @@ -598,6 +600,7 @@ static int FAST_FUNC static_up(struct interface_defn_t *ifd, execfn *exec)
> static int FAST_FUNC static_down(struct interface_defn_t *ifd, execfn *exec)
> {
> int result;
> + if (!if_nametoindex(ifd->iface)) return 2;
> # if ENABLE_FEATURE_IFUPDOWN_IP
> /* Optional "label LBL" is necessary if interface is an alias (eth0:0),
> * otherwise "ip addr flush dev eth0:0" flushes all addresses on eth0.
> --
> 2.14.3
>
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic