Browse Source

log more disgnostics data

pull/157/head
orignal 10 years ago
parent
commit
95dbc20350
  1. 11
      NetDb.cpp
  2. 2
      SSUData.cpp

11
NetDb.cpp

@ -525,12 +525,13 @@ namespace data
{ {
LogPrint ("RouterInfo"); LogPrint ("RouterInfo");
size_t size = bufbe16toh (buf + offset); size_t size = bufbe16toh (buf + offset);
if (size > 2048) offset += 2;
if (size > 2048 || size > len - offset)
{ {
LogPrint ("Invalid RouterInfo length ", (int)size); LogPrint ("Invalid RouterInfo length ", (int)size);
i2p::DeleteI2NPMessage (m);
return; return;
} }
offset += 2;
CryptoPP::Gunzip decompressor; CryptoPP::Gunzip decompressor;
decompressor.Put (buf + offset, size); decompressor.Put (buf + offset, size);
decompressor.MessageEnd(); decompressor.MessageEnd();
@ -646,11 +647,11 @@ namespace data
char key[48]; char key[48];
int l = i2p::data::ByteStreamToBase64 (buf, 32, key, 48); int l = i2p::data::ByteStreamToBase64 (buf, 32, key, 48);
key[l] = 0; key[l] = 0;
LogPrint ("DatabaseLookup for ", key, " recieved");
uint8_t flag = buf[64]; uint8_t flag = buf[64];
LogPrint ("DatabaseLookup for ", key, " recieved flags=", (int)flag);
uint8_t * excluded = buf + 65; uint8_t * excluded = buf + 65;
uint32_t replyTunnelID = 0; uint32_t replyTunnelID = 0;
if (flag & 0x01) //reply to tunnel if (flag & DATABASE_LOOKUP_DELIVERY_FLAG) //reply to tunnel
{ {
replyTunnelID = bufbe32toh (buf + 64); replyTunnelID = bufbe32toh (buf + 64);
excluded += 4; excluded += 4;
@ -710,7 +711,7 @@ namespace data
if (replyTunnelID) if (replyTunnelID)
{ {
// encryption might be used though tunnel only // encryption might be used though tunnel only
if (flag & 0x02) // encrypted reply requested if (flag & DATABASE_LOOKUP_ENCYPTION_FLAG) // encrypted reply requested
{ {
uint8_t * sessionKey = excluded; uint8_t * sessionKey = excluded;
uint8_t numTags = sessionKey[32]; uint8_t numTags = sessionKey[32];

2
SSUData.cpp

@ -266,7 +266,7 @@ namespace transport
//uint8_t * start = buf; //uint8_t * start = buf;
uint8_t flag = *buf; uint8_t flag = *buf;
buf++; buf++;
LogPrint (eLogDebug, "Process SSU data flags=", (int)flag); LogPrint (eLogDebug, "Process SSU data flags=", (int)flag, " len=", len);
// process acks if presented // process acks if presented
if (flag & (DATA_FLAG_ACK_BITFIELDS_INCLUDED | DATA_FLAG_EXPLICIT_ACKS_INCLUDED)) if (flag & (DATA_FLAG_ACK_BITFIELDS_INCLUDED | DATA_FLAG_EXPLICIT_ACKS_INCLUDED))
ProcessAcks (buf, flag); ProcessAcks (buf, flag);

Loading…
Cancel
Save