summaryrefslogtreecommitdiff
path: root/libubus-io.c
Commit message (Collapse)AuthorAgeFilesLines
* libubus: reset ctx->sock.error when doing ubus reconnectHans Dedecker2017-02-201-0/+1
| | | | | | | | When ubus connect fails ctx->sock.eof will be set but ctx->sock.error can be set as well. Reset ctx->sock.error as well when doing ubus reconnect Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* libubus: do not modify uloop_cancelledFelix Fietkau2017-02-031-5/+7
| | | | | | | | | | | | uloop_cancelled was used for two purposes within ubus_complete_request: - interrupting recursive requests on SIGINT/SIGTERM - breaking out of the poll loop in a recursive request that completed Saving/restorung uloop_cancelled was buggy, leading to SIGTERM not being processed properly. Simplify the logic by using a separate field for internal use Signed-off-by: Felix Fietkau <nbd@nbd.name>
* libubus: reset ctx->sock.eof to fix reconnect issuesFelix Fietkau2017-02-031-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* Fix the length of msg buffer after reallocRujun Wang2016-06-261-0/+1
| | | | Signed-off-by: Rujun Wang <chinawrj@gmail.com>
* ubus: use network order in ubus message header fieldsEyal Birger2016-02-281-2/+5
| | | | | | | | | | | | | | | | | | Changing the ubus message header fields from 'host' order to 'network' order allows passing ubus messages between hosts with different endianity. Example use (creating a ubus proxy): on host A (e.g. big endian router already running ubusd), run: $ socat TCP-LISTEN:5699,fork UNIX:/var/run/ubus.sock & On host B (e.g. little endian development PC) run: $ socat UNIX-LISTEN:/var/run/ubus.sock,fork TCP:<host A IP>:5699 & Now ubus applications can be run on host B and seamlessly interact with ubus applications on host A. Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
* libubus: fix error handling during close after partially receiving a messageFelix Fietkau2015-12-091-1/+2
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubus: Correct usage of timeout on poll functionKarl Vogel2015-12-071-2/+2
| | | | | | | | | | | | | As the man page explains: "Specifying a timeout of zero causes poll() to return immediately, even if no file descriptors are ready." The use of 0 as timeout could cause libubus to busy loop if the socket was non-blocking. For blocking sockets, this was less apparent as the subsequent read() would then block. Signed-off-by: Karl Vogel <karl.vogel@gmail.com>
* libubus: define _GNU_SOURCE, needed for O_CLOEXECFelix Fietkau2014-09-171-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* libubus: rework buffer allocation codeFelix Fietkau2014-09-151-13/+31
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* libubus: remove ubus_msghdr_data() by passing in the right data structure ↵Felix Fietkau2014-09-151-2/+1
| | | | | | pointer Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* libubus: fix msgbuf reduction logic during receiveAlexandru Ardelean2014-08-311-8/+4
| | | | | Signed-off-by: Alexandru Ardelean <aa@ocedo.com> Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* libubus: mark ubus socket with close-on-execFelix Fietkau2014-08-311-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* libubus: fix writev_retry() function when writing large packetsAlexandru Ardelean2014-07-031-0/+3
| | | | | | Seems this bug stayed hidden for a while, because the write/sendmsg function can send up to ~200k in one send, so it looked at first why there was some data mismatch.
* libubus: add logic to reduce msgbuf data size after 16 small messagesAlexandru Ardelean2014-07-031-0/+13
|
* ubus: increase message size limit and make it configurable at build-timeAlexandru Ardelean2014-07-031-0/+10
|
* libubus: refactor ubus_context msgbuf data to be dynamically allocatedAlexandru Ardelean2014-07-031-5/+15
|
* libubus: do not use uloop_run() inside ubus_complete_requestFelix Fietkau2014-03-181-0/+11
| | | | | | Avoid unrelated uloop callbacks by using poll() on the ubus fd instead. Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* libubus: close file descriptor after passing it in the status msgFelix Fietkau2014-02-271-0/+3
| | | | | | Simplifies handling of non-deferred requests Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* libubus: implement file descriptor passing supportFelix Fietkau2014-02-181-12/+70
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* libubus: pull the variable length data array out of struct ubus_msghdr to ↵Felix Fietkau2013-10-291-3/+5
| | | | | | fix builds with clang Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* libubus: detect read/write errors and set the eof flag, even if uloop is not ↵Felix Fietkau2013-08-081-8/+23
| | | | | | used as main event loop Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* libubus: fix publishing objects after reconnectFelix Fietkau2013-08-081-3/+8
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* Add a return value to make compiler silent.Yousong Zhou2013-08-041-0/+3
| | | | Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* Fix the condition for stopping the writev_retry.Yousong Zhou2013-08-041-1/+1
| | | | | | | | All iov's were sent only after the last were sent (iov_len == 0). We could have 'cur_len == 0' if the sent iov's were sent wholly but not all iov's were sent (how about all but the last). Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* libubus: fix crash on reconnect with objects that have no typeFelix Fietkau2013-04-041-1/+2
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* libubus: implement notify handlingFelix Fietkau2012-12-151-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* libubus: add UBUS_ATTR_NO_REPLY and add policy for UBUS_ATTR_ACTIVEFelix Fietkau2012-12-141-0/+2
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* libubus: split out some code into separate source filesFelix Fietkau2012-10-241-0/+256