mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 07:35:18 +00:00
dnsmgr.c: dnsmgr_refresh() incorrectly flags change with DNS round-robin
The dnsmgr_refresh() function checks to see if the IP address associated with a name/service has changed. The gotcha is that the ast_get_ip_or_srv() function only returns the first IP address returned by the DNS query. If there are multiple IPs associated with the name and the returned order is not consistent (e.g. with DNS round-robin) then the other IP addresses are not included in the comparison and the entry is flagged as changed even though the IP is still valid. Updated the code to check all IP addresses and flag a change only if the original IP is no longer valid. Resolves: #924
This commit is contained in:
@@ -211,7 +211,7 @@ static int dnsmgr_refresh(struct ast_dnsmgr_entry *entry, int verbose)
|
||||
ast_debug(6, "refreshing '%s'\n", entry->name);
|
||||
|
||||
tmp.ss.ss_family = entry->family;
|
||||
if (!ast_get_ip_or_srv(&tmp, entry->name, entry->service)) {
|
||||
if (!ast_get_ip_or_srv_with_preference(&tmp, entry->name, entry->service, entry->result)) {
|
||||
if (!ast_sockaddr_port(&tmp)) {
|
||||
ast_sockaddr_set_port(&tmp, ast_sockaddr_port(entry->result));
|
||||
}
|
||||
|
Reference in New Issue
Block a user