Commit graph

15 commits

Author SHA1 Message Date
John Crispin
212ceb1b02 valgrind complained about these
==18834== Warning: invalid file descriptor -1 in syscall close()
==18834==    at 0x5326D20: __close_nocancel (syscall-template.S:84)
==18834==    by 0x5046DC7: ubus_process_obj_msg (libubus-obj.c:143)
==18834==    by 0x5045E98: ubus_process_msg (libubus.c:106)
==18834==    by 0x50468D0: ubus_handle_data (libubus-io.c:314)
==18834==    by 0x4E3D125: uloop_run_events (uloop.c:198)
==18834==    by 0x4E3D125: uloop_run_timeout (uloop.c:555)
==18834==    by 0x109BEF: uloop_run (uloop.h:111)
==18834==    by 0x109BEF: main (main.c:25)

Signed-off-by: John Crispin <john@phrozen.org>
2018-01-17 09:59:58 +01:00
John Crispin
d57907c2b3 fix invalid close() call
valgrind complained about this one

==18632== Warning: invalid file descriptor -1 in syscall close()
==18632==    at 0x5326D20: __close_nocancel (syscall-template.S:84)
==18632==    by 0x5046C02: ubus_process_invoke (libubus-obj.c:98)
==18632==    by 0x5046DC3: ubus_process_obj_msg (libubus-obj.c:142)
==18632==    by 0x5045E98: ubus_process_msg (libubus.c:106)
==18632==    by 0x50468D0: ubus_handle_data (libubus-io.c:314)
==18632==    by 0x4E3D125: uloop_run_events (uloop.c:198)
==18632==    by 0x4E3D125: uloop_run_timeout (uloop.c:555)
==18632==    by 0x109BEF: uloop_run (uloop.h:111)
==18632==    by 0x109BEF: main (main.c:25)

Signed-off-by: John Crispin <john@phrozen.org>
2018-01-17 09:58:54 +01:00
Bob Ham
6d1ea6c33d libubus: Fix deletion from context's object AVL tree when removing object
Objects are stored in the ubus context in an AVL tree.  An AVL tree
node contains a pointer to a key value.  For the ubus context, this
points to the id member of the object structure.  In
ubus_remove_object_cb, the id member is set to zero and then after,
avl_delete is called and fails.  To fix this, we call avl_delete
before setting the object id to zero.

Signed-off-by: Bob Ham <bob.ham@tomltd.co.uk>
2017-11-13 09:51:40 +01:00
amine ahd
df088f03c0 Allow sending a fd along a ubus_request
Signed-off-by: amine.ahd <amine.ahd@gmail.com>
2016-12-24 14:31:04 +01:00
John Crispin
2cfdb81889 hook acl into libubus
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-06-18 19:01:17 +02:00
Felix Fietkau
9562291f68 libubus: preserve the received message buffer for incoming invoke calls
Set ctx->msgbuf.data to NULL during the call. If ctx->msgbuf is needed
during the call, a new buffer will be allocated. If not,
ctx->msgbuf.data is restored to the previous value afterwards

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-09-15 15:40:07 +02:00
Felix Fietkau
3e45a782b2 libubus: remove ubus_msghdr_data() by passing in the right data structure pointer
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-09-15 15:33:27 +02:00
Felix Fietkau
2c71017cfb libubus: add support for defining a policy mask
This allows sharing a policy array across methods, but masking out
unused entries for individual methods.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-27 00:40:25 +02:00
Felix Fietkau
47a9ab0c64 libubus: implement file descriptor passing support
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-02-18 15:03:53 +01:00
Felix Fietkau
a9ee3ef0cf libubus: pull the variable length data array out of struct ubus_msghdr to fix builds with clang
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-29 17:28:37 +01:00
Lukasz Baj
d486006ab9 libubus: Check if remove callback exists before call it
When process unsubscribes then remove callback is called. But it
can be NULL if not defined, so we should check it before we call it.

Signed-off-by: Lukasz Baj <l.baj@radytek.com>
2013-08-29 20:35:38 +02:00
Felix Fietkau
ee9e399096 libubus: do not send a status reply if UBUS_ATTR_NO_REPLY is set
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-14 20:05:34 +01:00
Felix Fietkau
7cd33a8e3a libubus: reduce code duplication and add stack depth protection for unsubscribe/notify callbacks
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-14 13:42:10 +01:00
Felix Fietkau
9f706a2d27 libubus: fix stack space init for processing requests
Fixes client timeouts on invoke on some platforms

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-10-30 13:41:28 +01:00
Felix Fietkau
a6f52f058e libubus: split out some code into separate source files 2012-10-24 15:07:35 +02:00