From 819d0c523d8a7c4446b6d4050be0c4c0e80252eb Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 19 May 2008 21:50:30 +0000 Subject: 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 --- src/socket.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/socket.cpp') 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); -- cgit v1.2.3