diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-02-06 01:26:16 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-02-06 01:26:16 +0000 |
commit | 658cb687610599ef29539f97cb731c52f2d25619 (patch) | |
tree | a56626fb0a5597993fddb8e83b433a773638f819 /src/socket.cpp | |
parent | e407730a6c78740c2e2656783ce338cbc7f17506 (diff) |
DNS lookups now work for users.
Todo: Upon receiving 'no resource records found' on doing AAAA or PTR6, immediately re-insert a request looking for A or PTR.
someone remind me about this when i have time.
Also todo: inspsocket connects.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6512 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/socket.cpp')
-rw-r--r-- | src/socket.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/socket.cpp b/src/socket.cpp index a32a7f98e..69bea3e0a 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -364,12 +364,26 @@ bool InspIRCd::BindSocket(int sockfd, int port, char* addr, bool dolisten) } else { - printf("Address empty\n"); - /* Theres no address here, default to ipv6 bind to all */ - ((sockaddr_in6*)server)->sin6_family = AF_INET6; - memset(&(((sockaddr_in6*)server)->sin6_addr), 0, sizeof(in6_addr)); - ((sockaddr_in6*)server)->sin6_port = htons(port); - size = sizeof(sockaddr_in6); + printf("Address empty port=%d\n", port); + if (port == -1) + { + /* Port -1: Means UDP IPV4 port binding - Special case + * used by DNS engine. + */ + printf("Special case AF_INET udp bind to all\n"); + ((sockaddr_in*)server)->sin_family = AF_INET; + ((sockaddr_in*)server)->sin_addr.s_addr = htonl(INADDR_ANY); + ((sockaddr_in*)server)->sin_port = 0; + size = sizeof(sockaddr_in); + } + else + { + /* Theres no address here, default to ipv6 bind to all */ + ((sockaddr_in6*)server)->sin6_family = AF_INET6; + memset(&(((sockaddr_in6*)server)->sin6_addr), 0, sizeof(in6_addr)); + ((sockaddr_in6*)server)->sin6_port = htons(port); + size = sizeof(sockaddr_in6); + } } #else /* If we aren't built with ipv6, the choice becomes simple */ |