From 3ce7e897339f9ae11b6b310d987a0e1cd6c5c816 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 7 Dec 2008 21:25:55 +0000 Subject: Patch to allow bindings to all ips on an ipv4 only system where the build is ipv6 (e.g. how debian build it) -- thanks for the patch danieldg git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10867 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/socket.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/socket.cpp b/src/socket.cpp index d2090c3a2..b0206da29 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -150,7 +150,13 @@ int irc::sockets::OpenTCPSocket(const char* addr, int socktype) addr = addr; struct linger linger = { 0, 0 }; #ifdef IPV6 - if (strchr(addr,':') || (!*addr)) + if (!*addr) + { + sockfd = socket (PF_INET6, socktype, 0); + if (sockfd < 0) + sockfd = socket (PF_INET, socktype, 0); + } + else if (strchr(addr,':')) sockfd = socket (PF_INET6, socktype, 0); else sockfd = socket (PF_INET, socktype, 0); -- cgit v1.2.3