mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-31 10:19:24 -04:00
* Added another Test UdpLayer: TimedUdpLayer, This simulates the firewalled situation, be only accepting packets after 60 seconds.
* added quick and dirty BitDht Packet check. test against "d1:" for the first 3 bytes. This should not conflict with Stun, Relay or TOU packets. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4480 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
fcd51a8439
commit
6e6767be30
5 changed files with 116 additions and 10 deletions
|
@ -1122,11 +1122,24 @@ void bdNodeManager::doValueCallback(const bdNodeId *id, std::string key, uint32_
|
|||
}
|
||||
|
||||
|
||||
#define BITDHT_IDENTITY_STRING_V1 "d1:"
|
||||
#define BITDHT_IDENTITY_SIZE_V1 3
|
||||
#define BITDHT_PACKET_MIN_SIZE 4
|
||||
|
||||
/******************* Internals *************************/
|
||||
int bdNodeManager::isBitDhtPacket(char *data, int size, struct sockaddr_in & from)
|
||||
|
||||
{
|
||||
|
||||
/* use a very simple initial check */
|
||||
if (size < BITDHT_PACKET_MIN_SIZE)
|
||||
return 0;
|
||||
|
||||
return (0 == strncmp(data, BITDHT_IDENTITY_STRING_V1, BITDHT_IDENTITY_SIZE_V1));
|
||||
|
||||
/* Below is the old version! */
|
||||
|
||||
|
||||
#ifdef DEBUG_MGR_PKT
|
||||
std::cerr << "bdNodeManager::isBitDhtPacket() *******************************";
|
||||
std::cerr << " from " << inet_ntoa(from.sin_addr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue