summaryrefslogtreecommitdiffstats
path: root/src/bp_sim.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bp_sim.cpp')
-rwxr-xr-xsrc/bp_sim.cpp48
1 files changed, 32 insertions, 16 deletions
diff --git a/src/bp_sim.cpp b/src/bp_sim.cpp
index f81ef446..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);
@@ -1294,7 +1296,9 @@ bool CPacketIndication::ConvertPacketToIpv6InPlace(CCapPktRaw * pkt,
void CPacketIndication::ProcessPacket(CPacketParser *parser,
CCapPktRaw * pkt){
_ProcessPacket(parser,pkt);
- UpdateOffsets(); /* update fast offsets */
+ if ( m_desc.IsValidPkt() ){
+ UpdateOffsets(); /* update fast offsets */
+ }
}
@@ -2119,7 +2123,13 @@ int CCapFileFlowInfo::load_cap_file(std::string cap_file,uint16_t _id,uint8_t pl
}
}
+ }else{
+ printf("ERROR packet %d is not supported, should be IP(0x0800)/TCP/UDP format try to convert it using Wireshark !\n",cnt);
+ exit(-1);
}
+ }else{
+ printf("ERROR packet %d is not supported, should be IP(0x0800)/TCP/UDP format try to convert it using Wireshark !\n",cnt);
+ exit(-1);
}
}
@@ -4371,6 +4381,7 @@ int CErfIF::send_node(CGenNode * node){
CFlowPktInfo * lp=node->m_pkt_info;
rte_mbuf_t * m=lp->generate_new_mbuf(node);
+
fill_pkt(m_raw,m);
CPktNsecTimeStamp t_c(node->m_time);
m_raw->time_nsec = t_c.m_time_nsec;
@@ -4552,6 +4563,7 @@ void CCPortLatency::reset(){
m_tx_pkt_err=0;
m_tx_pkt_ok =0;
m_pkt_ok=0;
+ m_rx_check=0;
m_no_magic=0;
m_unsup_prot=0;
m_no_id=0;
@@ -5363,10 +5375,11 @@ void on_node_last(uint8_t plugin_id,CGenNode * node){
}
rte_mbuf_t * on_node_generate_mbuf(uint8_t plugin_id,CGenNode * node,CFlowPktInfo * pkt_info){
- if (CPluginCallback::callback) {
- CPluginCallback::callback->on_node_generate_mbuf(plugin_id,node,pkt_info);
- }
-
+ rte_mbuf_t * m;
+ assert(CPluginCallback::callback);
+ m=CPluginCallback::callback->on_node_generate_mbuf(plugin_id,node,pkt_info);
+ assert(m);
+ return(m);
}
@@ -6199,22 +6212,25 @@ rte_mbuf_t * CPluginCallbackSimple::rtsp_plugin(uint8_t plugin_id,CGenNode *
/* replace the tuples */
rte_mbuf_t * CPluginCallbackSimple::on_node_generate_mbuf(uint8_t plugin_id,CGenNode * node,CFlowPktInfo * pkt_info){
+
+ rte_mbuf_t * m=NULL;
switch (plugin_id) {
case mpRTSP:
- rtsp_plugin(plugin_id,node,pkt_info);
+ m=rtsp_plugin(plugin_id,node,pkt_info);
break;
case mpSIP_VOICE:
- sip_voice_plugin(plugin_id,node,pkt_info);
+ m=sip_voice_plugin(plugin_id,node,pkt_info);
break;
case mpDYN_PYLOAD:
- dyn_pyload_plugin(plugin_id,node,pkt_info);
+ m=dyn_pyload_plugin(plugin_id,node,pkt_info);
break;
case mpAVL_HTTP_BROWSIN:
- http_plugin(plugin_id,node,pkt_info);
+ m=http_plugin(plugin_id,node,pkt_info);
break;
default:
assert(0);
}
+ return (m);
}