]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix STUN crash when using IPv6 any address
authorKinsey Moore <kmoore@digium.com>
Tue, 8 Oct 2013 15:42:44 +0000 (15:42 +0000)
committerKinsey Moore <kmoore@digium.com>
Tue, 8 Oct 2013 15:42:44 +0000 (15:42 +0000)
Ensure that when chan_sip binds to the IPv6 any address ([::]), IPv4
candidates are also added.

(closes issue ASTERISK-21917)
Reported by: Torrey Searle
Patches:
    0023_ipv6_stun_crash.patch uploaded by Torrey Searle (License 5334)

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

res/res_rtp_asterisk.c

index 9b1716a29eb53de6a01b2ebb697d8d2883e7a486..480877ac22c4b6d4e0b34bc45b4d0e12f82ed496 100644 (file)
@@ -1660,7 +1660,13 @@ static void rtp_add_candidates_to_ice(struct ast_rtp_instance *instance, struct
        unsigned int count = PJ_ARRAY_SIZE(address), pos = 0;
 
        /* Add all the local interface IP addresses */
-       pj_enum_ip_interface(ast_sockaddr_is_ipv4(addr) ? pj_AF_INET() : pj_AF_INET6(), &count, address);
+       if (ast_sockaddr_is_ipv4(addr)) {
+               pj_enum_ip_interface(pj_AF_INET(), &count, address);
+       } else if (ast_sockaddr_is_any(addr)) {
+               pj_enum_ip_interface(pj_AF_UNSPEC(), &count, address);
+       } else {
+               pj_enum_ip_interface(pj_AF_INET6(), &count, address);
+       }
 
        for (pos = 0; pos < count; pos++) {
                pj_sockaddr_set_port(&address[pos], port);