Set sin_family to AF_INET when doing lookups, also reset sin_port the first time the ip address changes.

(closes issue #17496)
Reported by: ManChicken

(closes issue #15827)
Reported by: DennisD
Patches:
      dnsmgr_15827.patch uploaded by chappell (license 8)
Tested by: DennisD, gentlec, damage, wimpy


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Matthew Nicholson
2010-06-16 20:34:31 +00:00
parent fcb055fb4e
commit 9f1136143b
2 changed files with 12 additions and 9 deletions

View File

@@ -387,6 +387,7 @@ int ast_get_ip_or_srv(struct sockaddr_in *sin, const char *value, const char *se
}
}
if ((hp = ast_gethostbyname(value, &ahp))) {
sin->sin_family = hp->h_addrtype;
memcpy(&sin->sin_addr, hp->h_addr, sizeof(sin->sin_addr));
} else {
ast_log(LOG_WARNING, "Unable to lookup '%s'\n", value);