diff options
author | Ido Barnea <ibarnea@cisco.com> | 2016-12-15 21:11:34 +0200 |
---|---|---|
committer | Ido Barnea <ibarnea@cisco.com> | 2016-12-15 21:11:34 +0200 |
commit | 7ec52cf574a3abce0699b07eacdfc70539f47905 (patch) | |
tree | 48756278a891351e0865e2c3ea2fde0c405509e9 /src | |
parent | e1969be555b0567ccc43d4530cf29414e35fcd5b (diff) |
Fix trex-308. Stateful latency with NAT does not work on more than 2 ports
Signed-off-by: Ido Barnea <ibarnea@cisco.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/stateful_rx_core.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/stateful_rx_core.cpp b/src/stateful_rx_core.cpp index cd2263a4..dced7360 100644 --- a/src/stateful_rx_core.cpp +++ b/src/stateful_rx_core.cpp @@ -126,32 +126,32 @@ void CLatencyPktInfo::Create(class CLatencyPktMode *m_l_pkt_info){ } -rte_mbuf_t * CLatencyPktInfo::generate_pkt(int port_id,uint32_t extern_ip){ - bool is_client_to_server=(port_id%2==0)?true:false; - - int dual_port_index=(port_id>>1); - uint32_t c=m_client_ip.v4; - uint32_t s=m_server_ip.v4; - if ( extern_ip ){ - c=extern_ip; +rte_mbuf_t * CLatencyPktInfo::generate_pkt(int port_id, uint32_t extern_ip) { + bool is_client_to_server = (port_id % 2 == 0) ? true:false; + int dual_port_index = port_id >> 1; + uint32_t mask = dual_port_index * m_dual_port_mask; + uint32_t c = m_client_ip.v4; + uint32_t s = m_server_ip.v4; + + if (is_client_to_server) { + if ( extern_ip ) { + m_dummy_node.m_src_ip = extern_ip; + } else { + m_dummy_node.m_src_ip = c + mask; + } + m_dummy_node.m_dest_ip = s + mask; + } else { + if ( extern_ip ) { + m_dummy_node.m_dest_ip = extern_ip; + } else { + m_dummy_node.m_dest_ip = c + mask; + } + m_dummy_node.m_src_ip = s + mask; } - if (!is_client_to_server) { - /*swap */ - uint32_t t=c; - c=s; - s=t; - } - uint32_t mask=dual_port_index*m_dual_port_mask; - if ( extern_ip==0 ){ - c+=mask; - } - s+=mask; - m_dummy_node.m_src_ip = c; - m_dummy_node.m_dest_ip = s; + rte_mbuf_t *m = m_pkt_info.generate_new_mbuf(&m_dummy_node); - rte_mbuf_t * m=m_pkt_info.generate_new_mbuf(&m_dummy_node); - return (m); + return m; } void CLatencyPktInfo::set_ip(uint32_t src, |