From 658cb687610599ef29539f97cb731c52f2d25619 Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 6 Feb 2007 01:26:16 +0000 Subject: 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 --- src/socket.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/socket.cpp') 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 */ -- cgit v1.2.3