Merge Official Source

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2023-12-01 17:58:46 +08:00
commit 68a5ed9809
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
9 changed files with 141 additions and 117 deletions

View File

@ -5,9 +5,9 @@ PKG_RELEASE=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git
PKG_MIRROR_HASH:=ec4487b5edc071a127b21a63666c20ac1ad516cd48629ee600a679040c709faf
PKG_SOURCE_DATE:=2023-11-28
PKG_SOURCE_VERSION:=e80dc00ee90c29ef56ae28f414b0e5bb361206e7
PKG_MIRROR_HASH:=7b87783f968eeafd7ae79e5bb04e6c32b2aaaf0e6aca5be6e94b5393fc20807f
PKG_SOURCE_DATE:=2023-11-30
PKG_SOURCE_VERSION:=40acbe34632b8e4e860fe41bb14ab5d7d5c9cfe9
PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE))
CMAKE_INSTALL:=1

View File

@ -11,9 +11,9 @@ PKG_NAME:=udebug
CMAKE_INSTALL:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/udebug.git
PKG_MIRROR_HASH:=c0d3701516dcbe0fe2badbeda50076e4f07ec054c4a80621c7aaf4e83ea75d0c
PKG_SOURCE_DATE:=2023-11-27
PKG_SOURCE_VERSION:=d4b99820afd03a726ea50687d4393007da0fd0df
PKG_MIRROR_HASH:=3f7d32cdfbcbc7a854deefb916a1ee5c5bf59fa154c36fb1e5ff491dae874b8e
PKG_SOURCE_DATE:=2023-11-30
PKG_SOURCE_VERSION:=b613879cb049123dd9dc68d5e6aef60141ebe483
PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE))
PKG_LICENSE:=GPL-2.0

View File

@ -1,8 +1,28 @@
config service procd
option enabled 0
config service log
option enabled 0
option debug 0
option kernel 1
option syslog 1
config service hostapd
option enabled 0
option wpa_log 1
option wpa_nl_rx 0
option wpa_nl_tx 0
option wpa_nl_ctrl 0
config service wpa_supplicant
option enabled 0
option wpa_log 1
option wpa_nl_rx 0
option wpa_nl_tx 0
option wpa_nl_ctrl 0
config service netifd
option enabled 0
config service umdns
option enabled 0

View File

