wireless: allow set_retry ubus notify command to trigger a wdev restart
authorFelix Fietkau <nbd@nbd.name>
Fri, 30 Sep 2022 12:34:44 +0000 (14:34 +0200)
committerFelix Fietkau <nbd@nbd.name>
Mon, 19 Dec 2022 17:15:24 +0000 (18:15 +0100)
This can be used to retry bringing up a wireless device after receiving a
hotplug event

Signed-off-by: Felix Fietkau <nbd@nbd.name>
wireless.c

index bd847e72ab4005652a3bad28575ed59a5f2683a6..118f5a7cf135b836210a30ca4d8e3ffcc06df21d 100644 (file)
@@ -1403,10 +1403,11 @@ wireless_device_set_retry(struct wireless_device *wdev, struct blob_attr *data)
        struct blob_attr *val;
 
        blobmsg_parse(&retry_policy, 1, &val, blobmsg_data(data), blobmsg_data_len(data));
-       if (!val)
-               return UBUS_STATUS_INVALID_ARGUMENT;
-
-       wdev->retry = blobmsg_get_u32(val);
+       if (val)
+               wdev->retry = blobmsg_get_u32(val);
+       else
+               wdev->retry = WIRELESS_SETUP_RETRY;
+       __wireless_device_set_up(wdev, 0);
        netifd_log_message(L_NOTICE, "Wireless device '%s' set retry=%d\n", wdev->name, wdev->retry);
        return 0;
 }