X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=ubus.c;h=bf7267239ccc7ab16625fc658f1a04cfcc015db7;hb=e627542ee5763b6810bf3f7e64e151a0326922aa;hp=1b1a4cd0c9a048ff313b81e6a7aa4527d77bf70f;hpb=cdc0e80300a465d507aba8e8d11be56366ebb6cd;p=project%2Fnetifd.git diff --git a/ubus.c b/ubus.c index 1b1a4cd..bf72672 100644 --- a/ubus.c +++ b/ubus.c @@ -44,8 +44,10 @@ netifd_handle_reload(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg) { - netifd_reload(); - return 0; + if (netifd_reload()) + return UBUS_STATUS_UNKNOWN_ERROR; + + return UBUS_STATUS_OK; } enum { @@ -127,7 +129,6 @@ netifd_add_dynamic(struct ubus_context *ctx, struct ubus_object *obj, struct blob_attr *tb[__DI_MAX]; struct interface *iface; struct blob_attr *config; - struct device *dev; blobmsg_parse(dynamic_policy, __DI_MAX, tb, blob_data(msg), blob_len(msg)); @@ -155,10 +156,6 @@ netifd_add_dynamic(struct ubus_context *ctx, struct ubus_object *obj, // Set interface as dynamic interface_set_dynamic(iface); - dev = iface->main_dev.dev; - if (!dev || !dev->default_config) - return UBUS_STATUS_UNKNOWN_ERROR; - return UBUS_STATUS_OK; error: @@ -376,6 +373,19 @@ netifd_handle_down(struct ubus_context *ctx, struct ubus_object *obj, return 0; } +static int +netifd_handle_renew(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct interface *iface; + + iface = container_of(obj, struct interface, ubus); + interface_renew(iface); + + return 0; +} + static void netifd_add_interface_errors(struct blob_buf *b, struct interface *iface) { @@ -912,6 +922,7 @@ netifd_handle_set_data(struct ubus_context *ctx, struct ubus_object *obj, static struct ubus_method iface_object_methods[] = { { .name = "up", .handler = netifd_handle_up }, { .name = "down", .handler = netifd_handle_down }, + { .name = "renew", .handler = netifd_handle_renew }, { .name = "status", .handler = netifd_handle_status }, { .name = "prepare", .handler = netifd_handle_iface_prepare }, { .name = "dump", .handler = netifd_handle_dump },