[Dnsmasq-discuss] [PATCH] Handle UBus serialization errors.
The various blob / blobmsg commands can fail, e.g., when memory is low. Previously, those errors were silently discarded. This patch adds checks for the error conditions, logging them and exiting from the functions. Signed-off-by: Etan Kissling --- src/ubus.c | 72 +- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/src/ubus.c b/src/ubus.c index 4d63006..296a496 100644 --- a/src/ubus.c +++ b/src/ubus.c @@ -173,6 +173,16 @@ void check_ubus_listeners() } } +#define CHECK(stmt, ret) \ + do { \ +int e = (stmt); \ +if (e) \ + { \ + my_syslog(LOG_ERR, _("UBus command failed: %d (%s)"), e, #stmt); \ + return (UBUS_STATUS_UNKNOWN_ERROR); \ + } \ + } while (0) + 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) @@ -183,12 +193,13 @@ static int ubus_handle_metrics(struct ubus_context *ctx, struct ubus_object *obj (void)method; (void)msg; - blob_buf_init(&b, BLOBMSG_TYPE_TABLE); + CHECK(blob_buf_init(&b, BLOBMSG_TYPE_TABLE)); for (i=0; i < __METRIC_MAX; i++) -blobmsg_add_u32(&b, get_metric_name(i), daemon->metrics[i]); +CHECK(blobmsg_add_u32(&b, get_metric_name(i), daemon->metrics[i])); - return ubus_send_reply(ctx, req, b.head); + CHECK(ubus_send_reply(ctx, req, b.head)); + return UBUS_STATUS_OK; } #ifdef HAVE_CONNTRACK @@ -307,66 +318,71 @@ fail: } #endif +#undef CHECK + +#define CHECK(stmt, ret) \ + do { \ +int e = (stmt); \ +if (e) \ + { \ + my_syslog(LOG_ERR, _("UBus command failed: %d (%s)"), e, #stmt); \ + return; \ + } \ + } while (0) + void ubus_event_bcast(const char *type, const char *mac, const char *ip, const char *name, const char *interface) { struct ubus_context *ubus = (struct ubus_context *)daemon->ubus; - int ret; if (!ubus || !notify) return; - blob_buf_init(&b, BLOBMSG_TYPE_TABLE); + CHECK(blob_buf_init(&b, BLOBMSG_TYPE_TABLE)); if (mac) -blobmsg_add_string(&b, "mac", mac); +CHECK(blobmsg_add_string(&b, "mac", mac)); if (ip) -blobmsg_add_string(&b, "ip", ip); +CHECK(blobmsg_add_string(&b, "ip", ip)); if (name) -blobmsg_add_string(&b, "name", name); +CHECK(blobmsg_add_string(&b, "name", name)); if (interface) -blobmsg_add_string(&b, "interface", interface); +CHECK(blobmsg_add_string(&b, "interface", interface)); - ret = ubus_notify(ubus, &ubus_object, type, b.head, -1); - if (ret) -my_syslog(LOG_ERR, _("Failed to send UBus event: %s"), ubus_strerror(ret)); + CHECK(ubus_notify(ubus, &ubus_object, type, b.head, -1)); } #ifdef HAVE_CONNTRACK void ubus_event_bcast_connmark_allowlist_refused(u32 mark, const char *name) { struct ubus_context *ubus = (struct ubus_context *)daemon->ubus; - int ret; if (!ubus || !notify) return; - blob_buf_init(&b, 0); - blobmsg_add_u32(&b, "mark", mark); - blobmsg_add_string(&b, "name", name); + CHECK(blob_buf_init(&b, 0)); + CHECK(blobmsg_add_u32(&b, "mark", mark)); + CHECK(blobmsg_add_string(&b, "name", name)); - ret = ubus_notify(ubus, &ubus_object, "connmark-allowlist.refused", b.head, -1); - if (ret) -my_syslog(LOG_ERR, _("Failed to send UBus event: %s"), ubus_strerror(ret)); + CHECK(ubus_notify(ubus, &ubus_object, "connmark-allowlist.refused", b.head, -1)); } void ubus_event_bcast_connmark_allowlist_resolved(u32 mark, const char *name, const char *value, u32 ttl) { struct ubus_context *ubus = (struct ubus_context *)daemon->ubus; - int ret; if (!ubus || !notify) return; - blob_buf_init(&b, 0); - blobmsg_add_u32(&b, "mark", mark); - blobmsg_add_string(&b, "name", name); - blobmsg_add_string(&b, "value", value); - blobmsg_add_u32(&b, "ttl", ttl); + CHECK(blob_buf_init(&b, 0)); + CHECK(blobmsg_add_u32(&b, "mark", mark)); + CHECK(blobmsg_add_string(&b, "name", name)); + CHECK(blobmsg_add_string(&b, "value", value)); + CHECK(blobmsg_add_u32(&b, "ttl", ttl)); - ret = ubus_notify(ubus, &ubus_object, "connmark-allowlist.resolved", b.head, /* timeout: */ 1000); - if (ret) -my_syslog(LOG_ERR, _("Failed to send UBus event: %s"), ubus_strerror(ret)); + // Set timeout to allow UBus subscriber to configure firewall rules before returning. + CHECK(ubus_notify(ubus, &ubus_object, "connmark-allowlist.resolved", b.head, /* timeout: */ 1000)); } #endif +#undef CHECK #endif /* HAVE_UBUS */ -- 2.30.1 (Apple Git-130) ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
[Dnsmasq-discuss] [PATCH] Eliminate redundant UBus `notify` variable.
There was a `notify` variable to keep track whether a subscriber is observing our UBus object. However, it was not properly cleaned up in `ubus_destroy`, potentially becoming stale over UBus reconnections. The variable was removed and the current state is examined when sending notifications, similarly as is done in other existing OpenWrt code. Signed-off-by: Etan Kissling --- src/ubus.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ubus.c b/src/ubus.c index 296a496..37e36fa 100644 --- a/src/ubus.c +++ b/src/ubus.c @@ -21,7 +21,6 @@ #include static struct blob_buf b; -static int notify; static int error_logged = 0; static int ubus_handle_metrics(struct ubus_context *ctx, struct ubus_object *obj, @@ -78,7 +77,6 @@ static void ubus_subscribe_cb(struct ubus_context *ctx, struct ubus_object *obj) (void)ctx; my_syslog(LOG_DEBUG, _("UBus subscription callback: %s subscriber(s)"), obj->has_subscribers ? "1" : "0"); - notify = obj->has_subscribers; } static void ubus_destroy(struct ubus_context *ubus) @@ -334,7 +332,7 @@ void ubus_event_bcast(const char *type, const char *mac, const char *ip, const c { struct ubus_context *ubus = (struct ubus_context *)daemon->ubus; - if (!ubus || !notify) + if (!ubus || !ubus_object.has_subscribers) return; CHECK(blob_buf_init(&b, BLOBMSG_TYPE_TABLE)); @@ -355,7 +353,7 @@ void ubus_event_bcast_connmark_allowlist_refused(u32 mark, const char *name) { struct ubus_context *ubus = (struct ubus_context *)daemon->ubus; - if (!ubus || !notify) + if (!ubus || !ubus_object.has_subscribers) return; CHECK(blob_buf_init(&b, 0)); @@ -369,7 +367,7 @@ void ubus_event_bcast_connmark_allowlist_resolved(u32 mark, const char *name, co { struct ubus_context *ubus = (struct ubus_context *)daemon->ubus; - if (!ubus || !notify) + if (!ubus || !ubus_object.has_subscribers) return; CHECK(blob_buf_init(&b, 0)); -- 2.30.1 (Apple Git-130) ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
[Dnsmasq-discuss] [PATCH] Re-order UBus teardown logic.
When destroying the UBus context, private fields of our ubus_object were being reset to 0 while UBus was still owning those objects. While this seems to work out fine, it seems cleaner to first release the object so that UBus no longer owns it, before proceding to reset those fields. Signed-off-by: Etan Kissling --- src/ubus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ubus.c b/src/ubus.c index 37e36fa..d8cbeca 100644 --- a/src/ubus.c +++ b/src/ubus.c @@ -81,12 +81,12 @@ static void ubus_subscribe_cb(struct ubus_context *ctx, struct ubus_object *obj) static void ubus_destroy(struct ubus_context *ubus) { + ubus_free(ubus); + daemon->ubus = NULL; + // Forces re-initialization when we're reusing the same definitions later on. ubus_object.id = 0; ubus_object_type.id = 0; - - ubus_free(ubus); - daemon->ubus = NULL; } static void ubus_disconnect_cb(struct ubus_context *ubus) -- 2.30.1 (Apple Git-130) ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
[Dnsmasq-discuss] [PATCH v2] Handle UBus serialization errors.
The various blob / blobmsg commands can fail, e.g., when memory is low. Previously, those errors were silently discarded. This patch adds checks for the error conditions, logging them and exiting from the functions. Signed-off-by: Etan Kissling --- v2: Fix compile. src/ubus.c | 72 +- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/src/ubus.c b/src/ubus.c index 4d63006..bac57cb 100644 --- a/src/ubus.c +++ b/src/ubus.c @@ -173,6 +173,16 @@ void check_ubus_listeners() } } +#define CHECK(stmt) \ + do { \ +int e = (stmt); \ +if (e) \ + { \ + my_syslog(LOG_ERR, _("UBus command failed: %d (%s)"), e, #stmt); \ + return (UBUS_STATUS_UNKNOWN_ERROR); \ + } \ + } while (0) + 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) @@ -183,12 +193,13 @@ static int ubus_handle_metrics(struct ubus_context *ctx, struct ubus_object *obj (void)method; (void)msg; - blob_buf_init(&b, BLOBMSG_TYPE_TABLE); + CHECK(blob_buf_init(&b, BLOBMSG_TYPE_TABLE)); for (i=0; i < __METRIC_MAX; i++) -blobmsg_add_u32(&b, get_metric_name(i), daemon->metrics[i]); +CHECK(blobmsg_add_u32(&b, get_metric_name(i), daemon->metrics[i])); - return ubus_send_reply(ctx, req, b.head); + CHECK(ubus_send_reply(ctx, req, b.head)); + return UBUS_STATUS_OK; } #ifdef HAVE_CONNTRACK @@ -307,66 +318,71 @@ fail: } #endif +#undef CHECK + +#define CHECK(stmt) \ + do { \ +int e = (stmt); \ +if (e) \ + { \ + my_syslog(LOG_ERR, _("UBus command failed: %d (%s)"), e, #stmt); \ + return; \ + } \ + } while (0) + void ubus_event_bcast(const char *type, const char *mac, const char *ip, const char *name, const char *interface) { struct ubus_context *ubus = (struct ubus_context *)daemon->ubus; - int ret; if (!ubus || !notify) return; - blob_buf_init(&b, BLOBMSG_TYPE_TABLE); + CHECK(blob_buf_init(&b, BLOBMSG_TYPE_TABLE)); if (mac) -blobmsg_add_string(&b, "mac", mac); +CHECK(blobmsg_add_string(&b, "mac", mac)); if (ip) -blobmsg_add_string(&b, "ip", ip); +CHECK(blobmsg_add_string(&b, "ip", ip)); if (name) -blobmsg_add_string(&b, "name", name); +CHECK(blobmsg_add_string(&b, "name", name)); if (interface) -blobmsg_add_string(&b, "interface", interface); +CHECK(blobmsg_add_string(&b, "interface", interface)); - ret = ubus_notify(ubus, &ubus_object, type, b.head, -1); - if (ret) -my_syslog(LOG_ERR, _("Failed to send UBus event: %s"), ubus_strerror(ret)); + CHECK(ubus_notify(ubus, &ubus_object, type, b.head, -1)); } #ifdef HAVE_CONNTRACK void ubus_event_bcast_connmark_allowlist_refused(u32 mark, const char *name) { struct ubus_context *ubus = (struct ubus_context *)daemon->ubus; - int ret; if (!ubus || !notify) return; - blob_buf_init(&b, 0); - blobmsg_add_u32(&b, "mark", mark); - blobmsg_add_string(&b, "name", name); + CHECK(blob_buf_init(&b, 0)); + CHECK(blobmsg_add_u32(&b, "mark", mark)); + CHECK(blobmsg_add_string(&b, "name", name)); - ret = ubus_notify(ubus, &ubus_object, "connmark-allowlist.refused", b.head, -1); - if (ret) -my_syslog(LOG_ERR, _("Failed to send UBus event: %s"), ubus_strerror(ret)); + CHECK(ubus_notify(ubus, &ubus_object, "connmark-allowlist.refused", b.head, -1)); } void ubus_event_bcast_connmark_allowlist_resolved(u32 mark, const char *name, const char *value, u32 ttl) { struct ubus_context *ubus = (struct ubus_context *)daemon->ubus; - int ret; if (!ubus || !notify) return; - blob_buf_init(&b, 0); - blobmsg_add_u32(&b, "mark", mark); - blobmsg_add_string(&b, "name", name); - blobmsg_add_string(&b, "value", value); - blobmsg_add_u32(&b, "ttl", ttl); + CHECK(blob_buf_init(&b, 0)); + CHECK(blobmsg_add_u32(&b, "mark", mark)); + CHECK(blobmsg_add_string(&b, "name", name)); + CHECK(blobmsg_add_string(&b, "value", value)); + CHECK(blobmsg_add_u32(&b, "ttl", ttl)); - ret = ubus_notify(ubus, &ubus_object, "connmark-allowlist.resolved", b.head, /* timeout: */ 1000); - if (ret) -my_syslog(LOG_ERR, _("Failed to send UBus event: %s"), ubus_strerror(ret)); + // Set timeout to allow UBus subscriber to configure firewall rules before returning. + CHECK(ubus_notify(ubus, &ubus_object, "connmark-allowlist.resolved", b.head, /* timeout: */ 1000)); } #endif +#undef CHECK #endif /* HAVE_UBUS */ -- 2.30.1 (Apple Git-130) ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
[Dnsmasq-discuss] [PATCH] Adjust logging levels for connmark patterns.
This brings the log levels emitted by connmark pattern code in line with the rest of the code base. LOG_DEBUG is used for diagnostics that may be verbose depending on the request patterns. LOG_ERR is used for problems with the implementation itself. Signed-off-by: Etan Kissling --- src/pattern.c | 44 ++-- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/pattern.c b/src/pattern.c index 74f5801..ebcdf16 100644 --- a/src/pattern.c +++ b/src/pattern.c @@ -20,13 +20,13 @@ #define LOG(...) \ do { \ -my_syslog(LOG_WARNING, __VA_ARGS__); \ +my_syslog(LOG_DEBUG, __VA_ARGS__); \ } while (0) #define ASSERT(condition) \ do { \ if (!(condition)) \ - LOG("[pattern.c:%d] Assertion failure: %s", __LINE__, #condition); \ + my_syslog(LOG_ERR, _("[pattern.c:%d] Assertion failure: %s"), __LINE__, #condition); \ } while (0) /** @@ -139,7 +139,7 @@ int is_valid_dns_name(const char *value) (*c < 'A' || *c > 'Z') && (*c < 'a' || *c > 'z')) { - LOG("Invalid DNS name: Invalid character %c.", *c); + LOG(_("Invalid DNS name: Invalid character %c."), *c); return 0; } if (*c) @@ -148,12 +148,12 @@ int is_valid_dns_name(const char *value) { if (!*c || *c == '.') { - LOG("Invalid DNS name: Empty label."); + LOG(_("Invalid DNS name: Empty label.")); return 0; } if (*c == '-') { - LOG("Invalid DNS name: Label starts with hyphen."); + LOG(_("Invalid DNS name: Label starts with hyphen.")); return 0; } label = c; @@ -167,13 +167,13 @@ int is_valid_dns_name(const char *value) { if (c[-1] == '-') { - LOG("Invalid DNS name: Label ends with hyphen."); + LOG(_("Invalid DNS name: Label ends with hyphen.")); return 0; } size_t num_label_bytes = (size_t) (c - label); if (num_label_bytes > 63) { - LOG("Invalid DNS name: Label is too long (%zu).", num_label_bytes); + LOG(_("Invalid DNS name: Label is too long (%zu)."), num_label_bytes); return 0; } num_labels++; @@ -181,12 +181,12 @@ int is_valid_dns_name(const char *value) { if (num_labels < 2) { - LOG("Invalid DNS name: Not enough labels (%zu).", num_labels); + LOG(_("Invalid DNS name: Not enough labels (%zu)."), num_labels); return 0; } if (is_label_numeric) { - LOG("Invalid DNS name: Final label is fully numeric."); + LOG(_("Invalid DNS name: Final label is fully numeric.")); return 0; } if (num_label_bytes == 5 && @@ -196,12 +196,12 @@ int is_valid_dns_name(const char *value) (label[3] == 'a' || label[3] == 'A') && (label[4] == 'l' || label[4] == 'L')) { - LOG("Invalid DNS name: \"local\" pseudo-TLD."); + LOG(_("Invalid DNS name: \"local\" pseudo-TLD.")); return 0; } if (num_bytes < 1 || num_bytes > 253) { - LOG("DNS name has invalid length (%zu).", num_bytes); + LOG(_("DNS name has invalid length (%zu)."), num_bytes); return 0; } return 1; @@ -255,7 +255,7 @@ int is_valid_dns_name_pattern(const char *value) (*c < 'A' || *c > 'Z') && (*c < 'a' || *c > 'z')) { - LOG("Invalid DNS name pattern: Invalid character %c.", *c); + LOG(_("Invalid DNS name pattern: Invalid character %c."), *c); return 0; } if (*c && *c != '*') @@ -264,12 +264,12 @@ int is_valid_dns_name_pattern(const char *value) { if (!*c || *c == '.') { - LOG("Invalid DNS name pattern: Empty label."); + LOG(_("Invalid DNS name pattern: Empty label.")); return 0; } if (*c == '-') { - LOG("Invalid DNS name pattern: Label starts with hyphen."); + LOG(_("Invalid DNS name pattern: Label starts with hyphen.")); return 0; } label = c; @@ -282,7 +282,7 @@ int is_valid_dns_name_pattern(const char *value) { if (num_wildcards >= 2) { - LOG("Invalid DNS name pattern: Wildcard character used more than twice per label."); + LOG(_("Invalid DNS name pattern: Wildcard character used more than twice per label.")); return 0; } num_wildcards++; @@ -292,13 +292,13 @@ int
[Dnsmasq-discuss] [PATCH] Make comment style consistent.
Majority of code base does not use C90-style // end of line comments. This formats the few existing exceptions using /* */ for consistency. --- NOTE: This builds on top of the other patches that I just submitted. src/hash-questions.c | 14 +++--- src/pattern.c| 8 src/ubus.c | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/hash-questions.c b/src/hash-questions.c index 8e1559f..f41023b 100644 --- a/src/hash-questions.c +++ b/src/hash-questions.c @@ -76,9 +76,9 @@ unsigned char *hash_questions(struct dns_header *header, size_t plen, char *name #else /* HAVE_DNSSEC || HAVE_CRYPTOHASH */ -#define SHA256_BLOCK_SIZE 32// SHA256 outputs a 32 byte digest -typedef unsigned char BYTE; // 8-bit byte -typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines +#define SHA256_BLOCK_SIZE 32/* SHA256 outputs a 32 byte digest */ +typedef unsigned char BYTE; /* 8-bit byte */ +typedef unsigned int WORD; /* 32-bit word, change to "long" for 16-bit machines */ typedef struct { BYTE data[64]; @@ -238,7 +238,7 @@ static void sha256_final(SHA256_CTX *ctx, BYTE hash[]) i = ctx->datalen; - // Pad whatever data is left in the buffer. + /* Pad whatever data is left in the buffer. */ if (ctx->datalen < 56) { ctx->data[i++] = 0x80; @@ -254,7 +254,7 @@ static void sha256_final(SHA256_CTX *ctx, BYTE hash[]) memset(ctx->data, 0, 56); } - // Append to the padding the total message's length in bits and transform. + /* Append to the padding the total message's length in bits and transform. */ ctx->bitlen += ctx->datalen * 8; ctx->data[63] = ctx->bitlen; ctx->data[62] = ctx->bitlen >> 8; @@ -266,8 +266,8 @@ static void sha256_final(SHA256_CTX *ctx, BYTE hash[]) ctx->data[56] = ctx->bitlen >> 56; sha256_transform(ctx, ctx->data); - // Since this implementation uses little endian byte ordering and SHA uses big endian, - // reverse all the bytes when copying the final state to the output hash. + /* Since this implementation uses little endian byte ordering and SHA uses big endian, + reverse all the bytes when copying the final state to the output hash. */ for (i = 0; i < 4; ++i) { hash[i] = (ctx->state[0] >> (24 - i * 8)) & 0x00ff; diff --git a/src/pattern.c b/src/pattern.c index ebcdf16..03e23b9 100644 --- a/src/pattern.c +++ b/src/pattern.c @@ -66,8 +66,8 @@ static int is_string_matching_glob_pattern( pattern_character -= 'a' - 'A'; if (pattern_character == '*') { - // zero-or-more-character wildcard - // Try to match at value_index, otherwise restart at value_index + 1 next. + /* zero-or-more-character wildcard */ + /* Try to match at value_index, otherwise restart at value_index + 1 next. */ next_pattern_index = pattern_index; pattern_index++; if (value_index < num_value_bytes) @@ -78,7 +78,7 @@ static int is_string_matching_glob_pattern( } else { - // ordinary character + /* ordinary character */ if (value_index < num_value_bytes) { char value_character = value[value_index]; @@ -249,7 +249,7 @@ int is_valid_dns_name_pattern(const char *value) for (const char *c = value;; c++) { if (*c && - *c != '*' && // Wildcard. + *c != '*' && /* Wildcard. */ *c != '-' && *c != '.' && (*c < '0' || *c > '9') && (*c < 'A' || *c > 'Z') && diff --git a/src/ubus.c b/src/ubus.c index f1cd63e..0c502ad 100644 --- a/src/ubus.c +++ b/src/ubus.c @@ -84,7 +84,7 @@ static void ubus_destroy(struct ubus_context *ubus) ubus_free(ubus); daemon->ubus = NULL; - // Forces re-initialization when we're reusing the same definitions later on. + /* Forces re-initialization when we're reusing the same definitions later on. */ ubus_object.id = 0; ubus_object_type.id = 0; } @@ -376,7 +376,7 @@ void ubus_event_bcast_connmark_allowlist_resolved(u32 mark, const char *name, co CHECK(blobmsg_add_string(&b, "value", value)); CHECK(blobmsg_add_u32(&b, "ttl", ttl)); - // Set timeout to allow UBus subscriber to configure firewall rules before returning. + /* Set timeout to allow UBus subscriber to configure firewall rules before returning. */ CHECK(ubus_notify(ubus, &ubus_object, "connmark-allowlist.resolved", b.head, /* timeout: */ 1000)); } #endif -- 2.30.1 (Apple Git-130) ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
[Dnsmasq-discuss] Dnsmasq replying with refuse without forwarding request to upstream server.
Hi All, Any thoughts why dnsmasq is replying with REFUSE response without forwarding the query to upstream server? Nslookup always fails with refuse response from the external client. I have the upstream server configured on conf file as server=8.8.8.8@eth0 Regards, Sunil ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Change in behaviour of --server
On Fri, Jul 09, 2021 at 02:10:23PM +0200, Petr Menšík wrote: > On 7/6/21 10:23 PM, Simon Kelley wrote: > > On 06/07/2021 12:14, Kevin Darbyshire-Bryant wrote: > >> Hi Simon, > >> > >> An eager OpenWrt tester of current dnsmasq master has noticed the > >> following change in behaviour: > > I have to say, I am very much liking the amount of testing that the > > new code is getting. It's great to find these regressions _before_ > > release. > > > Hi Simon, > > would you please tag another test version after fixing build of dbus > builds? I tried building a test package for Fedora [1], but I would > have to backport dbus fixes. No recent test release works with dbus > enabled, which is required on Fedora. > > Thanks! Tag 2.86test6 has been announced[2], does it build for Fedora?[3] > Cheers, > Petr Groeten Geert Stappers 1. https://copr.fedorainfracloud.org/coprs/pemensik/dnsmasq/build/2312608/ 2. https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2021q3/015320.html 3. https://copr.fedorainfracloud.org/coprs/pemensik/dnsmasq/builds/ -- Silence is hard to parse ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Dnsmasq replying with refuse without forwarding request to upstream server.
Two possible reasons: 1) resource exhaustion - the limit on the number of "in-flight" queries has been reached. 2) Network errors sending the query upstream. As a start of debugging, I'd try without the @eth0 interface specifier. Simon. On 22/07/2021 18:21, sunil rathod wrote: > Hi All, > Any thoughts why dnsmasq is replying with REFUSE response without > forwarding the query to upstream server? Nslookup always fails with > refuse response from the external client. I have the upstream server > configured on conf file as > server=8.8.8.8@eth0 > Regards, > Sunil > > > ___ > Dnsmasq-discuss mailing list > Dnsmasq-discuss@lists.thekelleys.org.uk > https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss > ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Dnsmasq replying with refuse without forwarding request to upstream server.
Hello Simon, I still see the problem after removing interface from server= config. I restarted dnsmasq, for some reason dnsmasq not liking the dns query. As soon as it receives the query sends back the REFUSE response without forwarding to upstream server. Sunil. On Fri, Jul 23, 2021, 03:05 Simon Kelley wrote: > Two possible reasons: 1) resource exhaustion - the limit on the number > of "in-flight" queries has been reached. 2) Network errors sending the > query upstream. As a start of debugging, I'd try without the @eth0 > interface specifier. > > Simon. > > > On 22/07/2021 18:21, sunil rathod wrote: > > Hi All, > > Any thoughts why dnsmasq is replying with REFUSE response without > > forwarding the query to upstream server? Nslookup always fails with > > refuse response from the external client. I have the upstream server > > configured on conf file as > > server=8.8.8.8@eth0 > > Regards, > > Sunil > > > > > > ___ > > Dnsmasq-discuss mailing list > > Dnsmasq-discuss@lists.thekelleys.org.uk > > https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss > > > > ___ > Dnsmasq-discuss mailing list > Dnsmasq-discuss@lists.thekelleys.org.uk > https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss > ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Dnsmasq replying with refuse without forwarding request to upstream server.
Hey Sunil, I encountered this situation only when dnsmasq didn't have any working upstream server it could forward your query to. Could you please 1. add "log-queries=extra" and "log-facility=/tmp/dnsmasq.log" to your configuration, 2. restart dnsmasq, 3. do the DNS query that ends up in REFUSED, and 4. send us the generated log file Maybe it reveals something of interest. Best, Dominik On Fri, 2021-07-23 at 10:58 +0530, sunil rathod wrote: > > Hello Simon, I still see the problem after removing interface from > server= config. I restarted dnsmasq, for some reason dnsmasq not > liking the dns query. As soon as it receives the query sends back > the REFUSE response without forwarding to upstream server. > > Sunil. > > On Fri, Jul 23, 2021, 03:05 Simon Kelley > wrote: > > Two possible reasons: 1) resource exhaustion - the limit on the > > number > > of "in-flight" queries has been reached. 2) Network errors sending > > the > > query upstream. As a start of debugging, I'd try without the @eth0 > > interface specifier. > > > > Simon. > > > > > > On 22/07/2021 18:21, sunil rathod wrote: > > > Hi All, > > > Any thoughts why dnsmasq is replying with REFUSE response without > > > forwarding the query to upstream server? Nslookup always fails > > with > > > refuse response from the external client. I have the upstream > > server > > > configured on conf file as > > > server=8.8.8.8@eth0 > > > Regards, > > > Sunil > > > > > > > > > ___ > > > Dnsmasq-discuss mailing list > > > Dnsmasq-discuss@lists.thekelleys.org.uk > > > > > https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss > > > > > > > ___ > > Dnsmasq-discuss mailing list > > Dnsmasq-discuss@lists.thekelleys.org.uk > > https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss > ___ > Dnsmasq-discuss mailing list > Dnsmasq-discuss@lists.thekelleys.org.uk > https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss