return wdev;
}
+static int
+netifd_handle_wdev_reconf(struct ubus_context *ctx, struct ubus_object *obj,
+ struct ubus_request_data *req, const char *method,
+ struct blob_attr *msg)
+{
+ struct wireless_device *wdev;
+ int ret;
+
+ wdev = get_wdev(msg, &ret);
+ if (ret == UBUS_STATUS_NOT_FOUND)
+ return ret;
+
+ if (wdev) {
+ wireless_device_reconf(wdev);
+ } else {
+ vlist_for_each_element(&wireless_devices, wdev, node)
+ wireless_device_reconf(wdev);
+ }
+
+ return 0;
+}
+
static int
netifd_handle_wdev_up(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
static struct ubus_method wireless_object_methods[] = {
{ .name = "up", .handler = netifd_handle_wdev_up },
{ .name = "down", .handler = netifd_handle_wdev_down },
+ { .name = "reconf", .handler = netifd_handle_wdev_reconf },
{ .name = "status", .handler = netifd_handle_wdev_status },
{ .name = "notify", .handler = netifd_handle_wdev_notify },
{ .name = "get_validate", .handler = netifd_handle_wdev_get_validate },
}
static void
-__wireless_device_set_up(struct wireless_device *wdev)
+__wireless_device_set_up(struct wireless_device *wdev, int force)
{
if (wdev->disabled)
return;
if (!wdev->autostart)
return;
- if (wdev->state != IFS_DOWN || config_init)
+ if (!force && (wdev->state != IFS_DOWN || config_init))
return;
free(wdev->prev_config);
switch(state) {
case IFC_NORMAL:
case IFC_RELOAD:
- __wireless_device_set_up(wdev);
+ __wireless_device_set_up(wdev, 0);
wdev->config_state = IFC_NORMAL;
break;
{
wdev->retry = WIRELESS_SETUP_RETRY;
wdev->autostart = true;
- __wireless_device_set_up(wdev);
+ __wireless_device_set_up(wdev, 0);
+}
+
+void
+wireless_device_reconf(struct wireless_device *wdev)
+{
+ wdev->retry = WIRELESS_SETUP_RETRY;
+ wdev->autostart = true;
+ __wireless_device_set_up(wdev, 1);
}
static void
struct wireless_device *wdev;
vlist_for_each_element(&wireless_devices, wdev, node)
- __wireless_device_set_up(wdev);
+ __wireless_device_set_up(wdev, 0);
}
void wireless_device_create(struct wireless_driver *drv, const char *name, struct blob_attr *data);
void wireless_device_set_up(struct wireless_device *wdev);
void wireless_device_set_down(struct wireless_device *wdev);
+void wireless_device_reconf(struct wireless_device *wdev);
void wireless_device_status(struct wireless_device *wdev, struct blob_buf *b);
void wireless_device_get_validate(struct wireless_device *wdev, struct blob_buf *b);
void wireless_interface_create(struct wireless_device *wdev, struct blob_attr *data, const char *section);