diff options
author | 2017-04-24 20:18:10 +0800 | |
---|---|---|
committer | 2017-04-24 20:18:10 +0800 | |
commit | d74de22904687af10de9dbea04a282afb42fb326 (patch) | |
tree | 0140c0112d7fa5e383ae5c01871a2dc0a037535c | |
parent | 371a60c3c41523bfa5c21e43f7ef155dd75cbcb8 (diff) |
Fix dual-loop issue of NSH-SNAT. NSHSFC-30
Change-Id: I000f617e554c55da2629503da415350e139eceba
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
-rw-r--r-- | nsh-plugin/nsh/nsh.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/nsh-plugin/nsh/nsh.c b/nsh-plugin/nsh/nsh.c index f2d4685..34aa9ab 100644 --- a/nsh-plugin/nsh/nsh.c +++ b/nsh-plugin/nsh/nsh.c @@ -1617,6 +1617,8 @@ nsh_input_map (vlib_main_t * vm, nsh_proxy_session_by_key_t key0, key1; uword *p0, *p1; nsh_proxy_session_t *proxy0, *proxy1; + u32 sw_if_index0 = 0, sw_if_index1 = 0; + ethernet_header_t dummy_eth0, dummy_eth1; /* Prefetch next iteration. */ { @@ -1656,6 +1658,21 @@ nsh_input_map (vlib_main_t * vm, { nsp_nsi0 = clib_host_to_net_u32(vnet_buffer(b0)->l2_classify.opaque_index); } + else if(node_type == NSH_AWARE_VNF_PROXY_TYPE) + { + /* Push dummy Eth header */ + memset(&dummy_eth0.dst_address[0], 0x11223344, 4); + memset(&dummy_eth0.dst_address[4], 0x5566, 2); + memset(&dummy_eth0.src_address[0], 0x778899aa, 4); + memset(&dummy_eth0.src_address[4], 0xbbcc, 2); + dummy_eth0.type = 0x0800; + vlib_buffer_advance(b0, -(word)sizeof(ethernet_header_t)); + hdr0 = vlib_buffer_get_current(b0); + clib_memcpy(hdr0, &dummy_eth0, (word)sizeof(ethernet_header_t)); + + sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_TX]; + nsp_nsi0 = nm->tunnel_index_by_sw_if_index[sw_if_index0]; + } else { memset (&key0, 0, sizeof(key0)); @@ -1688,6 +1705,21 @@ nsh_input_map (vlib_main_t * vm, { nsp_nsi1 = clib_host_to_net_u32(vnet_buffer(b1)->l2_classify.opaque_index); } + else if(node_type == NSH_AWARE_VNF_PROXY_TYPE) + { + /* Push dummy Eth header */ + memset(&dummy_eth1.dst_address[0], 0x11223344, 4); + memset(&dummy_eth1.dst_address[4], 0x5566, 2); + memset(&dummy_eth1.src_address[0], 0x778899aa, 4); + memset(&dummy_eth1.src_address[4], 0xbbcc, 2); + dummy_eth1.type = 0x0800; + vlib_buffer_advance(b1, -(word)sizeof(ethernet_header_t)); + hdr1 = vlib_buffer_get_current(b1); + clib_memcpy(hdr1, &dummy_eth1, (word)sizeof(ethernet_header_t)); + + sw_if_index1 = vnet_buffer(b1)->sw_if_index[VLIB_TX]; + nsp_nsi1 = nm->tunnel_index_by_sw_if_index[sw_if_index1]; + } else { memset (&key1, 0, sizeof(key1)); |