1. 15 Feb, 2021 1 commit
  2. 04 Dec, 2020 1 commit
    • Daniel Golle's avatar
      ubusd: attempt to create socket folder · d1d9ddf9
      Daniel Golle authored
      
      
      When ubus is running as root, /var/run/ubus most likely hasn't been
      created as well (as that's the homedir of user ubus, and if a user
      ubus was found, then ubus would run being that user).
      Blindly attempt to create the directory (which won't do any harm if
      it does exist and/or ubus is not running as root) to still be able to
      start ubus in case of user ubus not existing.
      Signed-off-by: default avatarDaniel Golle <daniel@makrotopia.org>
      d1d9ddf9
  3. 25 Oct, 2020 1 commit
  4. 19 Oct, 2020 1 commit
  5. 05 Aug, 2020 2 commits
  6. 15 Mar, 2020 1 commit
  7. 05 Jan, 2020 1 commit
  8. 27 Dec, 2019 1 commit
  9. 26 Dec, 2019 1 commit
  10. 19 Dec, 2019 5 commits
  11. 16 Dec, 2019 10 commits
    • ynezz's avatar
      lua: ubus_lua_do_subscribe: fix copy&paste error · 72be8e93
      ynezz authored
      
      
      Fix copy&paste error in Lua ubus subscriber removal callback.
      
      Addresses-Coverity-ID: 1412311 ("Copy-paste error")
      Signed-off-by: ynezz's avatarPetr Štetiar <ynezz@true.cz>
      72be8e93
    • ynezz's avatar
      lua: workaround false positive dereference of null pointer · a995b1e6
      ynezz authored
      scan-build from clang-9 has reported following:
      
       ubus.c:837:16: warning: Access to field 'rnotify' results in a dereference of a null pointer (loaded from variable 'sub')
                       sub->rnotify = luaL_ref(L, -2);
      
      Which is false positive as the lua_error() does a long jump and
      therefore never returns and this long jump probably confuses the static
      analyzer. So this patch workarounds this false positive by helping
      static analyzer by using common Lua idiom which is to return
      lua_error()'s return value.
      
      Ref: https://www.lua.org/manual/5.1/manual.html#lua_error
      
      
      Addresses-Coverity-ID: 1412355 ("Dereference after null check")
      Signed-off-by: ynezz's avatarPetr Štetiar <ynezz@true.cz>
      a995b1e6
    • ynezz's avatar
      add fuzzer and cram based unit tests · 08f17c87
      ynezz authored
      
      
      For improved QA etc.
      Signed-off-by: ynezz's avatarPetr Štetiar <ynezz@true.cz>
      08f17c87
    • ynezz's avatar
      refactor ubusd.c into reusable ubusd_library · c413be9b
      ynezz authored
      
      
      In order to allow reusability in unit testing & fuzzing.
      Signed-off-by: ynezz's avatarPetr Štetiar <ynezz@true.cz>
      c413be9b
    • ynezz's avatar
      examples: remove dead increments · afd47189
      ynezz authored
      
      
      Fixes following error reported by clang-9 analyzer:
      
       examples/server.c:244:2: warning: Value stored to 'argc' is never read
              argc -= optind;
              ^       ~~~~~~
      
       examples/server.c:245:2: warning: Value stored to 'argv' is never read
              argv += optind;
              ^       ~~~~~~
      Signed-off-by: ynezz's avatarPetr Štetiar <ynezz@true.cz>
      afd47189
    • ynezz's avatar
      add initial GitLab CI support · b2e54423
      ynezz authored
      Uses currently proof-of-concept openwrt-ci[1] in order to:
      
       * improve the quality of the codebase in various areas
       * decrease code review time and help merging contributions faster
       * get automagic feedback loop on various platforms and tools
         - out of tree build with OpenWrt SDK on following targets:
           * ath79-generic
           * imx6-generic
           * malta-be
           * mvebu-cortexa53
         - out of tree native build on x86/64 with GCC (versions 7, 8, 9) and Clang 10
         - out of tree native x86/64 static code analysis with cppcheck and
           scan-build from Clang 9
      
      1. https://gitlab.com/ynezz/openwrt-ci/
      
      Signed-off-by: ynezz's avatarPetr Štetiar <ynezz@true.cz>
      b2e54423
    • ynezz's avatar
      libubus: fix incompatible pointer types assigment · 058f4e95
      ynezz authored
      
      
      Fixes following error reported by clang-9 analyzer:
      
       libubus.c:286:19: error: incompatible pointer types assigning to 'struct blob_attr *' from 'char *' [-Werror,-Wincompatible-pointer-types]
               ctx->msgbuf.data = (char *) calloc(UBUS_MSG_CHUNK_SIZE, sizeof(char));
      
      Result of 'calloc' is converted to a pointer of type 'struct blob_attr',
      which is incompatible with sizeof operand type 'char'.
      Signed-off-by: ynezz's avatarPetr Štetiar <ynezz@true.cz>
      058f4e95
    • ynezz's avatar
      iron out all extra compiler warnings · d2e026a3
      ynezz authored
      
      
      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: ynezz's avatarPetr Štetiar <ynezz@true.cz>
      d2e026a3
    • ynezz's avatar
      ubusd/libubus-io: fix variable sized struct position warning · 5d7ca830
      ynezz authored
      
      
      Fixes following clang-9 compiler warnings:
      
       ubusd.c:99:18: error: field 'h' with variable sized type 'struct cmsghdr' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
                      struct cmsghdr h;
                                     ^
      Signed-off-by: ynezz's avatarPetr Štetiar <ynezz@true.cz>
      5d7ca830
    • ynezz's avatar
      ubusd: fix comparison of integers of different signs · d61282db
      ynezz authored
      
      
      Fixes following clang-9 compiler warning:
      
       ubusd.c:36:19: error: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'int' [-Werror,-Wsign-compare]
               if (ub->refcount == ~0) {
                   ~~~~~~~~~~~~ ^  ~~
      Signed-off-by: ynezz's avatarPetr Štetiar <ynezz@true.cz>
      d61282db
  12. 11 Dec, 2019 1 commit
  13. 01 Jul, 2019 1 commit
  14. 23 Apr, 2019 1 commit
  15. 16 Apr, 2019 2 commits
  16. 06 Oct, 2018 4 commits
  17. 10 Sep, 2018 1 commit
  18. 26 Jul, 2018 1 commit
  19. 25 Jul, 2018 1 commit
  20. 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>
      5bae22eb
    • 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>
      212ceb1b
    • 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>
      d57907c2