[LEDE-DEV] [PATCH V4] netifd: track when wdev setup fails

Felix Fietkau nbd at nbd.name
Thu Aug 11 10:27:08 PDT 2016


On 2016-08-11 17:22, Eduardo Abinader wrote:
> When netifd failed to load a valid configuration, after an invalid one,
> it was not possible to setup the wireless device. This patch
> aims to track this situation and behave acordingly, by keeping
> track of failed setup without affecting autostart behavior. Also
> block the restart of the wdev, when not applied.
> 
> Signed-off-by: Eduardo Abinader <eduardoabinader at gmail.com>
> ---
>  wireless.c | 19 ++++++++++++++++---
>  wireless.h |  1 +
>  2 files changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/wireless.c b/wireless.c
> index 34dd328..67c87f6 100644
> --- a/wireless.c
> +++ b/wireless.c
> @@ -388,6 +394,10 @@ wireless_device_mark_up(struct wireless_device *wdev)
>  
>  	D(WIRELESS, "Wireless device '%s' is now up\n", wdev->name);
>  	wdev->state = IFS_UP;
> +
> +	if (wdev->retry_setup_failed)
> +		wdev->retry_setup_failed = false;
> +
>  	vlist_for_each_element(&wdev->interfaces, vif, node)
>  		wireless_interface_handle_link(vif, true);
>  }
wdev->retry_setup_failed = false needs to be moved to
wdev_change_config(). You can also make it unconditional, testing if
it's true before clearing it is unnecessary.

> @@ -681,6 +692,7 @@ wireless_device_create(struct wireless_driver *drv, const char *name, struct blo
>  	wdev->config_state = IFC_NORMAL;
>  	wdev->name = strcpy(name_buf, name);
>  	wdev->config = data;
> +	wdev->retry_setup_failed = false;
>  	wdev->config_autostart = true;
>  	wdev->autostart = wdev->config_autostart;
>  	INIT_LIST_HEAD(&wdev->script_proc);
> @@ -993,4 +1005,5 @@ wireless_start_pending(void)
>  	vlist_for_each_element(&wireless_devices, wdev, node)
>  		if (wdev->autostart)
>  			__wireless_device_set_up(wdev);
> +
>  }
Please remove this empty line. You can also get rid of the
wdev->autostart check here, since you moved it to __wireless_device_set_up.

- Felix



More information about the Lede-dev mailing list