Skip to content

Commit 2ca4c92

Browse files
committed
dns-client: allow same upstream server with different proxy.
1 parent e3271b0 commit 2ca4c92

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/dns_client.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ static struct addrinfo *_dns_client_getaddr(const char *host, char *port, int ty
447447
}
448448

449449
/* check whether server exists */
450-
static int _dns_client_server_exist(const char *server_ip, int port, dns_server_type_t server_type)
450+
static int _dns_client_server_exist(const char *server_ip, int port, dns_server_type_t server_type, struct client_dns_server_flags *flags)
451451
{
452452
struct dns_server_info *server_info = NULL;
453453
struct dns_server_info *tmp = NULL;
@@ -458,6 +458,10 @@ static int _dns_client_server_exist(const char *server_ip, int port, dns_server_
458458
continue;
459459
}
460460

461+
if (memcmp(&server_info->flags, flags, sizeof(*flags)) == 0) {
462+
continue;
463+
}
464+
461465
if (strncmp(server_info->ip, server_ip, DNS_HOSTNAME_LEN) != 0) {
462466
continue;
463467
}
@@ -1029,7 +1033,7 @@ static int _dns_client_server_add(char *server_ip, char *server_host, int port,
10291033
}
10301034

10311035
/* if server exist, return */
1032-
if (_dns_client_server_exist(server_ip, port, server_type) == 0) {
1036+
if (_dns_client_server_exist(server_ip, port, server_type, flags) == 0) {
10331037
return 0;
10341038
}
10351039

0 commit comments

Comments
 (0)