ubus: use local "blob_buf" in uh_ubus_handle_request_object()
[project/uhttpd.git] / ubus.c
1 /*
2 * uhttpd - Tiny single-threaded httpd
3 *
4 * Copyright (C) 2010-2013 Jo-Philipp Wich <xm@subsignal.org>
5 * Copyright (C) 2013 Felix Fietkau <nbd@openwrt.org>
6 *
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 #include <libubox/blobmsg.h>
21 #include <libubox/blobmsg_json.h>
22 #include <libubox/avl.h>
23 #include <libubox/avl-cmp.h>
24 #include <stdio.h>
25 #include <poll.h>
26
27 #include "uhttpd.h"
28 #include "plugin.h"
29
30 static const struct uhttpd_ops *ops;
31 static struct config *_conf;
32 #define conf (*_conf)
33
34 static struct ubus_context *ctx;
35 static struct blob_buf buf;
36
37 #define UH_UBUS_MAX_POST_SIZE 65536
38 #define UH_UBUS_DEFAULT_SID "00000000000000000000000000000000"
39
40 enum {
41 RPC_JSONRPC,
42 RPC_METHOD,
43 RPC_PARAMS,
44 RPC_ID,
45 __RPC_MAX,
46 };
47
48 static const struct blobmsg_policy rpc_policy[__RPC_MAX] = {
49 [RPC_JSONRPC] = { .name = "jsonrpc", .type = BLOBMSG_TYPE_STRING },
50 [RPC_METHOD] = { .name = "method", .type = BLOBMSG_TYPE_STRING },
51 [RPC_PARAMS] = { .name = "params", .type = BLOBMSG_TYPE_UNSPEC },
52 [RPC_ID] = { .name = "id", .type = BLOBMSG_TYPE_UNSPEC },
53 };
54
55 enum {
56 SES_ACCESS,
57 __SES_MAX,
58 };
59
60 static const struct blobmsg_policy ses_policy[__SES_MAX] = {
61 [SES_ACCESS] = { .name = "access", .type = BLOBMSG_TYPE_BOOL },
62 };
63
64 struct rpc_data {
65 struct blob_attr *id;
66 const char *sid;
67 const char *method;
68 const char *object;
69 const char *function;
70 struct blob_attr *data;
71 struct blob_attr *params;
72 };
73
74 struct list_data {
75 bool verbose;
76 struct blob_buf *buf;
77 };
78
79 enum rpc_error {
80 ERROR_PARSE,
81 ERROR_REQUEST,
82 ERROR_METHOD,
83 ERROR_PARAMS,
84 ERROR_INTERNAL,
85 ERROR_OBJECT,
86 ERROR_SESSION,
87 ERROR_ACCESS,
88 ERROR_TIMEOUT,
89 __ERROR_MAX
90 };
91
92 static const struct {
93 int code;
94 const char *msg;
95 } json_errors[__ERROR_MAX] = {
96 [ERROR_PARSE] = { -32700, "Parse error" },
97 [ERROR_REQUEST] = { -32600, "Invalid request" },
98 [ERROR_METHOD] = { -32601, "Method not found" },
99 [ERROR_PARAMS] = { -32602, "Invalid parameters" },
100 [ERROR_INTERNAL] = { -32603, "Internal error" },
101 [ERROR_OBJECT] = { -32000, "Object not found" },
102 [ERROR_SESSION] = { -32001, "Session not found" },
103 [ERROR_ACCESS] = { -32002, "Access denied" },
104 [ERROR_TIMEOUT] = { -32003, "ubus request timed out" },
105 };
106
107 enum cors_hdr {
108 HDR_ORIGIN,
109 HDR_ACCESS_CONTROL_REQUEST_METHOD,
110 HDR_ACCESS_CONTROL_REQUEST_HEADERS,
111 __HDR_MAX
112 };
113
114 static void __uh_ubus_next_batched_request(struct uloop_timeout *timeout);
115
116 static void uh_ubus_next_batched_request(struct client *cl)
117 {
118 struct dispatch_ubus *du = &cl->dispatch.ubus;
119
120 du->timeout.cb = __uh_ubus_next_batched_request;
121 uloop_timeout_set(&du->timeout, 1);
122 }
123
124 static void uh_ubus_add_cors_headers(struct client *cl)
125 {
126 struct blob_attr *tb[__HDR_MAX];
127 static const struct blobmsg_policy hdr_policy[__HDR_MAX] = {
128 [HDR_ORIGIN] = { "origin", BLOBMSG_TYPE_STRING },
129 [HDR_ACCESS_CONTROL_REQUEST_METHOD] = { "access-control-request-method", BLOBMSG_TYPE_STRING },
130 [HDR_ACCESS_CONTROL_REQUEST_HEADERS] = { "access-control-request-headers", BLOBMSG_TYPE_STRING },
131 };
132
133 blobmsg_parse(hdr_policy, __HDR_MAX, tb, blob_data(cl->hdr.head), blob_len(cl->hdr.head));
134
135 if (!tb[HDR_ORIGIN])
136 return;
137
138 if (tb[HDR_ACCESS_CONTROL_REQUEST_METHOD])
139 {
140 char *hdr = (char *) blobmsg_data(tb[HDR_ACCESS_CONTROL_REQUEST_METHOD]);
141
142 if (strcmp(hdr, "POST") && strcmp(hdr, "OPTIONS"))
143 return;
144 }
145
146 ustream_printf(cl->us, "Access-Control-Allow-Origin: %s\r\n",
147 blobmsg_get_string(tb[HDR_ORIGIN]));
148
149 if (tb[HDR_ACCESS_CONTROL_REQUEST_HEADERS])
150 ustream_printf(cl->us, "Access-Control-Allow-Headers: %s\r\n",
151 blobmsg_get_string(tb[HDR_ACCESS_CONTROL_REQUEST_HEADERS]));
152
153 ustream_printf(cl->us, "Access-Control-Allow-Methods: POST, OPTIONS\r\n");
154 ustream_printf(cl->us, "Access-Control-Allow-Credentials: true\r\n");
155 }
156
157 static void uh_ubus_send_header(struct client *cl)
158 {
159 ops->http_header(cl, 200, "OK");
160
161 if (conf.ubus_cors)
162 uh_ubus_add_cors_headers(cl);
163
164 ustream_printf(cl->us, "Content-Type: application/json\r\n");
165
166 if (cl->request.method == UH_HTTP_MSG_OPTIONS)
167 ustream_printf(cl->us, "Content-Length: 0\r\n");
168
169 ustream_printf(cl->us, "\r\n");
170 }
171
172 static void uh_ubus_send_response(struct client *cl)
173 {
174 struct dispatch_ubus *du = &cl->dispatch.ubus;
175 const char *sep = "";
176 char *str;
177
178 if (du->array && du->array_idx > 1)
179 sep = ",";
180
181 str = blobmsg_format_json(buf.head, true);
182 ops->chunk_printf(cl, "%s%s", sep, str);
183 free(str);
184
185 du->jsobj_cur = NULL;
186 if (du->array)
187 uh_ubus_next_batched_request(cl);
188 else
189 return ops->request_done(cl);
190 }
191
192 static void uh_ubus_init_response(struct client *cl)
193 {
194 struct dispatch_ubus *du = &cl->dispatch.ubus;
195 struct json_object *obj = du->jsobj_cur, *obj2 = NULL;
196
197 blobmsg_add_string(&buf, "jsonrpc", "2.0");
198
199 if (obj)
200 json_object_object_get_ex(obj, "id", &obj2);
201
202 if (obj2)
203 blobmsg_add_json_element(&buf, "id", obj2);
204 else
205 blobmsg_add_field(&buf, BLOBMSG_TYPE_UNSPEC, "id", NULL, 0);
206 }
207
208 static void uh_ubus_json_error(struct client *cl, enum rpc_error type)
209 {
210 void *c;
211
212 uh_ubus_init_response(cl);
213 c = blobmsg_open_table(&buf, "error");
214 blobmsg_add_u32(&buf, "code", json_errors[type].code);
215 blobmsg_add_string(&buf, "message", json_errors[type].msg);
216 blobmsg_close_table(&buf, c);
217 uh_ubus_send_response(cl);
218 }
219
220 static void
221 uh_ubus_request_data_cb(struct ubus_request *req, int type, struct blob_attr *msg)
222 {
223 struct dispatch_ubus *du = container_of(req, struct dispatch_ubus, req);
224
225 blobmsg_add_field(&du->buf, BLOBMSG_TYPE_TABLE, "", blob_data(msg), blob_len(msg));
226 }
227
228 static void
229 uh_ubus_request_cb(struct ubus_request *req, int ret)
230 {
231 struct dispatch_ubus *du = container_of(req, struct dispatch_ubus, req);
232 struct client *cl = container_of(du, struct client, dispatch.ubus);
233 struct blob_attr *cur;
234 void *r;
235 int rem;
236
237 uloop_timeout_cancel(&du->timeout);
238 uh_ubus_init_response(cl);
239 r = blobmsg_open_array(&buf, "result");
240 blobmsg_add_u32(&buf, "", ret);
241 blob_for_each_attr(cur, du->buf.head, rem)
242 blobmsg_add_blob(&buf, cur);
243 blobmsg_close_array(&buf, r);
244 uh_ubus_send_response(cl);
245 }
246
247 static void
248 uh_ubus_timeout_cb(struct uloop_timeout *timeout)
249 {
250 struct dispatch_ubus *du = container_of(timeout, struct dispatch_ubus, timeout);
251 struct client *cl = container_of(du, struct client, dispatch.ubus);
252
253 ubus_abort_request(ctx, &du->req);
254 uh_ubus_json_error(cl, ERROR_TIMEOUT);
255 }
256
257 static void uh_ubus_close_fds(struct client *cl)
258 {
259 if (ctx->sock.fd < 0)
260 return;
261
262 close(ctx->sock.fd);
263 ctx->sock.fd = -1;
264 }
265
266 static void uh_ubus_request_free(struct client *cl)
267 {
268 struct dispatch_ubus *du = &cl->dispatch.ubus;
269
270 blob_buf_free(&du->buf);
271 uloop_timeout_cancel(&du->timeout);
272
273 if (du->jsobj)
274 json_object_put(du->jsobj);
275
276 if (du->jstok)
277 json_tokener_free(du->jstok);
278
279 if (du->req_pending)
280 ubus_abort_request(ctx, &du->req);
281 }
282
283 static void uh_ubus_single_error(struct client *cl, enum rpc_error type)
284 {
285 uh_ubus_send_header(cl);
286 uh_ubus_json_error(cl, type);
287 ops->request_done(cl);
288 }
289
290 static void uh_ubus_send_request(struct client *cl, const char *sid, struct blob_attr *args)
291 {
292 struct dispatch *d = &cl->dispatch;
293 struct dispatch_ubus *du = &d->ubus;
294 struct blob_attr *cur;
295 static struct blob_buf req;
296 int ret, rem;
297
298 blob_buf_init(&req, 0);
299 blobmsg_for_each_attr(cur, args, rem) {
300 if (!strcmp(blobmsg_name(cur), "ubus_rpc_session"))
301 return uh_ubus_json_error(cl, ERROR_PARAMS);
302 blobmsg_add_blob(&req, cur);
303 }
304
305 blobmsg_add_string(&req, "ubus_rpc_session", sid);
306
307 blob_buf_init(&du->buf, 0);
308 memset(&du->req, 0, sizeof(du->req));
309 ret = ubus_invoke_async(ctx, du->obj, du->func, req.head, &du->req);
310 if (ret)
311 return uh_ubus_json_error(cl, ERROR_INTERNAL);
312
313 du->req.data_cb = uh_ubus_request_data_cb;
314 du->req.complete_cb = uh_ubus_request_cb;
315 ubus_complete_request_async(ctx, &du->req);
316
317 du->timeout.cb = uh_ubus_timeout_cb;
318 uloop_timeout_set(&du->timeout, conf.script_timeout * 1000);
319
320 du->req_pending = true;
321 }
322
323 static void uh_ubus_list_cb(struct ubus_context *ctx, struct ubus_object_data *obj, void *priv)
324 {
325 struct blob_attr *sig, *attr;
326 struct list_data *data = priv;
327 int rem, rem2;
328 void *t, *o;
329
330 if (!data->verbose) {
331 blobmsg_add_string(data->buf, NULL, obj->path);
332 return;
333 }
334
335 if (!obj->signature)
336 return;
337
338 o = blobmsg_open_table(data->buf, obj->path);
339 blob_for_each_attr(sig, obj->signature, rem) {
340 t = blobmsg_open_table(data->buf, blobmsg_name(sig));
341 rem2 = blobmsg_data_len(sig);
342 __blob_for_each_attr(attr, blobmsg_data(sig), rem2) {
343 if (blob_id(attr) != BLOBMSG_TYPE_INT32)
344 continue;
345
346 switch (blobmsg_get_u32(attr)) {
347 case BLOBMSG_TYPE_INT8:
348 blobmsg_add_string(data->buf, blobmsg_name(attr), "boolean");
349 break;
350 case BLOBMSG_TYPE_INT32:
351 blobmsg_add_string(data->buf, blobmsg_name(attr), "number");
352 break;
353 case BLOBMSG_TYPE_STRING:
354 blobmsg_add_string(data->buf, blobmsg_name(attr), "string");
355 break;
356 case BLOBMSG_TYPE_ARRAY:
357 blobmsg_add_string(data->buf, blobmsg_name(attr), "array");
358 break;
359 case BLOBMSG_TYPE_TABLE:
360 blobmsg_add_string(data->buf, blobmsg_name(attr), "object");
361 break;
362 default:
363 blobmsg_add_string(data->buf, blobmsg_name(attr), "unknown");
364 break;
365 }
366 }
367 blobmsg_close_table(data->buf, t);
368 }
369 blobmsg_close_table(data->buf, o);
370 }
371
372 static void uh_ubus_send_list(struct client *cl, struct blob_attr *params)
373 {
374 struct blob_attr *cur, *dup;
375 struct list_data data = { .buf = &cl->dispatch.ubus.buf, .verbose = false };
376 void *r;
377 int rem;
378
379 blob_buf_init(data.buf, 0);
380
381 uh_client_ref(cl);
382
383 if (!params || blob_id(params) != BLOBMSG_TYPE_ARRAY) {
384 r = blobmsg_open_array(data.buf, "result");
385 ubus_lookup(ctx, NULL, uh_ubus_list_cb, &data);
386 blobmsg_close_array(data.buf, r);
387 }
388 else {
389 r = blobmsg_open_table(data.buf, "result");
390 dup = blob_memdup(params);
391 if (dup)
392 {
393 rem = blobmsg_data_len(dup);
394 data.verbose = true;
395 __blob_for_each_attr(cur, blobmsg_data(dup), rem)
396 ubus_lookup(ctx, blobmsg_data(cur), uh_ubus_list_cb, &data);
397 free(dup);
398 }
399 blobmsg_close_table(data.buf, r);
400 }
401
402 uh_client_unref(cl);
403
404 uh_ubus_init_response(cl);
405 blobmsg_add_blob(&buf, blob_data(data.buf->head));
406 uh_ubus_send_response(cl);
407 }
408
409 static bool parse_json_rpc(struct rpc_data *d, struct blob_attr *data)
410 {
411 struct blob_attr *tb[__RPC_MAX];
412 struct blob_attr *cur;
413
414 blobmsg_parse(rpc_policy, __RPC_MAX, tb, blob_data(data), blob_len(data));
415
416 cur = tb[RPC_JSONRPC];
417 if (!cur || strcmp(blobmsg_data(cur), "2.0") != 0)
418 return false;
419
420 cur = tb[RPC_METHOD];
421 if (!cur)
422 return false;
423
424 d->id = tb[RPC_ID];
425 d->method = blobmsg_data(cur);
426
427 cur = tb[RPC_PARAMS];
428 if (!cur)
429 return true;
430
431 d->params = blob_memdup(cur);
432 if (!d->params)
433 return false;
434
435 return true;
436 }
437
438 static void parse_call_params(struct rpc_data *d)
439 {
440 const struct blobmsg_policy data_policy[] = {
441 { .type = BLOBMSG_TYPE_STRING },
442 { .type = BLOBMSG_TYPE_STRING },
443 { .type = BLOBMSG_TYPE_STRING },
444 { .type = BLOBMSG_TYPE_TABLE },
445 };
446 struct blob_attr *tb[4];
447
448 if (!d->params || blobmsg_type(d->params) != BLOBMSG_TYPE_ARRAY)
449 return;
450
451 blobmsg_parse_array(data_policy, ARRAY_SIZE(data_policy), tb,
452 blobmsg_data(d->params), blobmsg_data_len(d->params));
453
454 if (tb[0])
455 d->sid = blobmsg_data(tb[0]);
456
457 if (conf.ubus_noauth && (!d->sid || !*d->sid))
458 d->sid = UH_UBUS_DEFAULT_SID;
459
460 if (tb[1])
461 d->object = blobmsg_data(tb[1]);
462
463 if (tb[2])
464 d->function = blobmsg_data(tb[2]);
465
466 d->data = tb[3];
467 }
468
469 static void uh_ubus_init_batch(struct client *cl)
470 {
471 struct dispatch_ubus *du = &cl->dispatch.ubus;
472
473 du->array = true;
474 uh_ubus_send_header(cl);
475 ops->chunk_printf(cl, "[");
476 }
477
478 static void uh_ubus_complete_batch(struct client *cl)
479 {
480 ops->chunk_printf(cl, "]");
481 ops->request_done(cl);
482 }
483
484 static void uh_ubus_allowed_cb(struct ubus_request *req, int type, struct blob_attr *msg)
485 {
486 struct blob_attr *tb[__SES_MAX];
487 bool *allow = (bool *)req->priv;
488
489 if (!msg)
490 return;
491
492 blobmsg_parse(ses_policy, __SES_MAX, tb, blob_data(msg), blob_len(msg));
493
494 if (tb[SES_ACCESS])
495 *allow = blobmsg_get_bool(tb[SES_ACCESS]);
496 }
497
498 static bool uh_ubus_allowed(const char *sid, const char *obj, const char *fun)
499 {
500 uint32_t id;
501 bool allow = false;
502 static struct blob_buf req;
503
504 if (ubus_lookup_id(ctx, "session", &id))
505 return false;
506
507 blob_buf_init(&req, 0);
508 blobmsg_add_string(&req, "ubus_rpc_session", sid);
509 blobmsg_add_string(&req, "object", obj);
510 blobmsg_add_string(&req, "function", fun);
511
512 ubus_invoke(ctx, id, "access", req.head, uh_ubus_allowed_cb, &allow, conf.script_timeout * 500);
513
514 return allow;
515 }
516
517 static void uh_ubus_handle_request_object(struct client *cl, struct json_object *obj)
518 {
519 struct dispatch_ubus *du = &cl->dispatch.ubus;
520 struct rpc_data data = {};
521 enum rpc_error err = ERROR_PARSE;
522 static struct blob_buf req;
523
524 uh_client_ref(cl);
525
526 if (json_object_get_type(obj) != json_type_object)
527 goto error;
528
529 du->jsobj_cur = obj;
530 blob_buf_init(&req, 0);
531 if (!blobmsg_add_object(&req, obj))
532 goto error;
533
534 if (!parse_json_rpc(&data, req.head))
535 goto error;
536
537 if (!strcmp(data.method, "call")) {
538 parse_call_params(&data);
539
540 if (!data.sid || !data.object || !data.function || !data.data)
541 goto error;
542
543 du->func = data.function;
544 if (ubus_lookup_id(ctx, data.object, &du->obj)) {
545 err = ERROR_OBJECT;
546 goto error;
547 }
548
549 if (!conf.ubus_noauth && !uh_ubus_allowed(data.sid, data.object, data.function)) {
550 err = ERROR_ACCESS;
551 goto error;
552 }
553
554 uh_ubus_send_request(cl, data.sid, data.data);
555 goto out;
556 }
557 else if (!strcmp(data.method, "list")) {
558 uh_ubus_send_list(cl, data.params);
559 goto out;
560 }
561 else {
562 err = ERROR_METHOD;
563 goto error;
564 }
565
566 error:
567 uh_ubus_json_error(cl, err);
568 out:
569 if (data.params)
570 free(data.params);
571
572 uh_client_unref(cl);
573 }
574
575 static void __uh_ubus_next_batched_request(struct uloop_timeout *timeout)
576 {
577 struct dispatch_ubus *du = container_of(timeout, struct dispatch_ubus, timeout);
578 struct client *cl = container_of(du, struct client, dispatch.ubus);
579 struct json_object *obj = du->jsobj;
580 int len;
581
582 len = json_object_array_length(obj);
583 if (du->array_idx >= len)
584 return uh_ubus_complete_batch(cl);
585
586 obj = json_object_array_get_idx(obj, du->array_idx++);
587 uh_ubus_handle_request_object(cl, obj);
588 }
589
590 static void uh_ubus_data_done(struct client *cl)
591 {
592 struct dispatch_ubus *du = &cl->dispatch.ubus;
593 struct json_object *obj = du->jsobj;
594
595 switch (obj ? json_object_get_type(obj) : json_type_null) {
596 case json_type_object:
597 uh_ubus_send_header(cl);
598 return uh_ubus_handle_request_object(cl, obj);
599 case json_type_array:
600 uh_ubus_init_batch(cl);
601 return uh_ubus_next_batched_request(cl);
602 default:
603 return uh_ubus_single_error(cl, ERROR_PARSE);
604 }
605 }
606
607 static int uh_ubus_data_send(struct client *cl, const char *data, int len)
608 {
609 struct dispatch_ubus *du = &cl->dispatch.ubus;
610
611 if (du->jsobj || !du->jstok)
612 goto error;
613
614 du->post_len += len;
615 if (du->post_len > UH_UBUS_MAX_POST_SIZE)
616 goto error;
617
618 du->jsobj = json_tokener_parse_ex(du->jstok, data, len);
619 return len;
620
621 error:
622 uh_ubus_single_error(cl, ERROR_PARSE);
623 return 0;
624 }
625
626 static void uh_ubus_handle_request(struct client *cl, char *url, struct path_info *pi)
627 {
628 struct dispatch *d = &cl->dispatch;
629
630 blob_buf_init(&buf, 0);
631
632 switch (cl->request.method)
633 {
634 case UH_HTTP_MSG_POST:
635 d->data_send = uh_ubus_data_send;
636 d->data_done = uh_ubus_data_done;
637 d->close_fds = uh_ubus_close_fds;
638 d->free = uh_ubus_request_free;
639 d->ubus.jstok = json_tokener_new();
640 break;
641
642 case UH_HTTP_MSG_OPTIONS:
643 uh_ubus_send_header(cl);
644 ops->request_done(cl);
645 break;
646
647 default:
648 ops->client_error(cl, 400, "Bad Request", "Invalid Request");
649 }
650 }
651
652 static bool
653 uh_ubus_check_url(const char *url)
654 {
655 return ops->path_match(conf.ubus_prefix, url);
656 }
657
658 static int
659 uh_ubus_init(void)
660 {
661 static struct dispatch_handler ubus_dispatch = {
662 .check_url = uh_ubus_check_url,
663 .handle_request = uh_ubus_handle_request,
664 };
665
666 ctx = ubus_connect(conf.ubus_socket);
667 if (!ctx) {
668 fprintf(stderr, "Unable to connect to ubus socket\n");
669 exit(1);
670 }
671
672 ops->dispatch_add(&ubus_dispatch);
673
674 uloop_done();
675 return 0;
676 }
677
678
679 static int uh_ubus_plugin_init(const struct uhttpd_ops *o, struct config *c)
680 {
681 ops = o;
682 _conf = c;
683 return uh_ubus_init();
684 }
685
686 static void uh_ubus_post_init(void)
687 {
688 ubus_add_uloop(ctx);
689 }
690
691 struct uhttpd_plugin uhttpd_plugin = {
692 .init = uh_ubus_plugin_init,
693 .post_init = uh_ubus_post_init,
694 };