LISP-GPE: return index of newly created fwd entry, VPP-868
[vpp.git] / src / vnet / lisp-gpe / lisp_gpe_fwd_entry.c
index 1c34e6e..c1fea80 100644 (file)
@@ -478,6 +478,7 @@ add_ip_fwd_entry (lisp_gpe_main_t * lgm,
 
   hash_set_mem (lgm->lisp_gpe_fwd_entries, lfe->key,
                lfe - lgm->lisp_fwd_entry_pool);
+  a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
 
   fproto = (IP4 == ip_prefix_version (&fid_addr_ippref (&lfe->key->rmt)) ?
            FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6);
@@ -510,10 +511,13 @@ del_ip_fwd_entry_i (lisp_gpe_main_t * lgm, lisp_gpe_fwd_entry_t * lfe)
   lisp_fwd_path_t *path;
   fib_protocol_t fproto;
 
-  vec_foreach (path, lfe->paths)
-  {
-    lisp_gpe_adjacency_unlock (path->lisp_adj);
-  }
+  if (LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE != lfe->type)
+    {
+      vec_foreach (path, lfe->paths)
+      {
+       lisp_gpe_adjacency_unlock (path->lisp_adj);
+      }
+    }
 
   delete_fib_entries (lfe);
 
@@ -788,6 +792,7 @@ add_l2_fwd_entry (lisp_gpe_main_t * lgm,
 
   hash_set_mem (lgm->lisp_gpe_fwd_entries, lfe->key,
                lfe - lgm->lisp_fwd_entry_pool);
+  a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
 
   lfe->type = (a->is_negative ?
               LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE :
@@ -1061,6 +1066,7 @@ add_nsh_fwd_entry (lisp_gpe_main_t * lgm,
 
   hash_set_mem (lgm->lisp_gpe_fwd_entries, lfe->key,
                lfe - lgm->lisp_fwd_entry_pool);
+  a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
 
   lfe->type = (a->is_negative ?
               LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE :