"ANY_HOST" now point to "0.0.0.0" address for IPv4 sockets and "::" for IPv6.
This commit is contained in:
parent
98229305b0
commit
0ff4e51bd4
|
@ -142,19 +142,25 @@ static void* tnet_socket_create(void * self, va_list * app)
|
||||||
sock->type = va_arg(*app, tnet_socket_type_t);
|
sock->type = va_arg(*app, tnet_socket_type_t);
|
||||||
nonblocking = va_arg(*app, int);
|
nonblocking = va_arg(*app, int);
|
||||||
|
|
||||||
|
memset(local_hostname, 0, sizeof(local_hostname));
|
||||||
|
|
||||||
/* Get the local host name */
|
/* Get the local host name */
|
||||||
if(host != TNET_SOCKET_HOST_ANY && !tsk_strempty(host))
|
if(host != TNET_SOCKET_HOST_ANY && !tsk_strempty(host)){
|
||||||
{
|
|
||||||
memset(local_hostname, 0, sizeof(local_hostname));
|
|
||||||
memcpy(local_hostname, host, strlen(host)>sizeof(local_hostname)-1 ? sizeof(local_hostname)-1 : strlen(host));
|
memcpy(local_hostname, host, strlen(host)>sizeof(local_hostname)-1 ? sizeof(local_hostname)-1 : strlen(host));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if((status = tnet_gethostname(&local_hostname)))
|
if(TNET_SOCKET_TYPE_IS_IPV6(sock->type)){
|
||||||
{
|
memcpy(local_hostname, "::", 2);
|
||||||
TNET_PRINT_LAST_ERROR("gethostname have failed.");
|
|
||||||
goto bail;
|
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
memcpy(local_hostname, "0.0.0.0", 7);
|
||||||
|
}
|
||||||
|
//if((status = tnet_gethostname(&local_hostname)))
|
||||||
|
//{
|
||||||
|
// TNET_PRINT_LAST_ERROR("gethostname have failed.");
|
||||||
|
// goto bail;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* hints address info structure */
|
/* hints address info structure */
|
||||||
|
@ -163,7 +169,7 @@ static void* tnet_socket_create(void * self, va_list * app)
|
||||||
hints.ai_socktype = TNET_SOCKET_TYPE_IS_STREAM(sock->type) ? SOCK_STREAM : SOCK_DGRAM;
|
hints.ai_socktype = TNET_SOCKET_TYPE_IS_STREAM(sock->type) ? SOCK_STREAM : SOCK_DGRAM;
|
||||||
hints.ai_protocol = TNET_SOCKET_TYPE_IS_STREAM(sock->type) ? IPPROTO_TCP : IPPROTO_UDP;
|
hints.ai_protocol = TNET_SOCKET_TYPE_IS_STREAM(sock->type) ? IPPROTO_TCP : IPPROTO_UDP;
|
||||||
hints.ai_flags = AI_PASSIVE
|
hints.ai_flags = AI_PASSIVE
|
||||||
#if !TNET_UNDER_WINDOWS
|
#if !TNET_UNDER_WINDOWS || _WIN32_WINNT>=600
|
||||||
| AI_ADDRCONFIG
|
| AI_ADDRCONFIG
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
|
@ -132,7 +132,7 @@ void test_stack()
|
||||||
TSIP_STACK_SET_REALM("sip:sip2sip.info"), // FIXME: without sip:
|
TSIP_STACK_SET_REALM("sip:sip2sip.info"), // FIXME: without sip:
|
||||||
TSIP_STACK_SET_LOCAL_IP(LOCAL_IP),
|
TSIP_STACK_SET_LOCAL_IP(LOCAL_IP),
|
||||||
//TSIP_STACK_SET_DISCOVERY_NAPTR(1),
|
//TSIP_STACK_SET_DISCOVERY_NAPTR(1),
|
||||||
TSIP_STACK_SET_PROXY_CSCF("proxy.sipthor.net", "udp", 1),
|
TSIP_STACK_SET_PROXY_CSCF("proxy.sipthor.net", "udp", 0),
|
||||||
//TSIP_STACK_SET_PROXY_CSCF("192.168.0.15", "udp", 0),
|
//TSIP_STACK_SET_PROXY_CSCF("192.168.0.15", "udp", 0),
|
||||||
TSIP_STACK_SET_PROXY_CSCF_PORT(5060),
|
TSIP_STACK_SET_PROXY_CSCF_PORT(5060),
|
||||||
TSIP_STACK_SET_SEC_AGREE_MECH("ipsec-3gpp"),
|
TSIP_STACK_SET_SEC_AGREE_MECH("ipsec-3gpp"),
|
||||||
|
|
Loading…
Reference in New Issue