summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartin Schiller <ms@dev.tdt.de>2018-04-10 06:21:39 +0200
committerHans Dedecker <dedeckeh@gmail.com>2018-04-10 21:10:18 +0200
commit7aee60d2a0b4c588701361a55ef21f9cb3c902df (patch)
treebbdf1e43c71a0179040f0ba4ba1e249405a819a5
parent3dc8c916a94483bba2eed5ba34ccfc864866bb4e (diff)
interface: fix "ifup-failed" hotplug event handling
The ifup-failed event should only be triggered when the former interface state is IFS_SETUP. Otherwise, there will also be an ifup-failed event in the IFS_TEARDOWN stateif you do an manual ifdown <IFC>. Signed-off-by: Martin Schiller <ms@dev.tdt.de>
-rw-r--r--interface.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/interface.c b/interface.c
index 900a523..2a23984 100644
--- a/interface.c
+++ b/interface.c
@@ -267,10 +267,16 @@ mark_interface_down(struct interface *iface)
iface->link_up_event = false;
iface->state = IFS_DOWN;
- if (state == IFS_UP)
+ switch (state) {
+ case IFS_UP:
interface_event(iface, IFEV_DOWN);
- else
+ break;
+ case IFS_SETUP:
interface_event(iface, IFEV_UP_FAILED);
+ break;
+ default:
+ break;
+ }
interface_ip_set_enabled(&iface->config_ip, false);
interface_ip_set_enabled(&iface->proto_ip, false);
interface_ip_flush(&iface->proto_ip);