Commit ff142781 authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

main/busybox: ifdown: do not fail if iface disappears

parent 3e798f2b
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
......@@ -3,7 +3,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.28.1
pkgrel=0
pkgrel=1
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://busybox.net
arch="all"
......@@ -35,6 +35,7 @@ source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2
0014-miscutils-microcom-Fixed-segfault.patch
0015-ash-introduce-a-config-option-to-search-current-dire.patch
0016-top-handle-much-larger-VSZ-values.patch
0017-ifupdown-do-not-fail-if-interface-disappears-during-.patch
acpid.logrotate
busyboxconfig
......@@ -195,6 +196,7 @@ a96aa81d2f0104b5c28f02e80b3f77dbce77af93c174c09015a34850474d69e42c160fc8061c62f0
4cbd38a3c2730ae38e34c5973bb63e40609c32f700d4943cc0e922394e8ee522d1512eb19c7885f5cee49834ab22b2594cb07164cacffefa39964a3b863f4e50 0014-miscutils-microcom-Fixed-segfault.patch
832eb44c52d2caad4bf6ea79fb17f10c116de3e90ed79038dabe3736d8e74507d1e0cb6f4f7689b4dd506b92437d8df7862038fc0213ecda259e40baf9d9b3de 0015-ash-introduce-a-config-option-to-search-current-dire.patch
185f11578dc3c3637f1acd1285c71b9e31f4244c57cd85b0848912c085a7a8c833d4c935ab1cadcb9852cf3185c7ffb08db8ea728fb19ab6e6fa90d89f13c75b 0016-top-handle-much-larger-VSZ-values.patch
d90d6b3406760fe3df6dbed46a0f4d1c02a69d5184ebc86d8c1692bc4576532127283ba3ff9a81e64f3660c279b8ee324dac7a426350873c45957067648651c6 0017-ifupdown-do-not-fail-if-interface-disappears-during-.patch
a9b1403c844c51934637215307dd9e2adb9458921047acff0d86dcf229b6e0027f4b2c6cdaa25a58407aad9d098fb5685d58eb5ff8d2aa3de4912cdea21fe54c acpid.logrotate
9c0ee35fcaa58a198bb471f48fa1e3b619a747eadca3b62a2921ac465dd1bfdfe8ad06a8d48bca92148729048eac50f9d69502212a9b2df7d16e49197ff10a50 busyboxconfig
075d49ffbc606c2572b4c810435640ff2189afa40d3ed2e655b1be1e75fa9cbd810e48b25b86e1f1c735cac0379b55734aaab1fa5dfde7e62de03b2d49a17c36 busyboxconfig-extras
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment