1. 17 Jan, 2018 3 commits
    • Dirk Feytons's avatar
      ubus/lua: pass notification name to callback · 5bae22eb
      Dirk Feytons authored
      The callback function registered to be invoked when subscribing to a
      notification was only passed the notification data (if any) but not the name
      of the notification.
      This name is now passed as second argument to remain backwards compatible.
      The example subscriber.lua has also be updated.
      Signed-off-by: default avatarDirk Feytons <dirk.feytons@gmail.com>
    • John Crispin's avatar
      valgrind complained about these · 212ceb1b
      John Crispin authored
      ==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: default avatarJohn Crispin <john@phrozen.org>
    • John Crispin's avatar
      fix invalid close() call · d57907c2
      John Crispin authored
      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: default avatarJohn Crispin <john@phrozen.org>
  2. 13 Nov, 2017 6 commits
    • Alexandru Ardelean's avatar
      ubusd: move global retmsg per client · 5f87f548
      Alexandru Ardelean authored
      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: default avatarAlexandru Ardelean <ardeleanalex@gmail.com>
      Signed-off-by: Felix Fietkau <nbd@nbd.name> [fix placement of retmsg in cl]
    • Alexandru Ardelean's avatar
      ubusd_monitor: alloc & free the buffer outside of the loop · 27d712d3
      Alexandru Ardelean authored
      Should save a few cycles, since the data that's
      being changed is only the seq number.
      And the `ub` is always created as shared.
      Signed-off-by: default avatarAlexandru Ardelean <ardeleanalex@gmail.com>
    • Alexandru Ardelean's avatar
      ubusd: rename goto label from `error` to `out` · be146ad2
      Alexandru Ardelean authored
      Semantic has changed a bit.
      Signed-off-by: default avatarAlexandru Ardelean <ardeleanalex@gmail.com>
    • Alexandru Ardelean's avatar
      ubusd: don't free messages in ubus_send_msg() anymore · e02813b2
      Alexandru Ardelean authored
      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: default avatarAlexandru Ardelean <ardeleanalex@gmail.com>
    • Bob Ham's avatar
      libubus: Fix deletion from context's object AVL tree when removing object · 6d1ea6c3
      Bob Ham authored
      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: default avatarBob Ham <bob.ham@tomltd.co.uk>
    • Rosen Penev's avatar
      ubus: Remove unnecessary memset calls. · 9c13096b
      Rosen Penev authored
      Replace malloc+memset with calloc.
      Signed-off-by: Rosen Penev's avatarRosen Penev <rosenp@gmail.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
  3. 06 Nov, 2017 1 commit
  4. 20 Feb, 2017 2 commits
  5. 15 Feb, 2017 1 commit
  6. 14 Feb, 2017 1 commit
  7. 07 Feb, 2017 1 commit
  8. 03 Feb, 2017 2 commits
  9. 22 Jan, 2017 2 commits
  10. 20 Jan, 2017 1 commit
  11. 04 Jan, 2017 1 commit
  12. 24 Dec, 2016 3 commits
  13. 21 Nov, 2016 1 commit
  14. 20 Nov, 2016 2 commits
  15. 12 Oct, 2016 1 commit
    • Alexandru Ardelean's avatar
      cli: register event handler first, then do lookup · 312448a5
      Alexandru Ardelean authored
      We seem to be getting timeout for ubus wait_for calls
      every now and then.
      And it's not reliably reproducible.
      Looking at the code the only thing that would look like
      a potetntial reason, is that between the ubus_lookup() and
      ubus_register_event_handler() calls, there's a very narrow
      window where the event would get sent out and we would not
      get it, thus having to timeout.
      It doesn't look like registering the event handler first
      is a big problem for the whole wait_check_object() logic.
      Signed-off-by: default avatarAlexandru Ardelean <ardeleanalex@gmail.com>
  16. 05 Sep, 2016 1 commit
  17. 25 Aug, 2016 1 commit
    • Denis Osvald's avatar
      ubusd: don't check ACL when object is NULL · d6bb4f1a
      Denis Osvald authored
      If there are any ACLs present other than global wildcard "*", the AVL
      tree comparator will compare ACL key to object name. However, object
      name can be NULL in cases where ACL check is done on call to internal
      ubus objects (e.g. ubus monitor).
      With this change we skip checking ACLs on such NULL objects.
      Signed-off-by: default avatarDenis Osvald <denis.osvald@sartura.hr>
  18. 23 Aug, 2016 2 commits
  19. 01 Jul, 2016 1 commit
    • Florian Fainelli's avatar
      cmake: Fix find_library for ubusd and examples/server · 053be7df
      Florian Fainelli authored
      Both ubusd and cli TARGET_LINK_LIBRARIES reference ${json} which is
      obtained via find_library(), but since the find_library() is searched
      after the TARGET_LINK_LIBRARIES for ubusd, ubusd always gets an empty
      ${json} variable.
      examples/server also links against libjson-c, but we were not setting
      TARGET_LINK_LIBRARIES accordingly, so do that too with ${json} appended.
      This was causing linking errors for ubusd and then examples/server using
      an external toolchain (stbgcc-4.8-1.x).
      Fixes: 9f52d176 ("cli: use the new json-c library name")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
  20. 26 Jun, 2016 1 commit
  21. 06 Jun, 2016 1 commit
  22. 01 Jun, 2016 2 commits
  23. 15 May, 2016 1 commit
  24. 07 Mar, 2016 1 commit
  25. 29 Feb, 2016 1 commit
    • Zhao, Gang's avatar
      cli: add timeout support for listen command · b958a9aa
      Zhao, Gang authored
      Currently 'ubus listen' command does not respect the timeout parameter,
      i.e., whether timeout parameter is provided, 'ubus listen' will always
      run infinitely. This patch let 'ubus listen' command support the timeout
      parameter. For example, 'ubus listen -t 60' will cause the command to
      exit after 60 seconds.
      Signed-off-by: default avatarZhao, Gang <gang.zhao.42@gmail.com>