mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 05:40:27 +00:00
Default to IPv4 if IPv6 not supported
This commit is contained in:
@@ -939,6 +939,11 @@ int main(int argc, char *argv[])
|
||||
audio_host = requested_receiver;
|
||||
}
|
||||
|
||||
if (!is_ipv6_supported()) {
|
||||
log_msg(LOG_LEVEL_WARNING, "IPv6 support missing, setting IPv4-only mode.\n");
|
||||
force_ip_version = 4;
|
||||
}
|
||||
|
||||
if (!set_output_buffering()) {
|
||||
log_msg(LOG_LEVEL_WARNING, "Cannot set console output buffering!\n");
|
||||
}
|
||||
|
||||
@@ -297,3 +297,13 @@ bool get_local_addresses(struct sockaddr_storage *addrs, size_t *len, int ip_ver
|
||||
#endif
|
||||
}
|
||||
|
||||
bool is_ipv6_supported(void)
|
||||
{
|
||||
int fd = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
if (fd == INVALID_SOCKET && errno == EAFNOSUPPORT) {
|
||||
return false;
|
||||
}
|
||||
CLOSESOCKET(fd);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ bool is_addr_loopback(struct sockaddr *sa);
|
||||
bool is_host_loopback(const char *hostname);
|
||||
uint16_t socket_get_recv_port(int fd);
|
||||
bool get_local_addresses(struct sockaddr_storage *addrs, size_t *len, int ip_version);
|
||||
bool is_ipv6_supported(void);
|
||||
|
||||
#ifdef WIN32
|
||||
#define CLOSESOCKET closesocket
|
||||
|
||||
Reference in New Issue
Block a user