@ -782,33 +782,9 @@ let main_obj = {
},
};
function handle_debug_config(cfg) {
hostapd.printf(`handle_debug_config: ${cfg}\n`);
if (!cfg)
return;
let data = cfg.service;
if (!data)
return;
data = data.hostapd;
if (!data)
return;
hostapd.udebug_set(!!+data.enabled);
}
hostapd.data.ubus = ubus;
hostapd.data.obj = ubus.publish("hostapd", main_obj);
hostapd.data.debug_sub = ubus.subscriber((req) => {
if (req.type != "config")
return;
handle_debug_config(req.data);
});
hostapd.data.debug_sub.subscribe("udebug");
handle_debug_config(ubus.call("udebug", "get_config", {}));
hostapd.udebug_set("hostapd", hostapd.data.ubus);
function bss_event(type, name, data) {
let ubus = hostapd.data.ubus;
@ -823,6 +799,7 @@ return {
shutdown: function() {
for (let phy in hostapd.data.config)
iface_set_config(phy, null);
hostapd.udebug_set(null);
hostapd.ubus.disconnect();
},
bss_add: function(name, obj) {

View File

@ -244,32 +244,9 @@ let main_obj = {
},
};
function handle_debug_config(cfg) {
if (!cfg)
return;
let data = cfg.service;
if (!data)
return;
data = data.wpa_supplicant;
if (!data)
return;
wpas.udebug_set(!!+data.enabled);
}
wpas.data.ubus = ubus;
wpas.data.obj = ubus.publish("wpa_supplicant", main_obj);
wpas.data.debug_sub = ubus.subscriber((req) => {
if (req.type != "config")
return;
handle_debug_config(req.data);
});
wpas.data.debug_sub.subscribe("udebug");
handle_debug_config(ubus.call("udebug", "get_config", {}));
wpas.udebug_set("wpa_supplicant", wpas.data.ubus);
function iface_event(type, name, data) {
let ubus = wpas.data.ubus;

View File

@ -16,8 +16,59 @@ static uc_vm_t vm;
static struct uloop_timeout gc_timer;
static struct udebug ud;
static struct udebug_buf ud_log, ud_nl[3];
static const struct udebug_buf_meta meta_log = {
.name = "wpa_log",
.format = UDEBUG_FORMAT_STRING,
};
static const struct udebug_buf_meta meta_nl_ll = {
.name = "wpa_nl_ctrl",
.format = UDEBUG_FORMAT_PACKET,
.sub_format = UDEBUG_DLT_NETLINK,
};
static const struct udebug_buf_meta meta_nl_tx = {
.name = "wpa_nl_tx",
.format = UDEBUG_FORMAT_PACKET,
.sub_format = UDEBUG_DLT_NETLINK,
};
#define UDEBUG_FLAG_RX_FRAME (1ULL << 0)
static const struct udebug_buf_flag rx_flags[] = {
{ "rx_frame", UDEBUG_FLAG_RX_FRAME },
};
static const struct udebug_buf_meta meta_nl_rx = {
.name = "wpa_nl_rx",
.format = UDEBUG_FORMAT_PACKET,
.sub_format = UDEBUG_DLT_NETLINK,
.flags = rx_flags,
.n_flags = ARRAY_SIZE(rx_flags),
};
static struct udebug_ubus_ring udebug_rings[] = {
{
.buf = &ud_log,
.meta = &meta_log,
.default_entries = 1024,
.default_size = 64 * 1024
},
{
.buf = &ud_nl[0],
.meta = &meta_nl_rx,
.default_entries = 1024,
.default_size = 256 * 1024,
},
{
.buf = &ud_nl[1],
.meta = &meta_nl_tx,
.default_entries = 1024,
.default_size = 64 * 1024,
},
{
.buf = &ud_nl[2],
.meta = &meta_nl_ll,
.default_entries = 1024,
.default_size = 32 * 1024,
}
};
char *udebug_service;
struct udebug_ubus ud_ubus;
static void uc_gc_timer(struct uloop_timeout *timeout)
{
@ -301,68 +352,67 @@ static void udebug_netlink_hook(int tx, const void *data, size_t len)
!(udebug_buf_flags(buf) & UDEBUG_FLAG_RX_FRAME))
return;
if (!udebug_buf_valid(buf))
return;
udebug_entry_init(buf);
udebug_entry_append(buf, &hdr, sizeof(hdr));
udebug_entry_append(buf, data, len);
udebug_entry_add(buf);
}
uc_value_t *uc_wpa_udebug_set(uc_vm_t *vm, size_t nargs)
static void
wpa_udebug_config(struct udebug_ubus *ctx, struct blob_attr *data,
bool enabled)
{
static const struct udebug_buf_meta meta_log = {
.name = "wpa_log",
.format = UDEBUG_FORMAT_STRING,
};
static const struct udebug_buf_meta meta_nl_ll = {
.name = "wpa_nl_ctrl",
.format = UDEBUG_FORMAT_PACKET,
.sub_format = UDEBUG_DLT_NETLINK,
};
static const struct udebug_buf_meta meta_nl_tx = {
.name = "wpa_nl_tx",
.format = UDEBUG_FORMAT_PACKET,
.sub_format = UDEBUG_DLT_NETLINK,
};
static const struct udebug_buf_flag rx_flags[] = {
{ "rx_frame", UDEBUG_FLAG_RX_FRAME },
};
static const struct udebug_buf_meta meta_nl_rx = {
.name = "wpa_nl_rx",
.format = UDEBUG_FORMAT_PACKET,
.sub_format = UDEBUG_DLT_NETLINK,
.flags = rx_flags,
.n_flags = ARRAY_SIZE(rx_flags),
};
bool val = ucv_is_truish(uc_fn_arg(0));
static bool enabled = false;
if (enabled == val)
return ucv_boolean_new(true);
enabled = val;
if (val) {
udebug_init(&ud);
udebug_auto_connect(&ud, NULL);
udebug_buf_init(&ud_log, 1024, 64 * 1024);
udebug_buf_add(&ud, &ud_log, &meta_log);
udebug_buf_init(&ud_nl[0], 1024, 256 * 1024);
udebug_buf_add(&ud, &ud_nl[0], &meta_nl_rx);
udebug_buf_init(&ud_nl[1], 1024, 64 * 1024);
udebug_buf_add(&ud, &ud_nl[1], &meta_nl_tx);
udebug_buf_init(&ud_nl[2], 256, 32 * 1024);
udebug_buf_add(&ud, &ud_nl[2], &meta_nl_ll);
udebug_ubus_apply_config(&ud, udebug_rings, ARRAY_SIZE(udebug_rings),
data, enabled);
if (udebug_buf_valid(&ud_log)) {
wpa_printf_hook = udebug_printf_hook;
wpa_hexdump_hook = udebug_hexdump_hook;
wpa_netlink_hook = udebug_netlink_hook;
} else {
for (size_t i = 0; i < ARRAY_SIZE(ud_nl); i++)
udebug_buf_free(&ud_nl[i]);
udebug_buf_free(&ud_log);
udebug_free(&ud);
wpa_printf_hook = NULL;
wpa_hexdump_hook = NULL;
}
if (udebug_buf_valid(&ud_nl[0]) ||
udebug_buf_valid(&ud_nl[1]) ||
udebug_buf_valid(&ud_nl[2]))
wpa_netlink_hook = udebug_netlink_hook;
else
wpa_netlink_hook = NULL;
}
uc_value_t *uc_wpa_udebug_set(uc_vm_t *vm, size_t nargs)
{
uc_value_t *name = uc_fn_arg(0);
uc_value_t *ubus = uc_fn_arg(1);
static bool enabled = false;
struct ubus_context *ctx;
bool cur_en;
cur_en = ucv_type(name) == UC_STRING;
ctx = ucv_resource_data(ubus, "ubus.connection");
if (!ctx)
cur_en = false;
if (enabled == cur_en)
return ucv_boolean_new(true);
enabled = cur_en;
if (enabled) {
udebug_service = strdup(ucv_string_get(name));
udebug_init(&ud);
udebug_auto_connect(&ud, NULL);
udebug_ubus_init(&ud_ubus, ctx, udebug_service, wpa_udebug_config);
} else {
udebug_ubus_free(&ud_ubus);
for (size_t i = 0; i < ARRAY_SIZE(udebug_rings); i++)
if (udebug_buf_valid(udebug_rings[i].buf))
udebug_buf_free(udebug_rings[i].buf);
udebug_free(&ud);
free(udebug_service);
}
return ucv_boolean_new(true);

View File

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=procd
PKG_RELEASE:=3
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
PKG_MIRROR_HASH:=a7e42525ae65eb1342e593a714e88bc59e46467cbb5a7fd7d7aca4a9815b7c0d
PKG_SOURCE_DATE:=2023-06-25
PKG_SOURCE_VERSION:=2db836553e8fc318143b38dbc6e12b8625cf5c33
PKG_MIRROR_HASH:=48e5d555b5beb15cf936e1d2433b8e614de64a4eaf25293f0211eeb9ac79d534
PKG_SOURCE_DATE:=2023-11-28
PKG_SOURCE_VERSION:=7e6c6efd6fbcc7955801c5e2ac915a90697e1fd9
CMAKE_INSTALL:=1
PKG_LICENSE:=GPL-2.0
@ -40,7 +40,7 @@ CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)"
define Package/procd/Default
SECTION:=base
CATEGORY:=Base system
DEPENDS:=+ubusd +ubus +libjson-script +ubox +libubox \
DEPENDS:=+ubusd +ubus +libjson-script +ubox +libubox +libudebug \
+libubus +libblobmsg-json +libjson-c +jshn
TITLE:=OpenWrt system process manager
USERID:=:dialout=20 :audio=29

View File

@ -1,13 +1,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ubox
PKG_RELEASE:=2
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubox.git
PKG_SOURCE_DATE:=2022-08-13
PKG_SOURCE_VERSION:=4c7b720b9c63b826fb9404e454ae54f2ef5649d5
PKG_MIRROR_HASH:=35178148034dfef36c5fda2bc8217617920bc1a3b86f72efbe87e85048a6a2a8
PKG_SOURCE_DATE:=2023-11-30
PKG_SOURCE_VERSION:=c08709cceb554cba02c935d1442f6a042fe6b2a8
PKG_MIRROR_HASH:=719ae701546df7c5972352d778a980cbc9f48623dda86443398698837124818b
CMAKE_INSTALL:=1
PKG_LICENSE:=GPL-2.0
@ -44,7 +44,7 @@ endef
define Package/logd
SECTION:=base
CATEGORY:=Base system
DEPENDS:=+libubox +libubus +libblobmsg-json
DEPENDS:=+libubox +libubus +libblobmsg-json +libudebug
TITLE:=OpenWrt system log implementation
USERID:=logd=514:logd=514
endef

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:=2023-11-07
PKG_SOURCE_VERSION:=a6e75e02528e36f3610a7f0073453018336def2e
PKG_MIRROR_HASH:=e1a0f98ba865ed5911d5db3bfca55a2f1b825992bf5f7c7e324928d9412d7ae2
PKG_SOURCE_DATE:=2023-11-30
PKG_SOURCE_VERSION:=6e89b89e95bbb140bbff5ab72b8c9632727bf6a6
PKG_MIRROR_HASH:=20ba99f8c2591b581cdf0245dd40301e517659193cddaa3a3888125fcc85b2aa
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
PKG_LICENSE:=ISC