Added ip spoofing protectection.

This commit is contained in:
phr0z3nt04st
2010-06-22 15:31:11 -05:00
parent 80b7af4809
commit b13bbd7b40
11 changed files with 553 additions and 4 deletions

View File

@@ -67,6 +67,9 @@
#include "llstoredmessage.h"
#include "llsocks5.h"
// <edit>
#include "llnetcanary.h"
// </edit>
const U32 MESSAGE_MAX_STRINGS_LENGTH = 64;
const U32 MESSAGE_NUMBER_OF_HASH_BUCKETS = 8192;
@@ -215,6 +218,12 @@ class LLMessageSystem : public LLMessageSenderInterface
private:
U8 mSendBuffer[MAX_BUFFER_SIZE];
S32 mSendSize;
// <edit>
U32 mSpoofProtectionLevel;
std::vector<LLNetCanary*> mCanaries;
std::map<U32, LLNetCanary::entry> mCanaryEntries;
void (*mSpoofDroppedCallback)(LLNetCanary::entry);
// </edit>
bool mBlockUntrustedInterface;
LLHost mUntrustedInterface;
@@ -236,7 +245,6 @@ class LLMessageSystem : public LLMessageSenderInterface
// </edit>
message_template_name_map_t mMessageTemplates;
message_template_number_map_t mMessageNumbers;
// <edit>
//public:
// </edit>
@@ -614,6 +622,11 @@ public:
// Change this message to be UDP black listed.
void banUdpMessage(const std::string& name);
// <edit>
void startSpoofProtection(U32 level);
void stopSpoofProtection();
void setSpoofDroppedCallback(void (*callback)(LLNetCanary::entry));
// </edit>
private:
// A list of the circuits that need to be sent DenyTrustedCircuit messages.
@@ -756,7 +769,13 @@ private:
LLUUID mSessionID;
void addTemplate(LLMessageTemplate *templatep);
// <edit>
public:
// </edit>
BOOL decodeTemplate( const U8* buffer, S32 buffer_size, LLMessageTemplate** msg_template );
// <edit>
private:
// </edit>
void logMsgFromInvalidCircuit( const LLHost& sender, BOOL recv_reliable );
void logTrustedMsgFromUntrustedCircuit( const LLHost& sender );