BIER
[vpp.git] / src / vnet / srv6 / sr_policy_rewrite.c
index 7a37a66..514dd65 100755 (executable)
@@ -367,7 +367,7 @@ update_lb (ip6_sr_policy_t * sr_policy)
 
       /* Add FIB entry for BSID */
       fhc = fib_table_get_flow_hash_config (sr_policy->fib_table,
-                                           dpo_proto_to_fib (DPO_PROTO_IP6));
+                                           FIB_PROTOCOL_IP6);
 
       dpo_set (&sr_policy->bsid_dpo, DPO_LOAD_BALANCE, DPO_PROTO_IP6,
               load_balance_create (0, DPO_PROTO_IP6, fhc));
@@ -595,8 +595,10 @@ sr_policy_add (ip6_address_t * bsid, ip6_address_t * segments,
   if (sm->fib_table_ip6 == (u32) ~ 0)
     {
       sm->fib_table_ip6 = fib_table_create_and_lock (FIB_PROTOCOL_IP6,
+                                                    FIB_SOURCE_SR,
                                                     "SRv6 steering of IP6 prefixes through BSIDs");
       sm->fib_table_ip4 = fib_table_create_and_lock (FIB_PROTOCOL_IP6,
+                                                    FIB_SOURCE_SR,
                                                     "SRv6 steering of IP4 prefixes through BSIDs");
     }
 
@@ -672,7 +674,8 @@ sr_policy_del (ip6_address_t * bsid, u32 index)
     segment_list = pool_elt_at_index (sm->sid_lists, *sl_index);
     vec_free (segment_list->segments);
     vec_free (segment_list->rewrite);
-    vec_free (segment_list->rewrite_bsid);
+    if (!sr_policy->is_encap)
+      vec_free (segment_list->rewrite_bsid);
     pool_put_index (sm->sid_lists, *sl_index);
   }
 
@@ -683,8 +686,8 @@ sr_policy_del (ip6_address_t * bsid, u32 index)
   /* If FIB empty unlock it */
   if (!pool_elts (sm->sr_policies) && !pool_elts (sm->steer_policies))
     {
-      fib_table_unlock (sm->fib_table_ip6, FIB_PROTOCOL_IP6);
-      fib_table_unlock (sm->fib_table_ip4, FIB_PROTOCOL_IP6);
+      fib_table_unlock (sm->fib_table_ip6, FIB_PROTOCOL_IP6, FIB_SOURCE_SR);
+      fib_table_unlock (sm->fib_table_ip4, FIB_PROTOCOL_IP6, FIB_SOURCE_SR);
       sm->fib_table_ip6 = (u32) ~ 0;
       sm->fib_table_ip4 = (u32) ~ 0;
     }
@@ -766,7 +769,8 @@ sr_policy_mod (ip6_address_t * bsid, u32 index, u32 fib_table,
       segment_list = pool_elt_at_index (sm->sid_lists, sl_index);
       vec_free (segment_list->segments);
       vec_free (segment_list->rewrite);
-      vec_free (segment_list->rewrite_bsid);
+      if (!sr_policy->is_encap)
+       vec_free (segment_list->rewrite_bsid);
       pool_put_index (sm->sid_lists, sl_index);
       vec_del1 (sr_policy->segments_lists,
                sl_index_iterate - sr_policy->segments_lists);