@ -920,6 +920,10 @@ int websocket_init(void) {
( ! rtpe_config . https_ifs | | ! * rtpe_config . https_ifs ) )
return 0 ;
struct sockaddr_storage sa ;
int ret = lws_interface_to_sa ( 1 , " ::1 " , ( void * ) & sa , sizeof ( sa ) ) ;
bool have_lws_ipv6 = ( ret = = 0 ) ;
const char * err = NULL ;
lws_set_log_level ( LLL_ERR | LLL_WARN , websocket_log ) ;
@ -945,10 +949,15 @@ int websocket_init(void) {
goto err ;
bool success = false ;
bool ipv6_fail = false ;
for ( int i = 0 ; i < G_N_ELEMENTS ( eps ) ; i + + ) {
endpoint_t * ep = & eps [ i ] ;
if ( ! ep - > port )
continue ;
if ( ep - > address . family - > af = = AF_INET6 & & ! have_lws_ipv6 ) {
ipv6_fail = true ;
continue ;
}
struct lws_context_creation_info * vhost = g_slice_alloc ( sizeof ( * vhost ) ) ;
g_queue_push_tail ( & websocket_vhost_configs , vhost ) ;
@ -966,6 +975,9 @@ int websocket_init(void) {
success = true ;
}
err = " Failed to create any LWS vhost from given config " ;
if ( ipv6_fail )
err = " Failed to create any LWS vhost from given config. Hint: LWS IPv6 support is not "
" available and config lists at least one IPv6 vhost " ;
if ( ! success )
goto err ;
}
@ -983,10 +995,15 @@ int websocket_init(void) {
goto err ;
bool success = false ;
bool ipv6_fail = false ;
for ( int i = 0 ; i < G_N_ELEMENTS ( eps ) ; i + + ) {
endpoint_t * ep = & eps [ i ] ;
if ( ! ep - > port )
continue ;
if ( ep - > address . family - > af = = AF_INET6 & & ! have_lws_ipv6 ) {
ipv6_fail = true ;
continue ;
}
struct lws_context_creation_info * vhost = g_slice_alloc ( sizeof ( * vhost ) ) ;
g_queue_push_tail ( & websocket_vhost_configs , vhost ) ;
@ -1008,6 +1025,9 @@ int websocket_init(void) {
success = true ;
}
err = " Failed to create any LWS vhost from given config " ;
if ( ipv6_fail )
err = " Failed to create any LWS vhost from given config. Hint: LWS IPv6 support is not "
" available and config lists at least one IPv6 vhost " ;
if ( ! success )
goto err ;
}