aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/ifupdown.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 534c9f0c7..5481134e5 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -138,6 +138,7 @@
138//usage: "\n -v Print out what would happen before doing it" 138//usage: "\n -v Print out what would happen before doing it"
139//usage: "\n -f Force deconfiguration" 139//usage: "\n -f Force deconfiguration"
140 140
141#include <net/if.h>
141#include "libbb.h" 142#include "libbb.h"
142#include "common_bufsiz.h" 143#include "common_bufsiz.h"
143/* After libbb.h, since it needs sys/types.h on some systems */ 144/* After libbb.h, since it needs sys/types.h on some systems */
@@ -503,6 +504,8 @@ static int FAST_FUNC static_up6(struct interface_defn_t *ifd, execfn *exec)
503 504
504static int FAST_FUNC static_down6(struct interface_defn_t *ifd, execfn *exec) 505static int FAST_FUNC static_down6(struct interface_defn_t *ifd, execfn *exec)
505{ 506{
507 if (!if_nametoindex(ifd->iface))
508 return 1; /* already gone */
506# if ENABLE_FEATURE_IFUPDOWN_IP 509# if ENABLE_FEATURE_IFUPDOWN_IP
507 return execute("ip link set %iface% down", ifd, exec); 510 return execute("ip link set %iface% down", ifd, exec);
508# else 511# else
@@ -598,6 +601,9 @@ static int FAST_FUNC static_up(struct interface_defn_t *ifd, execfn *exec)
598static int FAST_FUNC static_down(struct interface_defn_t *ifd, execfn *exec) 601static int FAST_FUNC static_down(struct interface_defn_t *ifd, execfn *exec)
599{ 602{
600 int result; 603 int result;
604
605 if (!if_nametoindex(ifd->iface))
606 return 2; /* already gone */
601# if ENABLE_FEATURE_IFUPDOWN_IP 607# if ENABLE_FEATURE_IFUPDOWN_IP
602 /* Optional "label LBL" is necessary if interface is an alias (eth0:0), 608 /* Optional "label LBL" is necessary if interface is an alias (eth0:0),
603 * otherwise "ip addr flush dev eth0:0" flushes all addresses on eth0. 609 * otherwise "ip addr flush dev eth0:0" flushes all addresses on eth0.