From 7aee60d2a0b4c588701361a55ef21f9cb3c902df Mon Sep 17 00:00:00 2001 From: Martin Schiller Date: Tue, 10 Apr 2018 06:21:39 +0200 Subject: [PATCH] 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 . Signed-off-by: Martin Schiller --- interface.c | 10 ++++++++-- 1 file 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); -- 2.25.1