From: Felix Fietkau Date: Sun, 4 Jan 2026 18:21:41 +0000 (+0000) Subject: ucode-mod-ubus: complete pending requests when disconnecting locally X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf46d119a2753f0c162b8f20caeb4b84ebb5e299;p=thirdparty%2Fopenwrt.git ucode-mod-ubus: complete pending requests when disconnecting locally libubus only completes pending requests when the socket receives EOF. When explicitly disconnecting, we need to call ubus_flush_requests(). Signed-off-by: Felix Fietkau --- diff --git a/package/utils/ucode/patches/130-ubus-complete-pending-requests-when-disconnecting-lo.patch b/package/utils/ucode/patches/130-ubus-complete-pending-requests-when-disconnecting-lo.patch new file mode 100644 index 00000000000..e3d2f924df5 --- /dev/null +++ b/package/utils/ucode/patches/130-ubus-complete-pending-requests-when-disconnecting-lo.patch @@ -0,0 +1,42 @@ +From: Felix Fietkau +Date: Sun, 4 Jan 2026 10:42:15 +0100 +Subject: [PATCH] ubus: complete pending requests when disconnecting locally + +libubus only completes pending requests when the socket receives EOF. +When explicitly disconnecting, we need to call ubus_flush_requests(). + +Signed-off-by: Felix Fietkau +--- + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -198,6 +198,7 @@ if(UBUS_SUPPORT) + try_compile(HAVE_NEW_UBUS_STATUS_CODES + ${CMAKE_BINARY_DIR} + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test.c") ++ check_function_exists(ubus_flush_requests HAVE_UBUS_FLUSH_REQUESTS) + check_function_exists(uloop_timeout_remaining64 REMAINING64_FUNCTION_EXISTS) + check_function_exists(ubus_channel_connect HAVE_CHANNEL_SUPPORT) + file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test2.c" " +@@ -216,6 +217,9 @@ if(UBUS_SUPPORT) + if(HAVE_NEW_UBUS_STATUS_CODES) + add_definitions(-DHAVE_NEW_UBUS_STATUS_CODES) + endif() ++ if(HAVE_UBUS_FLUSH_REQUESTS) ++ add_definitions(-DHAVE_UBUS_FLUSH_REQUESTS) ++ endif() + if (HAVE_UBUS_NEW_OBJ_CB) + target_compile_definitions(ubus_lib PUBLIC HAVE_UBUS_NEW_OBJ_CB) + endif() +--- a/lib/ubus.c ++++ b/lib/ubus.c +@@ -2310,6 +2310,9 @@ uc_ubus_disconnect(uc_vm_t *vm, size_t n + + conn_get(vm, &c); + ++#ifdef HAVE_UBUS_FLUSH_REQUESTS ++ ubus_flush_requests(&c->ctx); ++#endif + ubus_shutdown(&c->ctx); + c->ctx.sock.fd = -1; + uc_ubus_put_res(&c->res);