diff options
author | Felix Fietkau <nbd@nbd.name> | 2021-11-10 10:07:02 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2021-11-10 10:07:04 +0100 |
commit | 0b79e7c01e42898547eddefc9efc030f2e772b93 (patch) | |
tree | 7fd29f5b9d4d9fb893aa207bc900c58e527d4225 /package/network/services/dnsmasq | |
parent | 694aed607fbc0a0599f1ff951e5af280500339f9 (diff) | |
download | upstream-0b79e7c01e42898547eddefc9efc030f2e772b93.tar.gz upstream-0b79e7c01e42898547eddefc9efc030f2e772b93.tar.bz2 upstream-0b79e7c01e42898547eddefc9efc030f2e772b93.zip |
dnsmasq: generate the dns object name dynamically
Fixes an issue with running multiple dnsmasq instances
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'package/network/services/dnsmasq')
-rw-r--r-- | package/network/services/dnsmasq/patches/200-ubus_dns.patch | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/package/network/services/dnsmasq/patches/200-ubus_dns.patch b/package/network/services/dnsmasq/patches/200-ubus_dns.patch index 506a413ae2..03fc5b50b3 100644 --- a/package/network/services/dnsmasq/patches/200-ubus_dns.patch +++ b/package/network/services/dnsmasq/patches/200-ubus_dns.patch @@ -162,7 +162,7 @@ ttl = find_soa(header, qlen, doctored); --- a/src/ubus.c +++ b/src/ubus.c -@@ -72,6 +72,14 @@ static struct ubus_object ubus_object = +@@ -72,6 +72,13 @@ static struct ubus_object ubus_object = .subscribe_cb = ubus_subscribe_cb, }; @@ -170,23 +170,35 @@ + { .name = "dnsmasq.dns" }; + +static struct ubus_object ubus_dns_object = { -+ .name = "dnsmasq.dns", + .type = &ubus_dns_object_type, +}; + static void ubus_subscribe_cb(struct ubus_context *ctx, struct ubus_object *obj) { (void)ctx; -@@ -112,6 +120,8 @@ char *ubus_init() +@@ -105,13 +112,21 @@ static void ubus_disconnect_cb(struct ub + char *ubus_init() + { + struct ubus_context *ubus = NULL; ++ char *dns_name; + int ret = 0; + + if (!(ubus = ubus_connect(NULL))) + return NULL; ++ dns_name = whine_malloc(strlen(daemon->ubus_name) + 5); ++ sprintf(dns_name, "%s.dns", daemon->ubus_name); ++ ubus_object.name = daemon->ubus_name; ++ ubus_dns_object.name = dns_name; ++ ret = ubus_add_object(ubus, &ubus_object); + if (!ret) + ret = ubus_add_object(ubus, &ubus_dns_object); if (ret) { ubus_destroy(ubus); -@@ -181,6 +191,17 @@ void check_ubus_listeners() +@@ -181,6 +196,17 @@ void check_ubus_listeners() } \ } while (0) @@ -204,7 +216,7 @@ static int ubus_handle_metrics(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg) -@@ -328,6 +349,50 @@ fail: +@@ -328,6 +354,50 @@ fail: } \ } while (0) |