summaryrefslogtreecommitdiff
path: root/ubusd.c
Commit message (Collapse)AuthorAgeFilesLines
* ubusd: don't free messages in ubus_send_msg() anymoreAlexandru Ardelean2017-11-131-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This makes it clear that `ubus_msg_send()` is only about sending and queue-ing messages, and has nothing to do with free-ing. It can be a bit misleading/confusing when trying to go through the code and make assumptions about whether a buffer is free'd in ubus_send_msg(), or is free'd outside. In `ubusd_proto_receive_message()` the `ubus_msg_free()` is now called before the `if (ret == -1)` check. That way, all callbacks will have their messages free'd, which is what's desired, but confusing, because: * ubusd_handle_invoke() called ubus_msg_free() before returning -1 * ubusd_handle_notify() called ubus_msg_free() before returning -1 * ubusd_handle_response() called ubus_msg_send(,,free=true) before returning -1 * ubus_msg_send() would call ubus_msg_send(,,free=false) * all other callback callers would `ubus_msg_send(,,free=true)` (free the buffers in ubus_msg_send() ) In all other places, where `ubus_msg_send(,,free=true)` an explicit `ubus_msg_free()` was added. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* ubusd: fix incomplete copy of shared buf during queue-ingAlexandru Ardelean2017-02-071-2/+9
| | | | | | | | | | | | | For a shared ubus_msg_buf, the ubus_msg_ref function will create a copy for queue-ing. Problem is, that during the dequeue (especially) in client_cb, the header is 0-ed (because it's was a newly alloc-ed buffer). And during ubus_msg_writev(), the header info will be ignored by the client. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* ubusd: fix issue caused by an implicit castMihai Richard2017-01-201-2/+3
| | | | | | | | | | | An -1 returned by ubus_msg_writev() will be interpreted as UINT_MAX during a check to see how much data had could be written on the socket. Because sizeof() will return size_t it will promote the comparsion to unsigned Signed-off-by: Mihai Richard <mihairichard@live.com>
* ubusd: remove systemd socket activation supportJohn Crispin2016-06-011-32/+7
| | | | Signed-off-by: John Crispin <john@phrozen.org>
* ubusd: fix systemd socket activation supportMatthias Schiffer2016-06-011-7/+32
| | | | | | | | | | | | 62cdfc3 added systemd units including a ubus.socket unit, but didn't actually add socket activation support to ubusd. This would cause the first connection that activated ubusd to hang (as ubusd ignored it), and stopping ubusd would break it completely (as ubusd removed the socket file). The ENABLE_SYSTEMD default is changed to OFF as the socket activation uses libsystemd, so setting ENABLE_SYSTEMD to ON will now require libsystemd. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* ubus: use network order in ubus message header fieldsEyal Birger2016-02-281-2/+12
| | | | | | | | | | | | | | | | | | 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>
* ubusd: make ACL path configurable on the command lineFelix Fietkau2015-12-091-1/+5
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubusd: add monitor supportFelix Fietkau2015-11-191-0/+5
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubusd: fix offset calculation (based on patch by Yang Chao)Felix Fietkau2015-07-061-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* change socket permission to allow !root users to connectJohn Crispin2015-06-181-1/+1
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* make ubusd load the acl on start and HUPJohn Crispin2015-06-181-0/+7
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* call openlog on startupJohn Crispin2015-06-181-0/+2
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* ubusd: replace ubusd_msg_unshare() with ubus_msg_new() to prevent invalid ↵Alexandru Ardelean2014-07-031-13/+1
| | | | | | | | | | | | | free-ing The realloc is problematic mostly with large packets, as the pointer changes so what eventually gets free'd is invalid. Note that ub ptr param in the call will be passed on to a ubus_msg_free(), right after ubus_msg_ref() finishes. This bug stayed hidden the same way as the bug in libubus writev_retry(). Since the write/sendmsg function can send about ~200k the ubus_msg_enqueue() call does not get triggered.
* ubusd: implement protocol support for passing file descriptors as part of ↵Felix Fietkau2014-02-181-4/+70
| | | | | | request completion msgs from objects to clients Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubusd: use umask of 0177 for now to prevent a world- and group-writable unix ↵Jo-Philipp Wich2013-09-281-0/+2
| | | | socket
* add copyright/license informationFelix Fietkau2011-06-171-0/+13
|
* move more protocol related stuff to ubusd_proto.cFelix Fietkau2011-02-071-31/+7
|
* make ubus_msg_ref staticFelix Fietkau2011-02-071-1/+1
|
* make ubusd_get_client_by_id staticFelix Fietkau2011-02-071-12/+1
|
* fix max message length handling - exclude the headerFelix Fietkau2011-02-071-1/+1
|
* remove the socket when ubusd exitsFelix Fietkau2011-02-061-0/+1
|
* add support for overriding the socket nameFelix Fietkau2011-02-061-2/+23
|
* fix message refcountingFelix Fietkau2011-02-061-1/+1
|
* remove an unnecessary checkFelix Fietkau2011-02-051-2/+0
|
* fix message bufferingFelix Fietkau2011-02-051-25/+49
|
* add functions for internal object allocationFelix Fietkau2011-02-051-1/+1
|
* Initial importFelix Fietkau2011-01-301-0/+316