Change ethernet's result within unformat_decap_next
[vpp.git] / vnet / vnet / nsh-vxlan-gpe / nsh_vxlan_gpe.c
index e0661d2..3aab224 100644 (file)
@@ -218,7 +218,7 @@ static int nsh_vxlan_gpe_rewrite (nsh_vxlan_gpe_tunnel_t * t)
 
   /* Copy any TLVs */
   if (vec_len(t->tlvs))
-    memcpy (nsh0->tlvs, t->tlvs, 4*vec_len(t->tlvs));
+    clib_memcpy (nsh0->tlvs, t->tlvs, 4*vec_len(t->tlvs));
 
   t->rewrite = rw;
   return (0);
@@ -238,9 +238,10 @@ int vnet_nsh_vxlan_gpe_add_del_tunnel
   nsh_vxlan_gpe_tunnel_key_t key, *key_copy;
   hash_pair_t *hp;
   
-  key.src = a->src.as_u32; 
+  key.src = a->dst.as_u32; /* decap src in key is encap dst in config */
   key.vni = clib_host_to_net_u32 (a->vni << 8);
   key.spi_si = clib_host_to_net_u32(a->spi_si);
+  key.pad = 0;
 
   p = hash_get_mem (ngm->nsh_vxlan_gpe_tunnel_by_key, &key);
   
@@ -270,7 +271,7 @@ int vnet_nsh_vxlan_gpe_add_del_tunnel
         }
 
       key_copy = clib_mem_alloc (sizeof (*key_copy));
-      memcpy (key_copy, &key, sizeof (*key_copy));
+      clib_memcpy (key_copy, &key, sizeof (*key_copy));
 
       hash_set_mem (ngm->nsh_vxlan_gpe_tunnel_by_key, key_copy, 
                     t - ngm->tunnels);
@@ -350,7 +351,7 @@ static uword unformat_decap_next (unformat_input_t * input, va_list * args)
   else if (unformat (input, "ip6"))
     *result = NSH_VXLAN_GPE_INPUT_NEXT_IP6_INPUT;
   else if (unformat (input, "ethernet"))
-    *result = NSH_VXLAN_GPE_INPUT_NEXT_IP6_INPUT;
+    *result = NSH_VXLAN_GPE_INPUT_NEXT_ETHERNET_INPUT;
   else if (unformat (input, "nsh-vxlan-gpe"))
     *result = NSH_VXLAN_GPE_INPUT_NEXT_NSH_VXLAN_GPE_ENCAP;
   else if (unformat (input, "%d", &tmp))
@@ -513,9 +514,9 @@ VLIB_CLI_COMMAND (create_nsh_vxlan_gpe_tunnel_command, static) = {
   .short_help = 
   "nsh vxlan tunnel src <ip4-addr> dst <ip4-addr>" 
   "    c1 <nn> c2 <nn> c3 <nn> c4 <nn> spi <nn> si <nn> vni <nn>\n"
-  "    [encap-fib-id <nn>] [decap-fib-id <nn>] [o-bit <1|0>] [c-bit <1|0>]\n"
+  "    [encap-vrf-id <nn>] [decap-vrf-id <nn>] [o-bit <1|0>] [c-bit <1|0>]\n"
   "    [md-type <nn>][next-ip4][next-ip6][next-ethernet][next-nsh]\n"
-  "    [tlv <xx>][decap-next [ip4|ip6|ethernet|nsh-encap]][del]\n",
+  "    [tlv <xx>][decap-next [ip4|ip6|ethernet|nsh-vxlan-gpe]][del]\n",
   .function = nsh_vxlan_gpe_add_del_tunnel_command_fn,
 };