Skip to content

Commit

Permalink
dns: suppress log
Browse files Browse the repository at this point in the history
  • Loading branch information
pymumu committed May 6, 2023
1 parent ccadadd commit ed102cd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 2 additions & 0 deletions package/openwrt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions src/dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/dns.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/dns_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ed102cd

Please sign in to comment.