summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2015-09-17 21:44:53 +0300
committerHanoh Haim <hhaim@cisco.com>2015-09-17 21:44:53 +0300
commitf885ac59cebcf1e87b97b0e6ef6e9eb032f9f733 (patch)
treef577368cb65bc537a85c1b7c4111618d84984318
parenta360a1734c459d62bd4c204a6005214ce8944f85 (diff)
fix some pcap load issues
-rwxr-xr-xVERSION2
-rw-r--r--scripts/cap2/jumbo.pcapbin0 -> 17791 bytes
-rw-r--r--scripts/cap2/jumbo.yaml23
-rw-r--r--scripts/cap2/wrong_ip.pcapbin0 -> 1530 bytes
-rw-r--r--scripts/cap2/wrong_ip.yaml23
-rwxr-xr-xsrc/bp_sim.cpp16
-rwxr-xr-xsrc/common/pcap.cpp3
7 files changed, 58 insertions, 9 deletions
diff --git a/VERSION b/VERSION
index 917f0173..fe509dde 100755
--- 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
index 00000000..2a7f7bde
--- /dev/null
+++ b/scripts/cap2/jumbo.pcap
Binary files differ
diff --git a/scripts/cap2/jumbo.yaml b/scripts/cap2/jumbo.yaml
new file mode 100644
index 00000000..b45a6ca3
--- /dev/null
+++ b/scripts/cap2/jumbo.yaml
@@ -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
index 00000000..08cf8de8
--- /dev/null
+++ b/scripts/cap2/wrong_ip.pcap
Binary files differ
diff --git a/scripts/cap2/wrong_ip.yaml b/scripts/cap2/wrong_ip.yaml
new file mode 100644
index 00000000..7de3b82d
--- /dev/null
+++ b/scripts/cap2/wrong_ip.yaml
@@ -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
+
+
diff --git a/src/bp_sim.cpp b/src/bp_sim.cpp
index 555696f1..8a8bc5f9 100755
--- a/src/bp_sim.cpp
+++ b/src/bp_sim.cpp
@@ -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);
diff --git a/src/common/pcap.cpp b/src/common/pcap.cpp
index 6dd54514..9b360a3e 100755
--- a/src/common/pcap.cpp
+++ b/src/common/pcap.cpp
@@ -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;
}