diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-12-07 21:25:55 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-12-07 21:25:55 +0000 |
commit | 3ce7e897339f9ae11b6b310d987a0e1cd6c5c816 (patch) | |
tree | 3ebca8eda096e4c4d93c59fcae5e5834fd488aa0 /src | |
parent | 1d063d93408876971d343ecfcb98481bec81e25c (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/socket.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
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); |