summaryrefslogtreecommitdiff
path: root/main/utils.c
diff options
context:
space:
mode:
authorGuido Falsi <mad@madpilot.net>2016-11-22 18:20:06 +0100
committerJoshua Colp <jcolp@digium.com>2016-11-30 14:18:05 -0500
commit75230f4c0135f4885a49f2e5105b6ad70477f3c6 (patch)
tree06b7873e9f39475cb49338127f6e41ef91e5e1ed /main/utils.c
parenta0c0b1c9cb01db6b1b968efc01ff43a7f492795e (diff)
res_rtp: Fix regression when IPv6 is not available.
The latest Release candidate fails to create RTP streams when IPv6 is not available. Due to the changes made in September the ast_sockaddr structure passed around to create these streams is always of AF_INET6 type, causing failure when used for IPv4. This patch adds a utility function to check for availability of IPv6 and applies such check at startup to determine how to create the ast_sockaddr structures. ASTERISK-26617 #close Change-Id: I627a4e91795e821111e1cda523f083a40d0e0c3e
Diffstat (limited to 'main/utils.c')
-rw-r--r--main/utils.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/main/utils.c b/main/utils.c
index 2c56af3cd..2033664b8 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -2391,6 +2391,18 @@ char *ast_utils_which(const char *binary, char *fullpath, size_t fullpath_size)
return NULL;
}
+int ast_check_ipv6(void)
+{
+ int udp6_socket = socket(AF_INET6, SOCK_DGRAM, 0);
+
+ if (udp6_socket < 0) {
+ return 0;
+ }
+
+ close(udp6_socket);
+ return 1;
+}
+
void DO_CRASH_NORETURN ast_do_crash(void)
{
#if defined(DO_CRASH)