From: Felix Fietkau Date: Thu, 15 May 2014 19:08:18 +0000 (+0200) Subject: wireless: fix cancelling setup X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e784303c4ca8ee86e57521a00ef5f9d0e98617f8;p=oweals%2Fnetifd.git wireless: fix cancelling setup Signed-off-by: Felix Fietkau --- diff --git a/wireless.c b/wireless.c index f3c9549..0e293a0 100644 --- a/wireless.c +++ b/wireless.c @@ -316,17 +316,6 @@ wireless_device_mark_down(struct wireless_device *wdev) wdev_handle_config_change(wdev); } -static void -wireless_device_mark_up(struct wireless_device *wdev) -{ - struct wireless_interface *vif; - - D(WIRELESS, "Wireless device '%s' is now up\n", wdev->name); - wdev->state = IFS_UP; - vlist_for_each_element(&wdev->interfaces, vif, node) - wireless_interface_handle_link(vif, true); -} - static void wireless_device_setup_timeout(struct uloop_timeout *timeout) { @@ -360,6 +349,23 @@ __wireless_device_set_down(struct wireless_device *wdev) wireless_device_run_handler(wdev, false); } +static void +wireless_device_mark_up(struct wireless_device *wdev) +{ + struct wireless_interface *vif; + + if (wdev->cancel) { + wdev->cancel = false; + __wireless_device_set_down(wdev); + return; + } + + D(WIRELESS, "Wireless device '%s' is now up\n", wdev->name); + wdev->state = IFS_UP; + vlist_for_each_element(&wdev->interfaces, vif, node) + wireless_interface_handle_link(vif, true); +} + static void wireless_device_retry_setup(struct wireless_device *wdev) { @@ -897,9 +903,6 @@ wireless_device_notify(struct wireless_device *wdev, struct blob_attr *data, if (wdev->state != IFS_SETUP) return UBUS_STATUS_PERMISSION_DENIED; - if (wdev->cancel) - return 0; - wireless_device_mark_up(wdev); break; case NOTIFY_CMD_SET_DATA: