Skip to content

Commit

Permalink
dns_client: avoid disconnect with server after query complete
Browse files Browse the repository at this point in the history
  • Loading branch information
pymumu committed Aug 24, 2020
1 parent b8a36cc commit a3d3364
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/dns_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1468,7 +1468,7 @@ static int _dns_client_recv(struct dns_server_info *server_info, unsigned char *
}

_dns_client_query_release(query);
return ret;
return 0;
}

static int _dns_client_create_socket_udp(struct dns_server_info *server_info)
Expand Down
12 changes: 8 additions & 4 deletions src/dns_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1778,19 +1778,19 @@ static int _dns_server_setup_ipset_packet(struct dns_request *request, struct dn
struct dns_rule_flags *rule_flags = NULL;

if (_dns_server_has_bind_flag(request, BIND_FLAG_NO_RULE_IPSET) == 0) {
return -1;
return 0;
}
/* check ipset rule */
rule_flags = request->domain_rule.rules[DOMAIN_RULE_FLAGS];
if (rule_flags) {
if (rule_flags->flags & DOMAIN_FLAG_IPSET_IGNORE) {
return -1;
return 0;
}
}

ipset_rule = request->domain_rule.rules[DOMAIN_RULE_IPSET];
if (ipset_rule == NULL) {
return -1;
return 0;
}

for (j = 1; j < DNS_RRS_END; j++) {
Expand Down Expand Up @@ -1883,7 +1883,11 @@ static int _dns_server_reply_passthrouth(struct dns_request *request, struct dns
}
}

return _dns_server_setup_ipset_packet(request, packet);
if(_dns_server_setup_ipset_packet(request, packet) != 0) {
tlog(TLOG_DEBUG, "setup ipset failed.");
}

return 0;
}

static int dns_server_resolve_callback(char *domain, dns_result_type rtype, unsigned int result_flag,
Expand Down

0 comments on commit a3d3364

Please sign in to comment.