From ed102cda03c56e9c63040d33d4a391b56491493e Mon Sep 17 00:00:00 2001 From: Nick Peng Date: Sat, 6 May 2023 21:56:57 +0800 Subject: [PATCH] dns: suppress log --- package/openwrt/Makefile | 2 ++ src/dns.c | 16 ++++++++-------- src/dns.h | 2 +- src/dns_client.c | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/package/openwrt/Makefile b/package/openwrt/Makefile index 2f34225..22d2fcd 100644 --- a/package/openwrt/Makefile +++ b/package/openwrt/Makefile @@ -44,6 +44,8 @@ define Package/smartdns/conffiles /etc/smartdns/address.conf /etc/smartdns/blacklist-ip.conf /etc/smartdns/custom.conf +/etc/smartdns/domain-block.list +/etc/smartdns/domain-forwarding.list endef define Package/smartdns/install diff --git a/src/dns.c b/src/dns.c index b3d83b6..7e15659 100644 --- a/src/dns.c +++ b/src/dns.c @@ -2157,7 +2157,7 @@ static int _dns_decode_an(struct dns_context *context, dns_rr_type type) ret = dns_add_A(packet, type, domain, ttl, addr); if (ret < 0) { - tlog(TLOG_ERROR, "add A failed, %s", domain); + tlog(TLOG_DEBUG, "add A failed, %s", domain); return -1; } } break; @@ -2172,7 +2172,7 @@ static int _dns_decode_an(struct dns_context *context, dns_rr_type type) ret = dns_add_CNAME(packet, type, domain, ttl, cname); if (ret < 0) { - tlog(TLOG_ERROR, "add CNAME failed, %s", domain); + tlog(TLOG_DEBUG, "add CNAME failed, %s", domain); return -1; } } break; @@ -2186,7 +2186,7 @@ static int _dns_decode_an(struct dns_context *context, dns_rr_type type) ret = dns_add_SOA(packet, type, domain, ttl, &soa); if (ret < 0) { - tlog(TLOG_ERROR, "add SOA failed, %s", domain); + tlog(TLOG_DEBUG, "add SOA failed, %s", domain); return -1; } } break; @@ -2200,7 +2200,7 @@ static int _dns_decode_an(struct dns_context *context, dns_rr_type type) ret = dns_add_NS(packet, type, domain, ttl, ns); if (ret < 0) { - tlog(TLOG_ERROR, "add NS failed, %s", domain); + tlog(TLOG_DEBUG, "add NS failed, %s", domain); return -1; } } break; @@ -2214,7 +2214,7 @@ static int _dns_decode_an(struct dns_context *context, dns_rr_type type) ret = dns_add_PTR(packet, type, domain, ttl, name); if (ret < 0) { - tlog(TLOG_ERROR, "add PTR failed, %s", domain); + tlog(TLOG_DEBUG, "add PTR failed, %s", domain); return -1; } } break; @@ -2228,7 +2228,7 @@ static int _dns_decode_an(struct dns_context *context, dns_rr_type type) ret = dns_add_AAAA(packet, type, domain, ttl, addr); if (ret < 0) { - tlog(TLOG_ERROR, "add AAAA failed, %s", domain); + tlog(TLOG_DEBUG, "add AAAA failed, %s", domain); return -1; } } break; @@ -2275,7 +2275,7 @@ static int _dns_decode_an(struct dns_context *context, dns_rr_type type) ret = _dns_add_RAW(packet, type, qtype, domain, ttl, raw_data, rr_len); if (ret < 0) { - tlog(TLOG_ERROR, "add raw failed, %s", domain); + tlog(TLOG_DEBUG, "add raw failed, %s", domain); return -1; } @@ -2285,7 +2285,7 @@ static int _dns_decode_an(struct dns_context *context, dns_rr_type type) } if (context->ptr - start != rr_len) { - tlog(TLOG_ERROR, "length mismatch, %s, %ld:%d", domain, (long)(context->ptr - start), rr_len); + tlog(TLOG_DEBUG, "length mismatch, %s, %ld:%d", domain, (long)(context->ptr - start), rr_len); return -1; } diff --git a/src/dns.h b/src/dns.h index 8bd9ee6..e56691f 100644 --- a/src/dns.h +++ b/src/dns.h @@ -28,7 +28,7 @@ extern "C" { #define DNS_MAX_CNAME_LEN 256 #define DNS_MAX_OPT_LEN 256 #define DNS_IN_PACKSIZE (512 * 8) -#define DNS_PACKSIZE (512 * 12) +#define DNS_PACKSIZE (512 * 16) #define DNS_DEFAULT_PACKET_SIZE 512 #define DNS_MAX_ALPN_LEN 32 #define DNS_MAX_ECH_LEN 256 diff --git a/src/dns_client.c b/src/dns_client.c index ce9f7d8..dd35a39 100644 --- a/src/dns_client.c +++ b/src/dns_client.c @@ -3537,7 +3537,7 @@ static int _dns_client_send_packet(struct dns_query_struct *query, void *packet, server_info->type); time_t now = 0; time(&now); - if (now - 5 > server_info->last_recv || send_err != ENOMEM) { + if (now - 10 > server_info->last_recv || send_err != ENOMEM) { server_info->prohibit = 1; tlog(TLOG_INFO, "server %s not alive, prohibit", server_info->ip); _dns_client_shutdown_socket(server_info);