ucode: update to Git HEAD (2025-09-29)

f642f65c3d00 rtnl: optimize string attribute encoding
1946c571eb25 nl80211: rework string attribute encoding
6b16cd37373a nl80211: properly handle decoding numeric struct members
5a342b86c010 nl80211: support sending requests on listener socket
cd2850eec8ca lib: fix `rindex()` return value when needle at the start of the haystack
23b21eb2e8cb ubus: add connection functions to global scope
a5b206f60f5d struct: align `X` and `Z` length & truncation semantics with `*`
387880348c89 nl80211: read all pending event messages
470bc3ebffe0 uloop: fix potential use-after-free when destroying uloop entities

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2025-09-29 14:08:08 +02:00
parent 1545173ec1
commit 2f6a467f6c
2 changed files with 3 additions and 72 deletions

View File

@ -12,9 +12,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/jow-/ucode.git
PKG_SOURCE_DATE:=2025-08-26
PKG_SOURCE_VERSION:=5f712ffd3f31f13ed4812cfb37c21dbef7a75e2b
PKG_MIRROR_HASH:=6093ceb320854f4d38180f163fd702bceb8785ed6574aa145021eda82a9cf7b4
PKG_SOURCE_DATE:=2025-09-29
PKG_SOURCE_VERSION:=1090abb125490d2f541f68453cc251daf94f8b04
PKG_MIRROR_HASH:=b68d893867add47b92d519a631c4e3bacec52eafae088b6a64ba3935f169bb15
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
PKG_LICENSE:=ISC

View File

@ -1,69 +0,0 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Tue, 26 Aug 2025 10:17:22 +0200
Subject: [PATCH] ubus: add connection functions to global scope
Allows reusing a common global connection across modules
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/lib/ubus.c
+++ b/lib/ubus.c
@@ -511,16 +511,42 @@ uc_ubus_objects_cb(struct ubus_context *
static bool
_conn_get(uc_vm_t *vm, uc_ubus_connection_t **conn)
{
- uc_ubus_connection_t *c = uc_fn_thisval("ubus.connection");
+ uc_ubus_connection_t *c;
+ uc_value_t *res;
- if (!c)
- c = uc_fn_thisval("ubus.channel");
- if (!c)
- err_return(UBUS_STATUS_INVALID_ARGUMENT, "Invalid connection context");
+ if (ucv_type(_uc_fn_this_res(vm)) == UC_OBJECT) {
+ res = uc_vm_registry_get(vm, "ubus.connection");
+ c = ucv_resource_data(res, "ubus.connection");
+
+ if (c && c->ctx.sock.fd >= 0)
+ goto out;
+
+ c = uc_ubus_conn_alloc(vm, NULL, "ubus.connection");
+ if (!c)
+ return NULL;
+
+ if (ubus_connect_ctx(&c->ctx, NULL)) {
+ ucv_put(c->res);
+ err_return(UBUS_STATUS_UNKNOWN_ERROR, "Unable to connect to ubus socket");
+ }
+
+ ubus_add_uloop(&c->ctx);
- if (c->ctx.sock.fd < 0)
- err_return(UBUS_STATUS_CONNECTION_FAILED, "Connection is closed");
+ uc_vm_registry_set(vm, "ubus.connection", ucv_get(c->res));
+ }
+ else {
+ c = uc_fn_thisval("ubus.connection");
+ if (!c)
+ c = uc_fn_thisval("ubus.channel");
+
+ if (!c)
+ err_return(UBUS_STATUS_INVALID_ARGUMENT, "Invalid connection context");
+ if (c->ctx.sock.fd < 0)
+ err_return(UBUS_STATUS_CONNECTION_FAILED, "Connection is closed");
+ }
+
+out:
*conn = c;
ok_return(true);
@@ -2606,6 +2632,7 @@ static void free_request(void *ud) {
void uc_module_init(uc_vm_t *vm, uc_value_t *scope)
{
uc_function_list_register(scope, global_fns);
+ uc_function_list_register(scope, conn_fns);
#define ADD_CONST(x) ucv_object_add(scope, #x, ucv_int64_new(UBUS_##x))
ADD_CONST(STATUS_OK);