+ /* copy the key */
+ int add_failed;
+ if (is_ip6)
+ {
+ key6.value = (u64) dev_instance;
+ add_failed = clib_bihash_add_del_24_8 (&vxm->vxlan6_tunnel_by_key,
+ &key6, 1 /*add */ );
+ }
+ else
+ {
+ vxlan_decap_info_t di = {.sw_if_index = t->sw_if_index, };
+ if (ip46_address_is_multicast (&t->dst))
+ di.local_ip = t->src.ip4;
+ else
+ di.next_index = t->decap_next_index;
+ key4.value = di.as_u64;
+ add_failed = clib_bihash_add_del_16_8 (&vxm->vxlan4_tunnel_by_key,
+ &key4, 1 /*add */ );
+ }
+
+ if (add_failed)
+ {
+ vnet_delete_hw_interface (vnm, t->hw_if_index);
+ hash_unset (vxm->instance_used, t->user_instance);
+ pool_put (vxm->tunnels, t);
+ return VNET_API_ERROR_INVALID_REGISTRATION;
+ }
+