[svn-commits] bbryant: trunk r129156 - in /trunk/main: dns.c dnsmgr.c srv.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Jul 8 16:00:01 CDT 2008
Author: bbryant
Date: Tue Jul 8 16:00:01 2008
New Revision: 129156
URL: http://svn.digium.com/view/asterisk?view=rev&rev=129156
Log:
Fix a bug in SRV lookups where dnsmgr would discard everything but the
first SRV result from DNS before processing weights and priorities and
dns_parse_answer wouldn't report that there were no records in DNS
unless a failure occured. Also fixed a bug where dnsmgr_refresh would
report that a entry was being changed when ast_gethostbyname had failed.
Modified:
trunk/main/dns.c
trunk/main/dnsmgr.c
trunk/main/srv.c
Modified: trunk/main/dns.c
URL: http://svn.digium.com/view/asterisk/trunk/main/dns.c?view=diff&rev=129156&r1=129155&r2=129156
==============================================================================
--- trunk/main/dns.c (original)
+++ trunk/main/dns.c Tue Jul 8 16:00:01 2008
@@ -189,6 +189,7 @@
unsigned char *fullanswer = answer;
struct dn_answer *ans;
dns_HEADER *h;
+ int ret = 0;
int res;
int x;
@@ -234,14 +235,13 @@
ast_log(LOG_WARNING, "Failed to parse result\n");
return -1;
}
- if (res > 0)
- return 1;
+ ret = 1;
}
}
answer += ntohs(ans->size);
len -= ntohs(ans->size);
}
- return 0;
+ return ret;
}
#ifndef HAVE_RES_NINIT
Modified: trunk/main/dnsmgr.c
URL: http://svn.digium.com/view/asterisk/trunk/main/dnsmgr.c?view=diff&rev=129156&r1=129155&r2=129156
==============================================================================
--- trunk/main/dnsmgr.c (original)
+++ trunk/main/dnsmgr.c Tue Jul 8 16:00:01 2008
@@ -164,8 +164,7 @@
if (verbose)
ast_verb(3, "refreshing '%s'\n", entry->name);
- ast_get_ip_or_srv(&tmp, entry->name, entry->service);
- if (inaddrcmp(&tmp, &entry->last)) {
+ if (!ast_get_ip_or_srv(&tmp, entry->name, entry->service) && inaddrcmp(&tmp, &entry->last)) {
ast_copy_string(iabuf, ast_inet_ntoa(entry->last.sin_addr), sizeof(iabuf));
ast_copy_string(iabuf2, ast_inet_ntoa(tmp.sin_addr), sizeof(iabuf2));
ast_log(LOG_NOTICE, "dnssrv: host '%s' changed from %s:%d to %s:%d\n",
Modified: trunk/main/srv.c
URL: http://svn.digium.com/view/asterisk/trunk/main/srv.c?view=diff&rev=129156&r1=129155&r2=129156
==============================================================================
--- trunk/main/srv.c (original)
+++ trunk/main/srv.c Tue Jul 8 16:00:01 2008
@@ -137,7 +137,7 @@
if (entry)
AST_LIST_INSERT_TAIL(&c->entries, entry, list);
- return 1;
+ return 0;
}
/* Do the bizarre SRV record weight-handling algorithm
More information about the svn-commits
mailing list