Commit 3a37e941 authored by Håvard Moås's avatar Håvard Moås
Browse files

Update IPFIXLIB to fix TCP packet order check bugs, havard.mork@gmail.com

git-svn-id: file:///home/svn/mapi/branches/haavardm-mapi@110 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 14a1e145
......@@ -701,11 +701,11 @@ void addPktToHash(np_ctxt_t *npctxt,
bkt->src2dstMaxTTL = ttl;
// Calculate packets out of sequence for various transport protocols.
/* Calculate packets out of sequence for various transport protocols.*/
switch(proto) {
case IPPROTO_TCP:
if((bkt->src2dst_last_sequence_number+payloadLen) > seqnum) {
// Packet has lower ID than expected
if(bkt->src2dst_last_sequence_number > seqnum) {
// seqnum has lower ID than expected
bkt->src2dst_num_packets_out_of_sequence++;
} else {
// Ordered, or early delivery.
......@@ -767,7 +767,7 @@ void addPktToHash(np_ctxt_t *npctxt,
if(bkt->dst2src_last_sequence_number != 0) {
switch(proto) {
case IPPROTO_TCP:
if((bkt->dst2src_last_sequence_number+payloadLen) > seqnum) {
if(bkt->dst2src_last_sequence_number > seqnum) {
// Packet has lower ID than expected
bkt->dst2src_num_packets_out_of_sequence++;
} else {
......@@ -776,7 +776,9 @@ void addPktToHash(np_ctxt_t *npctxt,
}
break;
};
}
} else
bkt->dst2src_last_sequence_number = seqnum;
if(bkt->dst2srcflowid==0) {
bkt->dst2srcflowid = npctxt->numObservedFlows;
......
......@@ -177,7 +177,7 @@ nprobeProcessPacket(void *ctxt, mapid_pkthdr_t *pkt_head, const void *pkt)
if(!npctxt->ignoreTcpUdpPorts)
sport = ntohs(tp.th_sport), dport = ntohs(tp.th_dport);
flags = tp.th_flags;
seqnum = tp.th_seq;
seqnum = ntohl(tp.th_seq);
payloadLen = caplen - offset - (tp.th_off * 4);
if(payloadLen > 0)
payload = (unsigned char*)pkt+offset+(tp.th_off * 4);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment