[OpenWrt-Devel] [PATCH 1/1] netifd: reload wireless device when config changes

Eduardo Abinader eduardo.abinader at riverbed.com
Mon Jul 25 09:38:46 EDT 2016


Based on config_state to reload, triggered by config changes,
make netifd to proceed accordingly, either started via wdev up or
netifd reload. Thus the restart of wdev would be based on actual
config changes, letting autostart aside from this.

Signed-off-by: Eduardo Abinader <eduardo.abinader at riverbed.com>
---
 wireless.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/wireless.c b/wireless.c
index a6e4fb0..3509095 100644
--- a/wireless.c
+++ b/wireless.c
@@ -284,7 +284,8 @@ __wireless_device_set_up(struct wireless_device *wdev)
 	if (wdev->disabled)
 		return;
 
-	if (wdev->state != IFS_DOWN || config_init)
+	if ((wdev->config_state != IFC_RELOAD) &&
+			(wdev->state != IFS_DOWN || config_init))
 		return;
 
 	free(wdev->prev_config);
@@ -310,11 +311,13 @@ wdev_handle_config_change(struct wireless_device *wdev)
 
 	switch(state) {
 	case IFC_NORMAL:
-	case IFC_RELOAD:
-		wdev->config_state = IFC_NORMAL;
 		if (wdev->autostart)
 			__wireless_device_set_up(wdev);
 		break;
+	case IFC_RELOAD:
+		__wireless_device_set_up(wdev);
+		wdev->config_state = IFC_NORMAL;
+		break;
 	case IFC_REMOVE:
 		wireless_device_free(wdev);
 		break;
-- 
2.5.0
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list