blob: 963cea1348facd5eaf2c3c27e8b6d23192ee4f05 [file] [log] [blame]
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 28ab9ca..5ad8695 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,13 +33,11 @@ FIND_LIBRARY(uci NAMES uci)
FIND_LIBRARY(ubox NAMES ubox)
FIND_LIBRARY(ubus NAMES ubus)
FIND_LIBRARY(json NAMES json-c json)
-FIND_LIBRARY(udebug NAMES udebug)
FIND_LIBRARY(blobmsg_json NAMES blobmsg_json)
-SET(LIBS ${ubox} ${ubus} ${uci} ${json} ${blobmsg_json} ${udebug})
+SET(LIBS ${ubox} ${ubus} ${uci} ${json} ${blobmsg_json})
FIND_PATH(ubox_include_dir libubox/usock.h)
-FIND_PATH(udebug_include_dir udebug.h)
INCLUDE_DIRECTORIES(${ubox_include_dir})
IF (NOT DEFINED LIBNL_LIBS)
diff --git a/main.c b/main.c
index 403dc12..ec7b1be 100644
--- a/main.c
+++ b/main.c
@@ -19,8 +19,6 @@
#include <stdarg.h>
#include <syslog.h>
-#include <udebug.h>
-
#include "netifd.h"
#include "ubus.h"
#include "config.h"
@@ -37,9 +35,6 @@ const char *resolv_conf = DEFAULT_RESOLV_CONF;
static char **global_argv;
static struct list_head process_list = LIST_HEAD_INIT(process_list);
-static struct udebug ud;
-static struct udebug_buf udb;
-static bool udebug_enabled;
#define DEFAULT_LOG_LEVEL L_NOTICE
@@ -68,49 +63,6 @@ netifd_delete_process(struct netifd_process *proc)
close(proc->log.fd.fd);
}
-static void
-netifd_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 netifd_udebug_printf(const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- netifd_udebug_vprintf(format, ap);
- va_end(ap);
-}
-
-void netifd_udebug_set_enabled(bool val)
-{
- static const struct udebug_buf_meta meta = {
- .name = "netifd_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);
-}
-
void
__attribute__((format(printf, 2, 0)))
netifd_log_message(int priority, const char *format, ...)
@@ -121,7 +73,6 @@ netifd_log_message(int priority, const char *format, ...)
return;
va_start(vl, format);
- netifd_udebug_vprintf(format, vl);
if (use_syslog)
vsyslog(log_class[priority], format, vl);
else
diff --git a/netifd.h b/netifd.h
index c579e7c..9645a0a 100644
--- a/netifd.h
+++ b/netifd.h
@@ -70,7 +70,6 @@ enum {
#ifdef DEBUG
#define DPRINTF(format, ...) fprintf(stderr, "%s(%d): " format, __func__, __LINE__, ## __VA_ARGS__)
#define D(level, format, ...) do { \
- netifd_udebug_printf("[" #level "] %s(%d): " format, __func__, __LINE__, ## __VA_ARGS__); \
if (debug_mask & (1 << (DEBUG_ ## level))) \
DPRINTF(format, ##__VA_ARGS__); \
} while (0)
@@ -96,8 +95,6 @@ struct netifd_process {
bool log_overflow;
};
-void netifd_udebug_printf(const char *format, ...);
-void netifd_udebug_set_enabled(bool val);
void netifd_log_message(int priority, const char *format, ...);
int netifd_start_process(const char **argv, char **env, struct netifd_process *proc);
diff --git a/ubus.c b/ubus.c
index 55daec1..40fc9f4 100644
--- a/ubus.c
+++ b/ubus.c
@@ -27,7 +27,6 @@
struct ubus_context *ubus_ctx = NULL;
static struct blob_buf b;
static const char *ubus_path;
-struct ubus_subscriber udebug_sub;
/* global object */
@@ -1366,74 +1365,9 @@ netifd_extdev_invoke(uint32_t id, const char *method, struct blob_attr *msg,
return ubus_invoke(ubus_ctx, id, method, msg, data_cb, data, 3000);
}
-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
-netifd_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, "netifd", 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]));
- netifd_udebug_set_enabled(en);
-}
-
-static int
-netifd_udebug_notify_cb(struct ubus_context *ctx, struct ubus_object *obj,
- struct ubus_request_data *req, const char *method,
- struct blob_attr *msg)
-{
- netifd_udebug_config_cb(msg);
-
- return 0;
-}
-
-static void
-netifd_udebug_req_cb(struct ubus_request *req, int type, struct blob_attr *msg)
-{
- netifd_udebug_config_cb(msg);
-}
-
-static bool
-netifd_udebug_sub_cb(struct ubus_context *ctx, struct ubus_subscriber *sub,
- const char *path)
-{
- return !strcmp(path, "udebug");
-}
-
int
netifd_ubus_init(const char *path)
{
- uint32_t id;
-
uloop_init();
ubus_path = path;
@@ -1450,14 +1384,6 @@ netifd_ubus_init(const char *path)
netifd_add_object(&wireless_object);
netifd_add_iface_object();
- udebug_sub.cb = netifd_udebug_notify_cb;
- udebug_sub.new_obj_cb = netifd_udebug_sub_cb;
- ubus_register_subscriber(ubus_ctx, &udebug_sub);
- if (ubus_lookup_id(ubus_ctx, "udebug", &id) == 0) {
- ubus_subscribe(ubus_ctx, &udebug_sub, id);
- ubus_invoke(ubus_ctx, id, "get_config", NULL, netifd_udebug_req_cb, NULL, 1000);
- }
-
return 0;
}