Coverity fixes (VPP-1204)
[vpp.git] / src / vnet / srmpls / sr_mpls_steering.c
index 0bd3466..c5ddab7 100755 (executable)
@@ -301,7 +301,10 @@ compute_sr_te_automated_steering_fib_entry (mpls_sr_steering_policy_t *
 
   if (steer_pl->vpn_label != (u32) ~ 0)
     {
-      vec_add1 (path.frp_label_stack, steer_pl->vpn_label);
+      fib_mpls_label_t fml = {
+       .fml_value = steer_pl->vpn_label,
+      };
+      vec_add1 (path.frp_label_stack, fml);
       path.frp_eos = MPLS_NON_EOS;
     }
 
@@ -390,22 +393,16 @@ sr_mpls_steering_policy_add (mpls_label_t bsid, u32 table_id,
 
   memset (&key, 0, sizeof (sr_mpls_steering_key_t));
 
-  /* Compute the steer policy key */
-  if (traffic_type == SR_STEER_IPV4 || traffic_type == SR_STEER_IPV6)
-    {
-      key.prefix.as_u64[0] = prefix->as_u64[0];
-      key.prefix.as_u64[1] = prefix->as_u64[1];
-      key.mask_width = mask_width;
-      key.fib_table = (table_id != (u32) ~ 0 ? table_id : 0);
-    }
-  else
+  if (traffic_type != SR_STEER_IPV4 && traffic_type != SR_STEER_IPV6)
     return -1;
 
+  /* Compute the steer policy key */
+  key.prefix.as_u64[0] = prefix->as_u64[0];
+  key.prefix.as_u64[1] = prefix->as_u64[1];
+  key.mask_width = mask_width;
+  key.fib_table = (table_id != (u32) ~ 0 ? table_id : 0);
   key.traffic_type = traffic_type;
 
-  if (traffic_type != SR_STEER_IPV4 && traffic_type != SR_STEER_IPV6)
-    return -1;
-
   /*
    * Search for steering policy. If already exists we are adding a new
    * color.
@@ -480,7 +477,12 @@ sr_mpls_steering_policy_add (mpls_label_t bsid, u32 table_id,
       fib_route_path_t *paths = NULL;
 
       if (steer_pl->vpn_label != (u32) ~ 0)
-       vec_add1 (path.frp_label_stack, steer_pl->vpn_label);
+       {
+         fib_mpls_label_t fml = {
+           .fml_value = steer_pl->vpn_label,
+         };
+         vec_add1 (path.frp_label_stack, fml);
+       }
 
       /* FIB API calls - Recursive route through the BindingSID */
       if (traffic_type == SR_STEER_IPV6)