summaryrefslogtreecommitdiff
path: root/ubusd_proto.c
Commit message (Collapse)AuthorAgeFilesLines
* workaround possibly false positive uses of memory after it is freedPetr Štetiar2019-12-191-3/+3
| | | | | | | | | | | | | | | | | | scan-build from clang-9 has reported following: libubox/list.h:83:22: warning: Use of memory after it is freed entry->next->prev = entry->prev; ^~~~~~~~~~~ ubusd_event.c:42:3: warning: Use of memory after it is freed ubusd_delete_event_source(ev); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Which might be a false positives, but in order to make the code pass the static analyzer checks, rewrite the while loops on lists with the safe list iterator. Signed-off-by: Petr Štetiar <ynezz@true.cz>
* ubusd: move global retmsg per clientAlexandru Ardelean2017-11-131-12/+23
| | | | | | | | | | | | | | | | | | | | | | | Even with the tx_queue-ing issue resolved, what seems to happen afterwards, is that all the messages seems to get through, but the client still loops in the `ubus_complete_request()` waiting for `req->status_msg` or for a timeout. Though, the timeout does not seem to happen, because the data is processed in `ubus_poll_data()`, with a infinite poll() timeout (ubus_complete_request() is called with timeout 0). It's likely that either the `seq` or `peer` sent from ubusd are wrong, and the client cannot get the correct ubus request in `ubus_process_req_msg()`. I haven't digged too deep into this ; setting the `retmsg` object on the client struct seems to have resolved any hanging with the `ubus list` command. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name> [fix placement of retmsg in cl]
* ubusd: rename goto label from `error` to `out`Alexandru Ardelean2017-11-131-5/+5
| | | | | | Semantic has changed a bit. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* ubusd: don't free messages in ubus_send_msg() anymoreAlexandru Ardelean2017-11-131-14/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Allow sending a fd along a ubus_requestamine ahd2016-12-241-1/+5
| | | | Signed-off-by: amine.ahd <amine.ahd@gmail.com>
* ubusd: fix id lookup of objects with path and no methodsFelix Fietkau2016-12-241-2/+3
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ubusd_proto: fix crash when trying to subscribe to system objectsFelix Fietkau2016-11-201-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ubusd: fix sending remove-object notificationFelix Fietkau2016-08-231-1/+1
| | | | | | | | | | | | Patch by Delio Brignoli <brignoli.delio@gmail.com> Both ubusd_free_object (eventually via ubusd_create_object_event_msg) and ubus_proto_send_msg_from_blob() use the same message buffer. So ubusd_handle_remove_object builds the payload which gets (indirectly) overwritten by the call to ubusd_free_object and then sent again by ubus_proto_send_msg_from_blob. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ubusd: add missing NULL pointer checks for obj->typeFelix Fietkau2016-08-231-1/+4
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ubusd: fix a memory leak on user/group client infoFelix Fietkau2016-01-261-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubusd: fix the return code for acl check mismatchFelix Fietkau2015-12-091-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* hook acl into ubusdJohn Crispin2015-06-181-7/+34
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* make ubus_proto_send_msg_from_blob() none staticJohn Crispin2015-06-181-6/+6
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* make ubus_parse_msg() none staticJohn Crispin2015-06-181-1/+1
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* pass ubus_msg_buf to callback of internal objectJohn Crispin2015-06-181-1/+1
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* remove obseleted validation of keyJohn Crispin2015-06-181-2/+1
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* ubus: Fix issues reported by static code analysis tool KlocworkHans Dedecker2015-04-201-2/+7
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* libubus: replace __init with __constructorZefir Kurtisi2014-09-171-1/+1
| | | | | | | | __init has a naming collision with C++ and prevents ubus_common.h from being included. Instead, use __constructor as defined from libubox. Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
* ubusd: fix processing object method signaturesFelix Fietkau2014-04-011-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubusd: implement protocol support for passing file descriptors as part of ↵Felix Fietkau2014-02-181-1/+16
| | | | | | request completion msgs from objects to clients Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubusd: implement notify forwarding with status reportingFelix Fietkau2012-12-151-28/+76
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* remove the "method" argument for object subscriptionFelix Fietkau2012-12-141-4/+2
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubus: add notification for subscribers present/goneFelix Fietkau2012-12-141-0/+14
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* watch add/remove -> subscribe/unsubscribe:Felix Fietkau2012-12-131-20/+13
| | | | | | | rename the ADD_WATCH/REMOVE_WATCH messages to SUBSCRIBE/UNSUBSCRIBE and change the message format and libubus API in preparation for adding object notifications Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubusd: add support for watching objects to get notified when they go awayFelix Fietkau2012-05-191-0/+79
|
* fix unused but set variableFelix Fietkau2011-10-281-2/+0
|
* ubusd: fix a use after free bugFelix Fietkau2011-09-141-1/+3
|
* add copyright/license informationFelix Fietkau2011-06-171-0/+13
|
* remove some duplicationFelix Fietkau2011-02-071-1/+1
|
* move more protocol related stuff to ubusd_proto.cFelix Fietkau2011-02-071-2/+44
|
* make ubusd_get_client_by_id staticFelix Fietkau2011-02-071-0/+11
|
* make ubus_parse_msg staticFelix Fietkau2011-02-071-1/+1
|
* add code for sending events and fix the code for receiving eventsFelix Fietkau2011-02-071-1/+1
|
* implement a handler for UBUS_MSG_REMOVE_OBJECTFelix Fietkau2011-02-061-0/+32
|
* follow blob_get_int* -> blob_get_u* renameFelix Fietkau2011-02-061-3/+3
|
* rename publish to add_objectFelix Fietkau2011-02-061-2/+2
|
* fix message bufferingFelix Fietkau2011-02-051-7/+7
|
* add functionality for registering anonymous objects as event listenersFelix Fietkau2011-02-051-4/+2
|
* add some stub functionality for the ubus event switchFelix Fietkau2011-02-051-0/+4
|
* export the object type through lookup callsFelix Fietkau2011-01-311-0/+1
|
* cleanup, pass both data and status messages on to other clientsFelix Fietkau2011-01-311-17/+12
|
* remove support for path based invoke, add object id validation for responsesFelix Fietkau2011-01-311-11/+16
|
* remove path based invoke functions, add stub implementation for invoking ↵Felix Fietkau2011-01-311-1/+66
| | | | method calls
* add stubs for invokeFelix Fietkau2011-01-301-0/+6
|
* Initial importFelix Fietkau2011-01-301-0/+203