]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Prevent IAX2 from getting IPv6 addresses via DNS
authorKinsey Moore <kmoore@digium.com>
Mon, 12 Sep 2011 13:25:42 +0000 (13:25 +0000)
committerKinsey Moore <kmoore@digium.com>
Mon, 12 Sep 2011 13:25:42 +0000 (13:25 +0000)
IAX2 does not support IPv6 and getting such addresses from DNS can cause error
messages on the remote end involving bad IPv4 address casts in the presence of
IPv6/IPv4 tunnels.  This patch ensures that IAX2 will not encounter IPv6
addresses via DNS queries.

(closes issue ASTERISK-18090)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@335320 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c

index 84bd3fe34f73d4b5259ad5c50fcb62c06544a336..03a3f71e901c38aa8c4b5f8e10c8ec1d8ac7c38e 100644 (file)
@@ -8480,6 +8480,7 @@ static int iax2_append_register(const char *hostname, const char *username,
        if (!(reg = ast_calloc(1, sizeof(*reg))))
                return -1;
 
+       reg->addr.ss.ss_family = AF_INET;
        if (ast_dnsmgr_lookup(hostname, &reg->addr, &reg->dnsmgr, srvlookup ? "_iax._udp" : NULL) < 0) {
                ast_free(reg);
                return -1;
@@ -12309,6 +12310,7 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, st
                peer->expire = -1;
                peer->pokeexpire = -1;
                peer->sockfd = defaultsockfd;
+               peer->addr.ss.ss_family = AF_INET;
                if (ast_string_field_init(peer, 32))
                        peer = peer_unref(peer);
        }