Skip to content

Commit

Permalink
segmentation is used only for first autotest check, changed size invo…
Browse files Browse the repository at this point in the history
…lved
  • Loading branch information
vecna committed May 14, 2011
1 parent 08d7821 commit eb727e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
8 changes: 5 additions & 3 deletions src/plugins/segmentation/segmentation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class segmentation : public Plugin
#define PLUGIN_NAME "TCP Segmentation"
#define PKT_LOG "plugin.segmentation.log"

#define MIN_SPLIT_PAYLOAD 2 /* bytes */
#define MIN_SPLIT_PAYLOAD 500 /* bytes */
#define MIN_SPLIT_PKTS 2
#define MAX_SPLIT_PKTS 5
#define MIN_TCP_PAYLOAD (MIN_SPLIT_PKTS * MIN_SPLIT_PAYLOAD)
Expand Down Expand Up @@ -85,6 +85,8 @@ class segmentation : public Plugin
/* the original is removed, and segments are inserted */
supportedScrambles = SCRAMBLE_INNOCENT;

pLH.completeLog("Initialized plugin!");

return true;
}

Expand Down Expand Up @@ -188,8 +190,8 @@ class segmentation : public Plugin

pktVector.push_back(pkt);

pLH.completeLog(" chunk %d of %d - seq|%x",
(pkts + 1), pkts_n, ntohl(pkt->tcp->seq));
pLH.completeLog("%d/%d chunk seq|%x sjPacketId %d size %d",
(pkts + 1), pkts_n, ntohl(pkt->tcp->seq), pkt->SjPacketId, resizeAndCopy);
}

cache.add(origpkt);
Expand Down
13 changes: 4 additions & 9 deletions src/service/HDRoptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ corruptDone(false)
oD.actual_opts_len, protD.optsMaxLen);
}

/* remind: MTU is 80 byte less than the maximum available for don't check freespace */
oD.optshdr.resize(protD.optsMaxLen, protD.EOL_code);
if(oD.actual_opts_len > 0)
{
for(uint32_t i = 0; i < *protD.hdrLen; i++)
Expand All @@ -145,15 +147,8 @@ corruptDone(false)
acquirePresentOptions(pkt.SjPacketId);
}

if(oD.actual_opts_len < protD.optsMaxLen)
{
uint16_t maxOptSpace = pkt.freespace() > protD.optsMaxLen ? protD.optsMaxLen : ((pkt.freespace() >> 4) << 4);

LOG_PACKET("! Resizing space of opts header: %d < %d, resizing from %d to %d",
oD.actual_opts_len, protD.optsMaxLen, oD.optshdr.size(), protD.optsMaxLen);
oD.optshdr.resize(maxOptSpace, protD.EOL_code);
LOG_PACKET("? checking: this is the size now: %d", oD.optshdr.size());
}
LOG_PACKET("? checking space of opts header: %d < %d, resizing from %d to %d",
oD.actual_opts_len, protD.optsMaxLen, oD.optshdr.size(), protD.optsMaxLen);
}

void HDRoptions::acquirePresentOptions(uint32_t PktID)
Expand Down

0 comments on commit eb727e7

Please sign in to comment.