summaryrefslogtreecommitdiff
path: root/ubusd_event.c
Commit message (Collapse)AuthorAgeFilesLines
* workaround possibly false positive uses of memory after it is freedPetr Štetiar2019-12-191-3/+2
| | | | | | | | | | | | | | | | | | 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>
* iron out all extra compiler warningsPetr Štetiar2019-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | clang-9 on x86/64 has reported following warnings/errors: libubus-acl.c:123:2: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] libubus-io.c:108:18: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare] libubus-io.c:395:56: error: comparison of integers of different signs: 'ssize_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare] libubus-req.c:441:4: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] ubusd_acl.c:119:18: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] ubusd_acl.c:152:5: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] ubusd_acl.c:348:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] ubusd_acl.c:352:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] ubusd_acl.c:357:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] ubusd_acl.c:362:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] ubusd_acl.c:367:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] ubusd_acl.c:447:16: error: comparison of integers of different signs: 'int' and '__size_t' (aka 'unsigned long') [-Werror,-Wsign-compare] ubusd_acl.c:502:18: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] ubusd.c:123:13: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] ubusd.c:170:15: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] ubusd.c:262:43: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] ubusd.c:287:30: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] ubusd_event.c:170:18: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] ubusd_obj.c:71:2: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] Signed-off-by: Petr Štetiar <ynezz@true.cz>
* ubusd_acl: event send access list supportHans Dedecker2018-10-061-0/+3
| | | | | | | | | | | | | Adds event send access list support in ubus via the "send" keyword Example of a json file: { "user": "superuser", "send": [ "wireless.*" ], } Signed-off-by: Koen Dergent <koen.cj.dergent@gmail.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* ubusd_acl: event listen access list supportHans Dedecker2018-10-061-0/+3
| | | | | | | | | | | | | | Adds event listen access list support in ubus via the "listen" keyword Example of a json file: { "user": "superuser", "listen": [ "network.*" ], } Signed-off-by: Koen Dergent <koen.cj.dergent@gmail.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* ubusd_event: move strmatch_len to ubus_common.hHans Dedecker2018-10-061-10/+1
| | | | | | Rename strmatch_len into ubus_strmatch_len and move it to ubus_common.h Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* ubusd: don't free messages in ubus_send_msg() anymoreAlexandru Ardelean2017-11-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* make ubusd_send_event() none staticJohn Crispin2015-06-181-4/+2
| | | | 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>
* ubus: Fix issues reported by static code analysis tool KlocworkHans Dedecker2015-04-201-1/+2
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* make a few functions staticFelix Fietkau2012-05-291-1/+1
|
* add copyright/license informationFelix Fietkau2011-06-171-0/+13
|
* add support for a const void * key in avlFelix Fietkau2011-04-131-3/+4
|
* remove separate catch all list, always require a pattern argument for ↵Felix Fietkau2011-02-111-61/+17
| | | | registering events, even if it is just *
* fix initial object event sequence numberFelix Fietkau2011-02-101-1/+1
|
* add notifications for registered/unregistered objects with pathFelix Fietkau2011-02-101-0/+24
|
* move event message formatting into a callbackFelix Fietkau2011-02-101-16/+27
|
* split event sending from event forwardingFelix Fietkau2011-02-101-24/+33
|
* add missing includeFelix Fietkau2011-02-071-0/+1
|
* implement event pattern matchingFelix Fietkau2011-02-071-7/+56
|
* trim the wildcard of partial patterns to keep the avl tree sorted properlyFelix Fietkau2011-02-071-2/+14
|
* remove old data structuresFelix Fietkau2011-02-071-12/+0
|
* add code for sending events and fix the code for receiving eventsFelix Fietkau2011-02-071-12/+76
|
* add functionality for registering anonymous objects as event listenersFelix Fietkau2011-02-051-14/+113
|
* add some stub functionality for the ubus event switchFelix Fietkau2011-02-051-0/+45