summaryrefslogtreecommitdiff
path: root/system/busybox/0017-ifupdown-do-not-fail-if-interface-disappears-during-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'system/busybox/0017-ifupdown-do-not-fail-if-interface-disappears-during-.patch')
-rw-r--r--system/busybox/0017-ifupdown-do-not-fail-if-interface-disappears-during-.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/system/busybox/0017-ifupdown-do-not-fail-if-interface-disappears-during-.patch b/system/busybox/0017-ifupdown-do-not-fail-if-interface-disappears-during-.patch
new file mode 100644
index 000000000..bdf24b783
--- /dev/null
+++ b/system/busybox/0017-ifupdown-do-not-fail-if-interface-disappears-during-.patch
@@ -0,0 +1,45 @@
+From 444a2f6be54186ae9ade1f2c3d4356cd62a720c5 Mon Sep 17 00:00:00 2001
+From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+Date: Fri, 23 Mar 2018 14:56:52 +0200
+Subject: [PATCH] ifupdown: do not fail if interface disappears during ifdown
+
+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
+