summaryrefslogtreecommitdiff
path: root/src/core/network.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/network.c')
-rw-r--r--src/core/network.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/network.c b/src/core/network.c
index c5a4e2f1..535cdcf8 100644
--- a/src/core/network.c
+++ b/src/core/network.c
@@ -245,6 +245,15 @@ GIOChannel *net_listen(IPADDR *my_ip, int *port)
/* create the socket */
handle = socket(so.sin.sin_family, SOCK_STREAM, 0);
+#ifdef HAVE_IPV6
+ if (handle == -1 && errno == EINVAL) {
+ /* IPv6 is not supported by OS */
+ so.sin.sin_family = AF_INET;
+ so.sin.sin_addr.s_addr = INADDR_ANY;
+
+ handle = socket(AF_INET, SOCK_STREAM, 0);
+ }
+#endif
if (handle == -1)
return NULL;