Commit f1775923 authored by Olivier Crête's avatar Olivier Crête

tcp-bsd: Create IPv6 socket if it such an address

parent ecaaf70e
...@@ -101,14 +101,20 @@ nice_tcp_bsd_socket_new (NiceAgent *agent, GMainContext *ctx, NiceAddress *addr) ...@@ -101,14 +101,20 @@ nice_tcp_bsd_socket_new (NiceAgent *agent, GMainContext *ctx, NiceAddress *addr)
nice_address_copy_to_sockaddr(addr, (struct sockaddr *)&name); nice_address_copy_to_sockaddr(addr, (struct sockaddr *)&name);
if ((sockfd == -1) && if (sockfd == -1) {
((name.ss_family == AF_UNSPEC) || if (name.ss_family == AF_UNSPEC || name.ss_family == AF_INET) {
(name.ss_family == AF_INET))) { sockfd = socket (PF_INET, SOCK_STREAM, 0);
sockfd = socket (PF_INET, SOCK_STREAM, 0); name.ss_family = AF_INET;
name.ss_family = AF_INET; #ifdef HAVE_SA_LEN
name.ss_len = sizeof (struct sockaddr_in);
#endif
} else if (name.ss_family == AF_INET6) {
sockfd = socket (PF_INET6, SOCK_STREAM, 0);
name.ss_family = AF_INET6;
#ifdef HAVE_SA_LEN #ifdef HAVE_SA_LEN
name.ss_len = sizeof (struct sockaddr_in); name.ss_len = sizeof (struct sockaddr_in6);
#endif #endif
}
} }
if (sockfd == -1) { if (sockfd == -1) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment