fix some pcap load issues
authorHanoh Haim <[email protected]>
Thu, 17 Sep 2015 18:44:53 +0000 (21:44 +0300)
committerHanoh Haim <[email protected]>
Thu, 17 Sep 2015 18:44:53 +0000 (21:44 +0300)
VERSION
scripts/cap2/jumbo.pcap [new file with mode: 0644]
scripts/cap2/jumbo.yaml [new file with mode: 0644]
scripts/cap2/wrong_ip.pcap [new file with mode: 0644]
scripts/cap2/wrong_ip.yaml [new file with mode: 0644]
src/bp_sim.cpp
src/common/pcap.cpp

diff --git a/VERSION b/VERSION
index 917f017..fe509dd 100755 (executable)
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
-v1.75
+v1.76
 
 
 
diff --git a/scripts/cap2/jumbo.pcap b/scripts/cap2/jumbo.pcap
new file mode 100644 (file)
index 0000000..2a7f7bd
Binary files /dev/null and b/scripts/cap2/jumbo.pcap differ
diff --git a/scripts/cap2/jumbo.yaml b/scripts/cap2/jumbo.yaml
new file mode 100644 (file)
index 0000000..b45a6ca
--- /dev/null
@@ -0,0 +1,23 @@
+- duration : 10.0
+  generator :  
+          distribution : "seq"
+          clients_start : "16.0.0.1"
+          clients_end   : "16.0.1.255"
+          servers_start : "48.0.0.1"
+          servers_end   : "48.0.0.255"
+          clients_per_gb : 201
+          min_clients    : 101
+          dual_port_mask : "1.0.0.0" 
+          tcp_aging      : 1
+          udp_aging      : 1
+  mac        : [0x00,0x00,0x00,0x01,0x00,0x00]
+  #vlan       : { enable : 1  ,  vlan0 : 100 , vlan1 : 200 }
+  #mac_override_by_ip : true
+  cap_info : 
+     - name: cap2/jumbo.pcap
+       cps : 1.0
+       ipg : 10000
+       rtt : 10000
+       w   : 1
+       
+
diff --git a/scripts/cap2/wrong_ip.pcap b/scripts/cap2/wrong_ip.pcap
new file mode 100644 (file)
index 0000000..08cf8de
Binary files /dev/null and b/scripts/cap2/wrong_ip.pcap differ
diff --git a/scripts/cap2/wrong_ip.yaml b/scripts/cap2/wrong_ip.yaml
new file mode 100644 (file)
index 0000000..7de3b82
--- /dev/null
@@ -0,0 +1,23 @@
+- duration : 10.0
+  generator :  
+          distribution : "seq"
+          clients_start : "16.0.0.1"
+          clients_end   : "16.0.1.255"
+          servers_start : "48.0.0.1"
+          servers_end   : "48.0.0.255"
+          clients_per_gb : 201
+          min_clients    : 101
+          dual_port_mask : "1.0.0.0" 
+          tcp_aging      : 1
+          udp_aging      : 1
+  mac        : [0x00,0x00,0x00,0x01,0x00,0x00]
+  #vlan       : { enable : 1  ,  vlan0 : 100 , vlan1 : 200 }
+  #mac_override_by_ip : true
+  cap_info : 
+     - name: cap2/wrong_ip.pcap
+       cps : 1.0
+       ipg : 10000
+       rtt : 10000
+       w   : 1
+       
+
index 555696f..8a8bc5f 100755 (executable)
@@ -1148,13 +1148,6 @@ void CPacketIndication::ProcessIpPacket(CPacketParser *parser,
     }
     offset += ip_header_length;
 
-    if (!l3.m_ipv4->isChecksumOK() ){
-        m_cnt->m_ip_checksum_error++; 
-    }
-    if( l3.m_ipv4->isMulticast() ){
-        m_cnt->m_ip_multicast_error++; 
-        return;
-    }
 
     if( l3.m_ipv4->getTimeToLive() ==0 ){
         m_cnt->m_ip_ttl_is_zero_error++; 
@@ -1177,10 +1170,19 @@ void CPacketIndication::ProcessIpPacket(CPacketParser *parser,
         return;
     }
 
+    if ( m_packet->pkt_len > MAX_BUF_SIZE  -FIRST_PKT_SIZE ){
+        m_cnt->m_tcp_udp_pkt_length_error++; 
+        printf("ERROR packet is too big, not supported jumbo packets that larger than %d \n",MAX_BUF_SIZE);
+        return;
+    }
+
     // Set packet length and include padding if needed
     m_packet->pkt_len = l3.m_ipv4->getTotalLength() + getIpOffset();
     if (m_packet->pkt_len < 60) { m_packet->pkt_len = 60; }
 
+
+
+
     m_cnt->m_valid_udp_tcp++; 
     m_payload_len = l3.m_ipv4->getTotalLength() - (payload_offset_from_ip);
     m_payload     = (uint8_t *)(packetBase +offset);
index 6dd5451..9b360a3 100755 (executable)
@@ -156,7 +156,8 @@ bool LibPCapReader::ReadPacket(CCapPktRaw *lpPacket)
    }
    if (pkt_header.len > READER_MAX_PACKET_SIZE) {
        /* cannot read this packet */
-          assert(0);
+       printf("ERROR packet is too big, bigger than %d \n",READER_MAX_PACKET_SIZE);
+       exit(-1);
        return false;
    }