diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-12-01 23:47:47 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-12-01 23:47:47 +0100 |
commit | 557c36d169c82e025c633a1f3ef935df40d10784 (patch) | |
tree | 55be8b441996bf585fee582db7161ed16ffe7b1e /wireless.c | |
parent | cc30a45f85a647921bc5eff0ae947c9aa786ce4b (diff) |
wireless: fix reload of active interfaces
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'wireless.c')
-rw-r--r-- | wireless.c | 57 |
1 files changed, 27 insertions, 30 deletions
@@ -248,6 +248,32 @@ __wireless_device_set_up(struct wireless_device *wdev) } static void +wireless_device_free(struct wireless_device *wdev) +{ + vlist_flush_all(&wdev->interfaces); + free(wdev->config); + free(wdev); +} + +static void +wdev_handle_config_change(struct wireless_device *wdev) +{ + enum interface_config_state state = wdev->config_state; + + wdev->config_state = IFC_NORMAL; + switch(state) { + case IFC_NORMAL: + case IFC_RELOAD: + if (wdev->autostart) + __wireless_device_set_up(wdev); + break; + case IFC_REMOVE: + wireless_device_free(wdev); + break; + } +} + +static void wireless_device_mark_down(struct wireless_device *wdev) { struct wireless_interface *vif; @@ -262,9 +288,7 @@ wireless_device_mark_down(struct wireless_device *wdev) wdev->cancel = false; wdev->state = IFS_DOWN; wireless_device_free_state(wdev); - - if (wdev->autostart) - __wireless_device_set_up(wdev); + wdev_handle_config_change(wdev); } static void @@ -345,33 +369,6 @@ wireless_device_set_down(struct wireless_device *wdev) } static void -wireless_device_free(struct wireless_device *wdev) -{ - vlist_flush_all(&wdev->interfaces); - free(wdev->config); - free(wdev); -} - -static void -wdev_handle_config_change(struct wireless_device *wdev) -{ - enum interface_config_state state = wdev->config_state; - - wdev->config_state = IFC_NORMAL; - switch(state) { - case IFC_NORMAL: - break; - case IFC_RELOAD: - if (wdev->autostart) - __wireless_device_set_up(wdev); - break; - case IFC_REMOVE: - wireless_device_free(wdev); - break; - } -} - -static void wdev_set_config_state(struct wireless_device *wdev, enum interface_config_state s) { enum interface_config_state old_state = wdev->config_state; |