[openwrt/openwrt] ucode-mod-ubus: complete pending requests when disconnecting locally
LEDE Commits
lede-commits at lists.infradead.org
Mon Jan 5 03:44:01 PST 2026
nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/bf46d119a2753f0c162b8f20caeb4b84ebb5e299
commit bf46d119a2753f0c162b8f20caeb4b84ebb5e299
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Sun Jan 4 18:21:41 2026 +0000
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 <nbd at nbd.name>
---
...te-pending-requests-when-disconnecting-lo.patch | 42 ++++++++++++++++++++++
1 file changed, 42 insertions(+)
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 0000000000..e3d2f924df
--- /dev/null
+++ b/package/utils/ucode/patches/130-ubus-complete-pending-requests-when-disconnecting-lo.patch
@@ -0,0 +1,42 @@
+From: Felix Fietkau <nbd at nbd.name>
+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 <nbd at nbd.name>
+---
+
+--- 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);
More information about the lede-commits
mailing list