From 51e01194600994588b2a9b1d82c1c763e4c6d0b0 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 26 Sep 2016 16:20:24 +0000 Subject: [PATCH] output the proper ipv4 address --- external/3rd/library/udplibrary/UdpLibrary.cpp | 9 ++++++++- external/3rd/library/udplibrary/UdpLibrary.hpp | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/external/3rd/library/udplibrary/UdpLibrary.cpp b/external/3rd/library/udplibrary/UdpLibrary.cpp index 630e32a3..1299073a 100755 --- a/external/3rd/library/udplibrary/UdpLibrary.cpp +++ b/external/3rd/library/udplibrary/UdpLibrary.cpp @@ -152,6 +152,13 @@ char *UdpIpAddress::GetAddress(char *buffer) const return(buffer); } +char *UdpIpAddress::GetV4Address() const +{ + struct sockaddr_in addr_serverUDP; + addr_serverUDP.sin_addr.s_addr = mIp; + return inet_ntoa(addr_serverUDP.sin_addr); +} + ///////////////////////////////////////////////////////////////////////////////////////////////////// // UdpManager::Params initializations constructor (ie. default values) ///////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1014,7 +1021,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) if (clientConnections >= mParams.maxConnectionsPerIP) { - printf("Possible DoS attempt? Client %i attempted more connections than the limit (%i). Dropping!\n", e->mIp.GetAddress(), mParams.maxConnectionsPerIP); + printf("Possible DoS attempt? Client %s attempted more connections than the limit (%i). Dropping!\n", e->mIp.GetV4Address(), mParams.maxConnectionsPerIP); return; } } diff --git a/external/3rd/library/udplibrary/UdpLibrary.hpp b/external/3rd/library/udplibrary/UdpLibrary.hpp index 469cf159..0b37907c 100644 --- a/external/3rd/library/udplibrary/UdpLibrary.hpp +++ b/external/3rd/library/udplibrary/UdpLibrary.hpp @@ -99,6 +99,7 @@ class UdpIpAddress public: UdpIpAddress(unsigned int ip = 0); unsigned int GetAddress() const { return(mIp); } + char *GetV4Address() const; char *GetAddress(char *buffer) const; bool operator==(const UdpIpAddress& e) const { return(mIp == e.mIp); } protected: