summaryrefslogtreecommitdiffstats
path: root/nsh-plugin/nsh/nsh.c
diff options
context:
space:
mode:
authorHongjun Ni <hongjun.ni@intel.com>2017-04-24 20:18:10 +0800
committerHongjun Ni <hongjun.ni@intel.com>2017-04-25 01:28:00 +0000
commit63bad81f1fa6c18cffc1acdc289891262d7b2685 (patch)
treee36e7a3afd52cd98a326a751a90ef94cece6b735 /nsh-plugin/nsh/nsh.c
parentb1895cf231a03f221e41048f84864619ef5f9fe0 (diff)
Fix dual-loop issue of NSH-SNAT. NSHSFC-30
Change-Id: I000f617e554c55da2629503da415350e139eceba Signed-off-by: Hongjun Ni <hongjun.ni@intel.com> (cherry picked from commit d74de22904687af10de9dbea04a282afb42fb326)
Diffstat (limited to 'nsh-plugin/nsh/nsh.c')
-rw-r--r--nsh-plugin/nsh/nsh.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/nsh-plugin/nsh/nsh.c b/nsh-plugin/nsh/nsh.c
index 603570b..2f500b2 100644
--- a/nsh-plugin/nsh/nsh.c
+++ b/nsh-plugin/nsh/nsh.c
@@ -1628,6 +1628,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. */
{
@@ -1667,6 +1669,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));
@@ -1699,6 +1716,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));