Fix calls to ast_get_ip() not initializing the address family.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@346239 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2011-11-23 22:52:59 +00:00
parent 546e7517c5
commit 20e75b7ad2
5 changed files with 25 additions and 18 deletions

View File

@@ -586,7 +586,7 @@ static int resolve_first(struct ast_sockaddr *addr, const char *name, int flag,
return 0;
}
int ast_get_ip_or_srv(struct ast_sockaddr *addr, const char *value, const char *service)
int ast_get_ip_or_srv(struct ast_sockaddr *addr, const char *hostname, const char *service)
{
char srv[256];
char host[256];
@@ -594,13 +594,13 @@ int ast_get_ip_or_srv(struct ast_sockaddr *addr, const char *value, const char *
int tportno;
if (service) {
snprintf(srv, sizeof(srv), "%s.%s", service, value);
snprintf(srv, sizeof(srv), "%s.%s", service, hostname);
if ((srv_ret = ast_get_srv(NULL, host, sizeof(host), &tportno, srv)) > 0) {
value = host;
hostname = host;
}
}
if (resolve_first(addr, value, PARSE_PORT_FORBID, addr->ss.ss_family) != 0) {
if (resolve_first(addr, hostname, PARSE_PORT_FORBID, addr->ss.ss_family) != 0) {
return -1;
}
@@ -689,9 +689,9 @@ const char *ast_tos2str(unsigned int tos)
return "unknown";
}
int ast_get_ip(struct ast_sockaddr *addr, const char *value)
int ast_get_ip(struct ast_sockaddr *addr, const char *hostname)
{
return ast_get_ip_or_srv(addr, value, NULL);
return ast_get_ip_or_srv(addr, hostname, NULL);
}
int ast_ouraddrfor(const struct ast_sockaddr *them, struct ast_sockaddr *us)