summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-05-19 21:50:30 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-05-19 21:50:30 +0000
commit819d0c523d8a7c4446b6d4050be0c4c0e80252eb (patch)
treea035d4b75db56ed661241af8dc6d93190fc822fc
parent552ab1e39852733203d2037aa0bbaa1b63fd94a2 (diff)
Fix to give the proper target ip on connect, cookies to w00t and Jason
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9772 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/socket.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/socket.cpp b/src/socket.cpp
index a599631a4..6baa42ed0 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -113,7 +113,7 @@ void ListenSocket::HandleEvent(EventType e, int err)
in_port = ntohs(((sockaddr_in6*)sock_us)->sin6_port);
inet_ntop(AF_INET6, &((const sockaddr_in6*)client)->sin6_addr, buf, sizeof(buf));
socklen_t raddrsz = sizeof(sockaddr_in6);
- if (getpeername(incomingSockfd, (sockaddr*) raddr, &raddrsz) == 0)
+ if (getsockname(incomingSockfd, (sockaddr*) raddr, &raddrsz) == 0)
inet_ntop(AF_INET6, &((const sockaddr_in6*)raddr)->sin6_addr, target, sizeof(target));
else
ServerInstance->Logs->Log("SOCKET", DEBUG, "Can't get peername: %s", strerror(errno));
@@ -124,12 +124,11 @@ void ListenSocket::HandleEvent(EventType e, int err)
inet_ntop(AF_INET, &((const sockaddr_in*)client)->sin_addr, buf, sizeof(buf));
in_port = ntohs(((sockaddr_in*)sock_us)->sin_port);
socklen_t raddrsz = sizeof(sockaddr_in);
- if (getpeername(incomingSockfd, (sockaddr*) raddr, &raddrsz) == 0)
+ if (getsockname(incomingSockfd, (sockaddr*) raddr, &raddrsz) == 0)
inet_ntop(AF_INET, &((const sockaddr_in*)raddr)->sin_addr, target, sizeof(target));
else
ServerInstance->Logs->Log("SOCKET", DEBUG, "Can't get peername: %s", strerror(errno));
}
-
ServerInstance->SE->NonBlocking(incomingSockfd);
ServerInstance->stats->statsAccept++;
ServerInstance->Users->AddUser(ServerInstance, incomingSockfd, in_port, false, this->family, client, target);