From 79a5708c79edee469c1c92f8e8298684ea80ddad Mon Sep 17 00:00:00 2001 From: John Crispin Date: Mon, 25 Mar 2024 11:18:19 +0100 Subject: [PATCH 44/68] umdns: update to latest HEAD Signed-off-by: John Crispin --- package/network/services/umdns/Makefile | 8 +- .../0001-Revert-add-udebug-support.patch | 225 ++++++++++++++++++ 2 files changed, 229 insertions(+), 4 deletions(-) create mode 100644 package/network/services/umdns/patches/0001-Revert-add-udebug-support.patch diff --git a/package/network/services/umdns/Makefile b/package/network/services/umdns/Makefile index b7564fa7c3..163ef14faf 100644 --- a/package/network/services/umdns/Makefile +++ b/package/network/services/umdns/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=umdns -PKG_RELEASE:=5 +PKG_RELEASE:=1 PKG_SOURCE_URL=$(PROJECT_GIT)/project/mdnsd.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2023-01-16 -PKG_SOURCE_VERSION:=65b3308d13de7d7975444d34389651612e2a4d38 -PKG_MIRROR_HASH:=945fdf51a299b68982aab74e8fba5614f2553a7b4c49a3a53b3093ea8aac0279 +PKG_SOURCE_DATE:=2024-01-08 +PKG_SOURCE_VERSION:=e91ed406ecebb4bc08c346929e25f1b819c19edd +PKG_MIRROR_HASH:=6568409c5facaa37dc27aeca67dc798b822c2e2897d6e067b4c61e3e99c1072c PKG_MAINTAINER:=John Crispin PKG_LICENSE:=LGPL-2.1 diff --git a/package/network/services/umdns/patches/0001-Revert-add-udebug-support.patch b/package/network/services/umdns/patches/0001-Revert-add-udebug-support.patch new file mode 100644 index 0000000000..b5e3d040f5 --- /dev/null +++ b/package/network/services/umdns/patches/0001-Revert-add-udebug-support.patch @@ -0,0 +1,225 @@ +From dae6458b2466c0bd961a542d652777ad37081be0 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 25 Mar 2024 10:21:11 +0100 +Subject: [PATCH] Revert "add udebug support" + +This reverts commit b1e023eda3584da4a5dfbc33016839f977a02040. +--- + CMakeLists.txt | 6 ++-- + main.c | 48 -------------------------------- + ubus.c | 74 -------------------------------------------------- + util.h | 4 --- + 4 files changed, 2 insertions(+), 130 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 84834f1..f1bc8f0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,16 +9,14 @@ SET(SOURCES dns.c announce.c cache.c service.c util.c ubus.c interface.c) + + FIND_PATH(ubox_include_dir NAMES libubox/usock.h) + FIND_PATH(ubus_include_dir NAMES libubus.h) +-FIND_PATH(udebug_include_dir NAMES udebug.h) +-INCLUDE_DIRECTORIES(${ubox_include_dir} ${ubus_include_dir} ${udebug_include_dir}) ++INCLUDE_DIRECTORIES(${ubox_include_dir} ${ubus_include_dir}) + + FIND_LIBRARY(ubox NAMES ubox) + FIND_LIBRARY(ubus NAMES ubus) + FIND_LIBRARY(blobmsg_json NAMES blobmsg_json) + FIND_LIBRARY(json NAMES json json-c) +-FIND_LIBRARY(udebug NAMES udebug) + +-SET(LIBS ${ubox} ${ubus} ${blobmsg_json} ${json} resolv ${udebug}) ++SET(LIBS ${ubox} ${ubus} ${blobmsg_json} ${json} resolv) + + IF(DEBUG) + ADD_DEFINITIONS(-DDEBUG -g3) +diff --git a/main.c b/main.c +index 752e78a..02d13f5 100644 +--- a/main.c ++++ b/main.c +@@ -26,7 +26,6 @@ + #include + #include + +-#include + #include + #include + +@@ -41,53 +40,6 @@ + int cfg_proto = 0; + int cfg_no_subnet = 0; + +-static struct udebug ud; +-static struct udebug_buf udb; +-static bool udebug_enabled; +- +-static void +-umdns_udebug_vprintf(const char *format, va_list ap) +-{ +- if (!udebug_enabled) +- return; +- +- udebug_entry_init(&udb); +- udebug_entry_vprintf(&udb, format, ap); +- udebug_entry_add(&udb); +-} +- +-void umdns_udebug_printf(const char *format, ...) +-{ +- va_list ap; +- +- va_start(ap, format); +- umdns_udebug_vprintf(format, ap); +- va_end(ap); +-} +- +-void umdns_udebug_set_enabled(bool val) +-{ +- static const struct udebug_buf_meta meta = { +- .name = "umdns_log", +- .format = UDEBUG_FORMAT_STRING, +- }; +- +- if (udebug_enabled == val) +- return; +- +- udebug_enabled = val; +- if (!val) { +- udebug_buf_free(&udb); +- udebug_free(&ud); +- return; +- } +- +- udebug_init(&ud); +- udebug_auto_connect(&ud, NULL); +- udebug_buf_init(&udb, 1024, 64 * 1024); +- udebug_buf_add(&ud, &udb, &meta); +-} +- + static void + signal_shutdown(int signal) + { +diff --git a/ubus.c b/ubus.c +index 6991278..cdb699e 100644 +--- a/ubus.c ++++ b/ubus.c +@@ -28,7 +28,6 @@ + + static struct ubus_auto_conn conn; + static struct blob_buf b; +-static struct ubus_subscriber udebug_sub; + + static int + umdns_reload(struct ubus_context *ctx, struct ubus_object *obj, +@@ -285,87 +284,14 @@ static struct ubus_object umdns_object = { + .n_methods = ARRAY_SIZE(umdns_methods), + }; + +-static struct blob_attr * +-find_attr(struct blob_attr *attr, const char *name, enum blobmsg_type type) +-{ +- struct blobmsg_policy policy = { name, type }; +- struct blob_attr *ret; +- +- if (!attr) +- return NULL; +- +- blobmsg_parse_attr(&policy, 1, &ret, attr); +- +- return ret; +-} +- +-static void +-umdns_udebug_config_cb(struct blob_attr *data) +-{ +- enum { +- CFG_ATTR_ENABLED, +- __CFG_ATTR_MAX +- }; +- static const struct blobmsg_policy policy[__CFG_ATTR_MAX] = { +- [CFG_ATTR_ENABLED] = { "enabled", BLOBMSG_TYPE_STRING }, +- }; +- struct blob_attr *tb[__CFG_ATTR_MAX]; +- bool en; +- +- data = find_attr(data, "service", BLOBMSG_TYPE_TABLE); +- data = find_attr(data, "umdns", BLOBMSG_TYPE_TABLE); +- if (!data) +- return; +- +- blobmsg_parse_attr(policy, __CFG_ATTR_MAX, tb, data); +- if (!tb[CFG_ATTR_ENABLED]) +- return; +- +- en = !!atoi(blobmsg_get_string(tb[CFG_ATTR_ENABLED])); +- umdns_udebug_set_enabled(en); +-} +- +-static int +-umdns_udebug_notify_cb(struct ubus_context *ctx, struct ubus_object *obj, +- struct ubus_request_data *req, const char *method, +- struct blob_attr *msg) +-{ +- umdns_udebug_config_cb(msg); +- +- return 0; +-} +- +-static void +-umdns_udebug_req_cb(struct ubus_request *req, int type, struct blob_attr *msg) +-{ +- umdns_udebug_config_cb(msg); +-} +- +-static bool +-umdns_udebug_sub_cb(struct ubus_context *ctx, struct ubus_subscriber *sub, +- const char *path) +-{ +- return !strcmp(path, "udebug"); +-} +- +- + static void + ubus_connect_handler(struct ubus_context *ctx) + { +- uint32_t id; + int ret; + + ret = ubus_add_object(ctx, &umdns_object); + if (ret) + fprintf(stderr, "Failed to add object: %s\n", ubus_strerror(ret)); +- +- udebug_sub.cb = umdns_udebug_notify_cb; +- udebug_sub.new_obj_cb = umdns_udebug_sub_cb; +- ubus_register_subscriber(&conn.ctx, &udebug_sub); +- if (ubus_lookup_id(&conn.ctx, "udebug", &id) == 0) { +- ubus_subscribe(&conn.ctx, &udebug_sub, id); +- ubus_invoke(&conn.ctx, id, "get_config", NULL, umdns_udebug_req_cb, NULL, 1000); +- } + } + + void +diff --git a/util.h b/util.h +index 57afcd3..c0db9e7 100644 +--- a/util.h ++++ b/util.h +@@ -18,7 +18,6 @@ + #include + + #define DBG(level, fmt, ...) do { \ +- umdns_udebug_printf("[%d] [%s:%d] " fmt, level, __func__, __LINE__, ## __VA_ARGS__); \ + if (debug >= level) \ + fprintf(stderr, "mdnsd: %s (%d): " fmt, __func__, __LINE__, ## __VA_ARGS__); \ + } while (0) +@@ -42,7 +41,4 @@ extern void get_hostname(void); + extern uint32_t rand_time_delta(uint32_t t); + extern time_t monotonic_time(void); + +-void umdns_udebug_set_enabled(bool val); +-void umdns_udebug_printf(const char *format, ...); +- + #endif +-- +2.34.1 + -- 2.34.1