diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2014-03-10 16:27:53 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-03-11 10:24:21 +0100 |
commit | b114b86c70766f67f503077ad1de013c17fbf366 (patch) | |
tree | 21ddc8e3249917184561fa0d6333cc9ee0b8fe82 | |
parent | ceeed831285357d125f71b9a3b4c27de50af49e6 (diff) |
netifd: Set interface state in teardown state before launching an interface event
Interface state needs to be set in teardown state before launching an interface event otherwise the up state will be reported as true in the ubus interface notify message
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
-rw-r--r-- | interface.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/interface.c b/interface.c index 43ba773..39460e4 100644 --- a/interface.c +++ b/interface.c @@ -222,11 +222,14 @@ mark_interface_down(struct interface *iface) void __interface_set_down(struct interface *iface, bool force) { - switch (iface->state) { + enum interface_state state = iface->state; + switch (state) { case IFS_UP: - interface_event(iface, IFEV_DOWN); case IFS_SETUP: iface->state = IFS_TEARDOWN; + if (state == IFS_UP) + interface_event(iface, IFEV_DOWN); + interface_proto_event(iface->proto, PROTO_CMD_TEARDOWN, force); if (force) interface_flush_state(iface); |